API-Drip-Request

 view release on metacpan or  search on metacpan

bin/drip_client.pl  view on Meta::CPAN

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
=item B<-v,-verbose>
 
Be verbose about something.  Specify it more than once to be even more verbose.
 
=item B<-conf>
 
Specify the location of a configuration file.   Otherwise, defaults to location
specified in the DRIP_CLIENT_CONF environment variable or ~/.drip.conf.   Data
in the configuration file must be encoded in YAML format.   See
L<API::Drip::Request/"CONFIGURATION"> for the specific data that may be stored.
 
Each configuration item may also be overriden by setting an environment
variable with the same name.
 
=back
 
=head2 Operations
 
=over

bin/drip_client.pl  view on Meta::CPAN

92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
Integer ID of a workflow.
 
 
=back
 
=head1 DESCRIPTION
 
B<drip_client.pl> is a command-line interface to the API::Drip library.   It's
a handy way to verify your connection to Drip is working as expected, and
possibly to do some light-weight manipulation of your data.
 
=cut
 
use v5.14;
use strict;
use lib '/usr/pair/perl/lib';
use Pair::Result ':all';
 

lib/API/Drip/Request.pm  view on Meta::CPAN

113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
=item HTTP Method (required)
 
May be 'GET', 'POST', 'DELETE', 'PATCH', etc..
 
=item Endpoint (requird)
 
Specifies the path of the REST enpoint you want to query.   Include everything after the account ID.   For example, "subscribers", "subscribers/$subscriber_id/campaign_subscriptions", etc...
 
=item Content (optional)
 
Perl hashref of data that will be sent along with the request.  
 
=back
 
On success, returns a Perl data structure corresponding to the data returned
from the server.    Some operations (DELETE), do not return any data and may
return undef on success.  On error, this method will die() with the
HTTP::Response object.
 
=cut
 
my $request_validator = validation_for( params => [ {type => Str()}, {type => Str()}, {type => HashRef(), optional => 1} ] );
sub do_request {
    my $self = shift;
    my ($method, $endpoint, $content) = $request_validator->(@_);

lib/API/Drip/Request.pm  view on Meta::CPAN

163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
    if ( $@ ) {
        $self->{debugger}->('Failed to decode JSON:', $@, $result->content);
        die $result;
    }
    return $decoded;
}
 
 
=head1 CONFIGURATION
 
Configuration data may be passed in through a number of different ways, which are searched in the following order of preference:
 
=over
 
=item 1. As direct paramteters to new().
 
=item 2. As environment variables.
 
=item 3. As elments of the first YAML configuration file that is found and readable in the following locations:
 
=over

lib/API/Drip/Request.pm  view on Meta::CPAN

185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
=item 1. The location specified by the DRIP_CLIENT_CONF parameter supplied to new().
 
=item 2. The location specified by $ENV{DRIP_CLIENT_CONF}.
 
=item 3. $ENV{HOME}/.drip.conf
 
=back
 
=back
 
The following configuration data is accepted:
 
=over
 
=item * DRIP_TOKEN (required)
 
This is the user token assigned to you by drip.   When you are logged in, look for "API Token" at https://www.getdrip.com/user/edit
 
=item * DRIP_ID (required)
 
This is the numeric user id assigned to you by drip.   When logged in, find it in your settings under Account->General Info.



( run in 1.117 second using v1.01-cache-2.11-cpan-49f99fa48dc )