Result:
found more than 419 distributions - search limited to the first 2001 files matching your query ( run in 0.529 )


AI-Chat

 view release on metacpan or  search on metacpan

lib/AI/Chat.pm  view on Meta::CPAN

26
27
28
29
30
31
32
33
34
35
36
    $attr{'model'}      = 'gpt-4o-mini' unless $attr{'model'};
 
    return bless \%attr, $class;
}
 
# Define endpoints for APIs
my %url    = (
);
 
# Define HTTP Headers for APIs

 view all matches for this distribution


AI-CleverbotIO

 view release on metacpan or  search on metacpan

lib/AI/CleverbotIO.pm  view on Meta::CPAN

7
8
9
10
11
12
13
14
15
16
17
use Ouch;
use Log::Any ();
use JSON::PP qw< decode_json >;
 
has endpoints => (
   is      => 'ro',
   default => sub {
      return {
         ask    => 'https://cleverbot.io/1.0/ask',
         create => 'https://cleverbot.io/1.0/create',

lib/AI/CleverbotIO.pm  view on Meta::CPAN

64
65
66
67
68
69
70
71
72
73
74
      text => $question,
      user => $self->user,
   );
   $ps{nick} = $self->nick if $self->has_nick;
   return $self->_parse_response(
      $self->ua->post_form($self->endpoints->{ask}, \%ps));
}
 
sub create {
   my $self = shift;
   $self->nick(shift) if @_;

lib/AI/CleverbotIO.pm  view on Meta::CPAN

80
81
82
83
84
85
86
87
88
89
90
   );
   $ps{nick} = $self->nick if $self->has_nick && length $self->nick;
 
   my $data =
     $self->_parse_response(
      $self->ua->post_form($self->endpoints->{create}, \%ps));
 
   $self->nick($data->{nick}) if exists($data->{nick});
 
   return $data;
}

 view all matches for this distribution


AI-Embedding

 view release on metacpan or  search on metacpan

lib/AI/Embedding.pm  view on Meta::CPAN

26
27
28
29
30
31
32
33
34
35
36
    $attr{'model'}      = 'text-embedding-ada-002' unless $attr{'model'};
 
    return bless \%attr, $class;
}
 
# Define endpoints for APIs
my %url    = (
);
 
# Define HTTP Headers for APIs

 view all matches for this distribution


AI-Fuzzy

 view release on metacpan or  search on metacpan

lib/AI/Fuzzy/Label.pm  view on Meta::CPAN

125
126
127
128
129
130
131
132
133
134
      
    return $membership;
}
 
sub range {
    # returns the distance from one endpoint to the other
     
    my ($self) = @_;
    return abs( $self->{high} - $self->{low} );
}

 view all matches for this distribution


AI-Image

 view release on metacpan or  search on metacpan

lib/AI/Image.pm  view on Meta::CPAN

30
31
32
33
34
35
36
37
38
39
40
    $attr{'size'}       = '512x512'  unless $attr{'size'};
 
    return bless \%attr, $class;
}
 
# Define endpoints for APIs
my %url    = (
);
 
# Define HTTP Headers for APIs

 view all matches for this distribution


AI-Ollama-Client

 view release on metacpan or  search on metacpan

lib/AI/Ollama/Client/Impl.pm  view on Meta::CPAN

314
315
316
317
318
319
320
321
322
323
324
      Future::Mojo->done( defined $res );
  } until => sub($done) { $done->get };
 
Generate the next message in a chat with a provided model.
 
This is a streaming endpoint, so there will be a series of responses. The final response object will include statistics and additional data from the request.
 
 
=head3 Options
 
=over 4

 view all matches for this distribution


AMF-Connection

 view release on metacpan or  search on metacpan

examples/amfclient.pl  view on Meta::CPAN

42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
      } (
          'flex.messaging.io.ArrayCollection'
        );
  }
 
my $service = 'Twitter';
my $method = 'search';
 
my $client = new AMF::Connection( $endpoint );
 
$client->setEncoding(3);
#$client->setHTTPProxy('http://127.0.0.1:8888');
#$client->addHeader( 'serviceBrowser', 'true' );
$client->setHTTPCookieJar( HTTP::Cookies->new(file => "/tmp/lwpcookies.txt", autosave => 1, ignore_discard => 1 ) );

examples/amfclient.pl  view on Meta::CPAN

67
68
69
70
71
72
73
my $json_data = $json->encode( $response->getData );
 
if ( $response->is_success ) {
        print $json_data;
} else {
        die "Can not send remote request for $service.$method method with params on $endpoint using AMF".$client->getEncoding()." encoding:\n".$json_data."\n";
        };

 view all matches for this distribution


API-CLI

 view release on metacpan or  search on metacpan

lib/API/CLI.pm  view on Meta::CPAN

122
123
124
125
126
127
128
129
130
131
    # 1. parameter: owner
    # 2. parameter: repo
    % githubcl GET /repos/:owner/:repo perlpunk API-CLI-p5
 
The generated help will show all methods, endpoints, parameters and
options.
 
Query parameters are represented as command line options starting with
C<--q->:

 view all matches for this distribution


API-Client

 view release on metacpan or  search on metacpan

lib/API/Client.pm  view on Meta::CPAN

397
398
399
400
401
402
403
404
405
406
407
  );
 
  [$get, $head, $patch]
 
Building up an HTTP request is extremely easy, simply call the L</resource> to
create a new object instance representing the API endpoint you wish to issue a
request against.
 
=cut
 
=head2 chaining

lib/API/Client.pm  view on Meta::CPAN

889
890
891
892
893
894
895
896
897
898
=head2 resource
 
  resource(Str @segments) : Object
 
The resource method returns a new instance of the object for the API resource
endpoint specified.
 
=over 4
 
=item resource example #1

 view all matches for this distribution


API-DeutscheBahn-Fahrplan

 view release on metacpan or  search on metacpan

lib/API/DeutscheBahn/Fahrplan.pm  view on Meta::CPAN

40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
=over
 
=item fahrplan_free_url
 
URL endpoint for DB Fahrplan free version. Defaults to I<https://api.deutschebahn.com/freeplan/v1>.
 
=item fahrplan_plus_url
 
URL endpoint for DB Fahrplan subscribed version. Defaults to I<https://api.deutschebahn.com/fahrplan-plus/v1>.
 
=item access_token
 
Access token to sign requests. If provided the client will use the C<fahrplan_plus_url> endpoint.
 
=back
 
=cut

 view all matches for this distribution


API-Drip-Request

 view release on metacpan or  search on metacpan

bin/drip_client.pl  view on Meta::CPAN

171
172
173
174
175
176
177
178
179
180
181
182
183
    my %OPT = @_;
    $OPT{workflow} or pod2usage( "Required parameter -workflow missing for -startwork" );
 
    my $subscriber = _build_hash( %OPT, keys => [qw( email id user_id time_zone prospect )] );
 
    my $endpoint = 'workflows/' . $OPT{workflow} . '/subscribers';
 
    my $result = $client->do_request( POST => $endpoint, { subscribers => [ $subscriber ] } );
    p $result;
}
 
 
sub delete_subscribers {

 view all matches for this distribution


API-Eulerian

 view release on metacpan or  search on metacpan

lib/API/Eulerian/EDW/Request.pm  view on Meta::CPAN

169
170
171
172
173
174
175
176
177
178
sub _request
{
  my ( $class, $method, $url, $headers, $what, $type, $file ) = @_;
  my $status = API::Eulerian::EDW::Status->new();
  my $endpoint;
  my $request;
 
  # Ensure default type
  $type = $type || 'application/json';

lib/API/Eulerian/EDW/Request.pm  view on Meta::CPAN

193
194
195
196
197
198
199
200
201
202
203
# Create HTTP Request
$request = HTTP::Request->new( $method, $url, $headers, $what );
 
# Create End Point used to communicate with remote server
$endpoint = LWP::UserAgent->new(
  keep_alive => 0,
  cookie_jar => {},
  ssl_opts   => {
    SSL_verifycn_publicsuffix => '',
    SSL_verify_mode           => IO::Socket::SSL::SSL_VERIFY_NONE,

lib/API/Eulerian/EDW/Request.pm  view on Meta::CPAN

205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
    SSL_hostname              => '',
  },
);
 
# Increase Read Timeout on TCP socket to avoid being disconnected
$endpoint->timeout( 1800 );
 
# Send Request, wait response if file is defined reply content is
# writen into local file.
my $response = $endpoint->request( $request, $file );
my $json = API::Eulerian::EDW::Request->json( $response );
 
$status->{ response } = $response;
 
if( $response->code != HTTP_OK ) {

 view all matches for this distribution


API-INSEE-Sirene

 view release on metacpan or  search on metacpan

lib/API/INSEE/Sirene.pm  view on Meta::CPAN

99
100
101
102
103
104
105
106
107
108
109
    credentials      => $credentials,
    user_agent       => undef,
    token_expiration => undef,
    max_results      => undef,
    debug_mode       => 0,
    current_endpoint => undef,
}, $class;
 
$self->_initUserAgent();
$self->setProxy($proxy);
$self->setMaxResults($max_results);

lib/API/INSEE/Sirene.pm  view on Meta::CPAN

143
144
145
146
147
148
149
150
151
152
153
154
    $timeout //= DEFAULT_TIMEOUT;
    $self->{'user_agent'}->timeout($timeout);
}
 
sub setCurrentEndpoint {
    my ($self, $endpoint) = @_;
 
    $self->{'current_endpoint'} = $endpoint;
}
 
sub _dumpRequest {
    my ($self, $request, $response) = @_;

lib/API/INSEE/Sirene.pm  view on Meta::CPAN

211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
    foreach my $key (keys %{ $parameters }) {
        push @url_parameters, join '=', $key, $parameters->{$key};
    }
 
    my $endpoint = join '?', $self->{'current_endpoint'}, join '&', @url_parameters;
    $request = GET join '/', API_BASE_URL, $endpoint;
}
else {
    $request = POST join('/', API_BASE_URL, $self->{'current_endpoint'}),
        Content => [ %{ $parameters } ];
}
 
if ($self->{'debug_mode'}) { # Requests will not be sent in debug mode
    return 0, $self->_dumpRequest($request);

lib/API/INSEE/Sirene.pm  view on Meta::CPAN

298
299
300
301
302
303
304
305
306
307
308
}
 
sub getCustomCriteria {
    my ($self, $field_name, $value, $search_mode) = @_;
 
    croak 'No endpoint specified.' if !defined $self->{'current_endpoint'};
 
    $search_mode //= 'aproximate';
    if (exists $useful_fields_aliases->{$field_name}) {
        if (ref $useful_fields_aliases->{$field_name} eq 'ARRAY') {
            croak "Can't use the alias $field_name in custom criteria";

lib/API/INSEE/Sirene.pm  view on Meta::CPAN

315
316
317
318
319
320
321
322
323
324
my @words = split /[ \/-]/, $value;
 
foreach my $word (@words) {
    $word =~ s/&/%26/ig;
    $word = sprintf '(%s:"%s"~ OR %s:*%s*)', $field_name, $word, $field_name, $word;
    $word = "periode$word" if any { $_ eq $field_name } @{ $historized_fields->{$self->{'current_endpoint'}} };
 
 
    push @criteria, $word;
}

lib/API/INSEE/Sirene.pm  view on Meta::CPAN

334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
    }
    elsif ($search_mode eq 'begin') {
        $criteria = sprintf '%s:%s*', $field_name, $value;
    }
 
    $criteria = "periode($criteria)" if any { $_ eq $field_name } @{ $historized_fields->{$self->{'current_endpoint'}} };
 
    return $criteria;
}
 
sub searchByCustomCriteria {
    my ($self, $criteria, $desired_fields) = @_;
 
    my $parameters;
    switch ($self->{'current_endpoint'}) {
        case 'siren' { $parameters = $self->_buildParameters($useful_fields_legal_unit, $desired_fields, $criteria) }
        case 'siret' { $parameters = $self->_buildParameters($useful_fields_establishment, $desired_fields, $criteria) }
        else { croak 'Bad endpoint specified.' }
    }
 
    return $self->_sendRequest($parameters);
}

lib/API/INSEE/Sirene.pm  view on Meta::CPAN

594
595
596
597
598
599
600
601
602
603
You can choose between three search modes: 'exact', 'begin' or 'approximate' match. Default is 'approximate'.
 
  my $criteria2 = $sirene->getCustomCriteria('libelleVoieEtablissement', 'avenue', undef, 'exact');
 
B<< Important: >> You must specify the endpoint to be reached B<< before >> calling the C<< getCustomCriteria >> method using C<< setCurrentEndpoint >>
 
  $sirene->setCurrentEndpoint('siret');
 
=head2 getEstablishmentsByName

lib/API/INSEE/Sirene.pm  view on Meta::CPAN

630
631
632
633
634
635
636
637
638
639
640
=head2 searchByCustomCriteria
 
This method is used to perform a search with a custom criteria built using the C<< getCustomCriteria >> method.
 
Before using this method, you have to specify the targeted endpoint by calling the C<< setCurrentEndpoint >> method.
 
  my $final_criteria = "$criteria1 OR $criteria2";
  my ($err, $result) = $sirene->$sirene->searchByCustomCriteria($final_criteria);
 
=head2 searchEstablishmentBySIRET

lib/API/INSEE/Sirene.pm  view on Meta::CPAN

651
652
653
654
655
656
657
658
659
660
  $sirene->setCredentials('Y29uc3VtZXIta2V5OmNvbnN1bWVyLXNlY3JldA==');
 
=head2 setCurrentEndpoint
 
Used to specifie the reached API endpoint.
 
=head2 setDebugMode
 
Enables the debug mode. When enabled, all the requests built by the module are displayed instead of being sent.

 view all matches for this distribution


API-Instagram

 view release on metacpan or  search on metacpan

lib/API/Instagram.pm  view on Meta::CPAN

33
34
35
36
37
38
39
40
41
42
has access_token      => ( is => 'rw', isa => sub { confess "No access token provided" unless $_[0] } );
has no_cache          => ( is => 'rw', default => sub { 0 } );
 
has _ua               => ( is => 'ro', default => sub { Furl->new() } );
has _obj_cache        => ( is => 'ro', default => sub { { User => {}, Media => {}, Location => {}, Tag => {}, 'Media::Comment' => {} } } );
has _endpoint_url     => ( is => 'ro', default => sub { 'https://api.instagram.com/v1'                 } );
has _authorize_url    => ( is => 'ro', default => sub { 'https://api.instagram.com/oauth/authorize'    } );
has _access_token_url => ( is => 'ro', default => sub { 'https://api.instagram.com/oauth/access_token' } );
 
has _debug => ( is => 'rw', lazy => 1 );

lib/API/Instagram.pm  view on Meta::CPAN

185
186
187
188
189
190
191
192
193
194
        $url =~ s|^/||;
        $params->{access_token} = $self->access_token;
 
        # Prepares the URL
        my $uri = URI->new( $self->_endpoint_url );
        $uri->path_segments( $uri->path_segments, split '/', $url );
        $uri->query_form($params);
        $url = $uri->as_string;
}

 view all matches for this distribution


API-Medium

 view release on metacpan or  search on metacpan

lib/API/Medium.pm  view on Meta::CPAN

72
73
74
75
76
77
78
79
80
81
82
83
84
        $post );
    return $res->{data}{url};
}
 
sub _request {
    my ( $self, $method, $endpoint, $data ) = @_;
 
    my $url = join( '/', $self->server, $endpoint );
 
    my $res;
    if ($data) {
        $res = $self->_client->request( $method, $url,
            { content => encode_json($data) } );

 view all matches for this distribution


API-Octopart

 view release on metacpan or  search on metacpan

lib/API/Octopart.pm  view on Meta::CPAN

368
369
370
371
372
373
374
375
376
377
378
my $response;
 
my $tries = 0;
while ($tries < 3)
{
        $req = HTTP::Request->new('POST' => 'https://octopart.com/api/v4/endpoint',
                 HTTP::Headers->new(
                        'Host' => 'octopart.com',
                        'Content-Type' => 'application/json',
                        'Accept' => 'application/json',
                        'Accept-Encoding' => 'gzip, deflate',

 view all matches for this distribution


API-Wunderlist

 view release on metacpan or  search on metacpan

lib/API/Wunderlist.pm  view on Meta::CPAN

292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
    $wunderlist->avatars;
 
The avatars method returns a new instance representative of the API
I<Avatar> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://developer.wunderlist.com/documentation/endpoints/avatar>.
 
=head2 file_previews
 
    $wunderlist->previews;
 
The file_previews method returns a new instance representative of the API
I<Preview> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
 
=head2 files
 
    $wunderlist->files;
 
The files method returns a new instance representative of the API
I<File> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://developer.wunderlist.com/documentation/endpoints/file>.
 
=head2 folders
 
    $wunderlist->folders;
 
The folders method returns a new instance representative of the API
I<Folder> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://developer.wunderlist.com/documentation/endpoints/folder>.
 
=head2 lists
 
    $wunderlist->lists;
 
The lists method returns a new instance representative of the API
I<List> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://developer.wunderlist.com/documentation/endpoints/list>.
 
=head2 memberships
 
    $wunderlist->memberships;
 
The memberships method returns a new instance representative of the API
I<Membership> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
 
=head2 notes
 
    $wunderlist->notes;
 
The notes method returns a new instance representative of the API
I<Note> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://developer.wunderlist.com/documentation/endpoints/note>.
 
=head2 positions
 
    $wunderlist->list_positions;
 
The positions method returns a new instance representative of the API
I<Positions> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
 
=head2 reminders
 
    $wunderlist->reminders;
 
The reminders method returns a new instance representative of the API
I<Reminder> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
 
=head2 subtasks
 
    $wunderlist->subtasks;
 
The subtasks method returns a new instance representative of the API
I<Subtask> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
 
=head2 task_comments
 
    $wunderlist->task_comments;
 
The task_comments method returns a new instance representative of the API
I<Task Comment> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
 
=head2 tasks
 
    $wunderlist->tasks;
 
The tasks method returns a new instance representative of the API
I<Task> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://developer.wunderlist.com/documentation/endpoints/task>.
 
=head2 uploads
 
    $wunderlist->uploads;
 
The uploads method returns a new instance representative of the API
I<Upload> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://developer.wunderlist.com/documentation/endpoints/upload>.
 
=head2 users
 
    $wunderlist->users;
 
The users method returns a new instance representative of the API
I<User> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://developer.wunderlist.com/documentation/endpoints/user>.
 
=head2 webhooks
 
    $wunderlist->webhooks;
 
The webhooks method returns a new instance representative of the API
I<Webhooks> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
 
=head1 AUTHOR
 
Al Newkirk <anewkirk@ana.io>

 view all matches for this distribution


APISchema

 view release on metacpan or  search on metacpan

t/APISchema-Generator-Markdown.t  view on Meta::CPAN

76
77
78
79
80
81
82
83
84
85
86
    my $markdown = $generator->format_schema($schema);
 
    like $markdown, qr/^"other"$/m;
};
 
subtest 'FETCH endpoint' => sub {
    my $schema = APISchema::DSL::process {
        FETCH '/' => {
            title => 'Fetch',
            destination => {},
        };

 view all matches for this distribution


APP-REST-RestTestSuite

 view release on metacpan or  search on metacpan

lib/APP/REST/RestTestSuite.pm  view on Meta::CPAN

259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
    if ( $self->{html_log_required}
        && ( $self->{html_log_required} =~ /yes/i ) )
    {
        print $fh
          qq|<HTML> <HEAD> <TITLE>LOG for $self->{endpoint}</TITLE> </HEAD>|
          . qq|<BODY><textarea rows="999999" cols="120" style="border:none;">|;
        print $err_fh
qq|<HTML> <HEAD> <TITLE>ERROR LOG for $self->{endpoint}</TITLE> </HEAD>|
          . qq|<BODY><textarea rows="999999" cols="120" style="border:none;">|;
    }
 
    print STDERR "\nTest Suite executed on $self->{endpoint}\n";
    print $fh "\nTest Suite executed on $self->{endpoint}\n";
    print $err_fh "\nTest Suite executed on $self->{endpoint}\n";
 
    foreach my $count ( sort { $a <=> $b } keys(%test_cases) ) {
 
        my $tc = $test_cases{$count};

lib/APP/REST/RestTestSuite.pm  view on Meta::CPAN

465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
if ( $self->{html_log_required}
    && ( $self->{html_log_required} =~ /yes/i ) )
{
    print $fh
      qq|<HTML> <HEAD> <TITLE>LOG for $self->{endpoint}</TITLE> </HEAD>|
      . qq|<BODY><textarea rows="999999" cols="120" style="border:none;">|;
}
 
print STDERR "\nTest Suite executed on $self->{endpoint}\n";
print $fh "\nTest Suite executed on $self->{endpoint}\n";
 
my @reqs;
 
foreach my $count ( sort { $a <=> $b } keys(%test_cases) ) {

lib/APP/REST/RestTestSuite.pm  view on Meta::CPAN

809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
        print STDERR "username configured: $self->{username}\n";
        print STDERR "Password: ";
        chomp( $self->{password} = <STDIN> );
    }
 
    if ( $self->{endpoint} && $self->{port} && $self->{base_uri} ) {
        $self->{rest_uri_base} =
            qq|http://$self->{endpoint}|
          . qq|:$self->{port}|
          . qq|$self->{base_uri}|;
        return;    #use the port and uri in config file and return from sub
    } elsif ( $self->{endpoint} && $self->{base_uri} ) {
        $self->{rest_uri_base} =
          qq|http://$self->{endpoint}| . qq|$self->{base_uri}|;
        return;    #use the uri in config file and return from sub
    } elsif ( $self->{endpoint} && $self->{port} ) {
        $self->{rest_uri_base} =
          qq|http://$self->{endpoint}| . qq|:$self->{port}|;
        return;
    } elsif ( $self->{endpoint} ) {
        $self->{rest_uri_base} = qq|http://$self->{endpoint}|;
        return;    #use the endpoint in config file and return from sub
    } else {
        die qq|Endpoint should be configured in the config file\n|;
    }
 
}

lib/APP/REST/RestTestSuite.pm  view on Meta::CPAN

1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
#Set below values to configure the base URL for all test cases
 
####################
#START_COMMON_CONFIG
################################################################################
  endpoint                  : www.thomas-bayer.com
  port                      :
  base_uri                  : /sqlrest
  html_log_required         : no
  username                  :

 view all matches for this distribution


ASNMTAP

 view release on metacpan or  search on metacpan

applications/htmlroot/cgi-bin/moderator/generateCollectorCrontabSchedulingReport.pl  view on Meta::CPAN

180
181
182
183
184
185
186
187
188
189
190
191
push (@colorsTimeslot,     $COLORSRRD{'IN PROGRESS'});
 
# the data points for each test result matching the corresponding label
push (@dataPoints,         $uKeys{$uKey}->{numberOfLabel});
 
my $endpointCurrentTimeslot = $currentDate + ($stepValue[$uKeys{$uKey}->{numberOfLabel}] * 60);
my $restCurrentTimeslot = ($currentTimeslot eq 'off' and $endpointCurrentTimeslot > $sqlEndDate) ? $sqlEndDate : $endpointCurrentTimeslot;
 
# the timeslot start dates and end dates for the tasks
push (@crontabStartDate,   perlchartdir::chartTime2($currentDate));
push (@crontabEndDate,     perlchartdir::chartTime2($currentDate + $step));
push (@crontabEndTimeslot, perlchartdir::chartTime2($restCurrentTimeslot));

 view all matches for this distribution


AWS-CLIWrapper

 view release on metacpan or  search on metacpan

lib/AWS/CLIWrapper.pm  view on Meta::CPAN

26
27
28
29
30
31
32
33
34
35
my($class, %param) = @_;
 
my $region = $param{region};
 
my @opt = ();
for my $k (qw(region profile endpoint_url)) {
    if (my $v = delete $param{$k}) {
        push @opt, param2opt($k, $v);
    }
}

lib/AWS/CLIWrapper.pm  view on Meta::CPAN

787
788
789
790
791
792
793
794
795
796
797
Constructor of AWS::CLIWrapper. Acceptable AWS CLI params are:
 
    region       region_name:Str
    profile      profile_name:Str
    endpoint_url endpoint_url:Str
 
Additionally, the these params can be used to control the wrapper behavior:
 
    nofork                  Truthy to avoid forking when executing `aws`
    timeout                 `aws` execution timeout

 view all matches for this distribution


AWS-S3

 view release on metacpan or  search on metacpan

lib/AWS/S3.pm  view on Meta::CPAN

36
37
38
39
40
41
42
43
44
45
46
    isa     => 'Bool',
    lazy    => 1,
    default => 0
);
 
has 'endpoint' => (
    is      => 'ro',
    isa     => 'Str',
    lazy    => 1,
    default => sub {
        my ( $s ) = @_;

lib/AWS/S3.pm  view on Meta::CPAN

262
263
264
265
266
267
268
269
270
271
Optional.  Boolean.
 
Default is C<0>
 
=head2 endpoint
 
Optional.  String.
 
Default is C<s3.amazonaws.com>

lib/AWS/S3.pm  view on Meta::CPAN

293
294
295
296
297
298
299
300
301
302
=head2 secure
 
Boolean.  Read-only.
 
=head2 endpoint
 
String.  Read-only.
 
=head2 ua

 view all matches for this distribution


AWS-SNS-Verify

 view release on metacpan or  search on metacpan

lib/AWS/SNS/Verify.pm  view on Meta::CPAN

108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
    unless ( $url->can('host') ) {
        ouch 'Bad SigningCertURL', "The SigningCertURL ($url_string) isn't a valid URL", $self;
    }
    my $host = $url->host;
 
    # Match all regional SNS endpoints, e.g.
    # sns.<region>.amazonaws.com        (AWS)
    # sns.us-gov-west-1.amazonaws.com   (AWS GovCloud)
    # sns.cn-north-1.amazonaws.com.cn   (AWS China)
    my $dot = qr/\./;
    my $region = qr/[a-zA-Z0-9-]+/;
    unless ($host =~ /^ sns $dot $region $dot amazonaws $dot com(\.cn)? $/x) {
        ouch 'Bad SigningCertURL', "The SigningCertURL ($url_string) isn't an Amazon endpoint", $self;
    }
 
    return $url_string;
}

lib/AWS/SNS/Verify.pm  view on Meta::CPAN

178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
    }
 }
 
=item certificate_string
 
By default AWS::SNS::Verify will fetch the certificate string by issuing an HTTP GET request to C<SigningCertURL>. The SigningCertURL in the message must be a AWS SNS endpoint.
 
If you wish to use a cached version, then pass it in.
 
=item validate_signing_cert_url (default: true)
 
If you're using a fake SNS server in your local test environment, the SigningCertURL won't be an AWS endpoint. If so, set validate_signing_cert_url to 0.
 
Don't ever do this in any kind of Production environment.
 
=back

 view all matches for this distribution


AWS-Signature4

 view release on metacpan or  search on metacpan

lib/AWS/Signature4.pm  view on Meta::CPAN

106
107
108
109
110
111
112
113
114
115
116
117
Given an HTTP::Request object, add the headers required by AWS and
then sign it with a version 4 signature by adding an "Authorization"
header.
 
The request must include a URL from which the AWS endpoint and service
can be derived, such as "ec2.us-east-1.amazonaws.com." In some cases
(e.g. S3 bucket operations) the endpoint does not indicate the
region. In this case, the region can be forced by passing a defined
value for $region. The current date and time will be added to the
request using an "X-Amz-Date header." To force the date and time to a
fixed value, include the "Date" header in the request.

lib/AWS/Signature4.pm  view on Meta::CPAN

143
144
145
146
147
148
149
150
151
152
153
}
 
=item my $url $signer->signed_url($request_or_uri [,$expires])
 
Pass an HTTP::Request, a URI object, or just a plain URL string
containing the proper endpoint and parameters needed for an AWS REST
API Call. This method will return an appropriately signed request as a
URI object, which can be shared with non-AWS users for the purpose of,
e.g., accessing an object in a private S3 bucket.
 
Pass an optional $expires argument to indicate that the URL will only

 view all matches for this distribution


AXL-Client-Simple

 view release on metacpan or  search on metacpan

share/AXLSoap.xsd  view on Meta::CPAN

3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
        </xsd:sequence>
        <xsd:attribute name="uuid" type="axlapi:XUUID"/>
</xsd:complexType>
<xsd:complexType name="XMGCPEndpoints">
        <xsd:annotation>
                <xsd:documentation>The max attribute identifies the maximum number of endpoints this endpoint list is allowed.       </xsd:documentation>
        </xsd:annotation>
        <xsd:choice>
                <xsd:element name="endpoint" maxOccurs="unbounded">
                        <xsd:complexType>
                                <xsd:complexContent>
                                        <xsd:extension base="axlapi:XGateway">
                                                <xsd:attribute name="index" type="xsd:nonNegativeInteger" use="required"/>
                                        </xsd:extension>
                                </xsd:complexContent>
                        </xsd:complexType>
                </xsd:element>
                <xsd:element name="deviceName" type="axlapi:String50" maxOccurs="unbounded">
                        <xsd:annotation>
                                <xsd:documentation>When adding endpoint, only endpoint is allowed</xsd:documentation>
                        </xsd:annotation>
                </xsd:element>
        </xsd:choice>
        <xsd:attribute name="max" type="xsd:positiveInteger"/>
</xsd:complexType>

share/AXLSoap.xsd  view on Meta::CPAN

3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
                <xsd:documentation>In the IOS model, SUBUNIT corresponds to a VIC, and a VIC contains 1 or more PORTs.</xsd:documentation>
        </xsd:annotation>
        <xsd:sequence>
                <xsd:element name="product" type="xsd:string"/><!--This field is of the type axl:XMGCPVic in AXLEnums.xsd-->
                <xsd:element name="beginPort" type="xsd:nonNegativeInteger" minOccurs="0"/>
                <xsd:element name="endpoints" type="axlapi:XMGCPEndpoints" minOccurs="0"/>
        </xsd:sequence>
        <xsd:attribute name="index" type="xsd:nonNegativeInteger"/>
</xsd:complexType>
<xsd:complexType name="XMGCPUnits">
        <xsd:annotation>

share/AXLSoap.xsd  view on Meta::CPAN

5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
        </xsd:annotation>
        <xsd:complexContent>
                <xsd:extension base="axlapi:XAnalogPort">
                        <xsd:sequence minOccurs="0">
                                <xsd:element name="callerId" type="xsd:string"/><!--This field is of the type axl:XCallerID in AXLEnums.xsd-->
                                <xsd:element name="endpointId" type="axlapi:String128" minOccurs="0"/>
                        </xsd:sequence>
                </xsd:extension>
        </xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="XTrunkInfo">

share/AXLSoap.xsd  view on Meta::CPAN

5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
<xsd:annotation>
        <xsd:documentation>In the IOS model, SUBUNIT corresponds to a VIC, and a VIC contains 1 or more PORTs.</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
        <xsd:element name="product" type="xsd:string"/><!--This field is of the type axl:XMGCPVic in AXLEnums.xsd-->
        <xsd:element name="endpoints" minOccurs="0">
                <xsd:complexType>
                        <xsd:annotation>
                                <xsd:documentation>The max attribute identifies the maximum number of endpoints this endpoint list is allowed.</xsd:documentation>
                        </xsd:annotation>
                        <xsd:sequence>
                                <xsd:element name="endpoint" maxOccurs="unbounded">
                                        <xsd:complexType>
                                                <xsd:annotation>
                                                        <xsd:documentation>In the IOS model, ENDPOINT corresponds to a PORT inside a VIC.</xsd:documentation>
                                                </xsd:annotation>
                                                <xsd:complexContent>

share/AXLSoap.xsd  view on Meta::CPAN

5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
<xsd:sequence>
        <xsd:element name="unattendedPort" type="xsd:boolean" default="false" nillable="false" minOccurs="0"/>
        <xsd:element name="trunkDirection" type="xsd:string"/><!--This field is of the type axl:XTrunkDirection in AXLEnums.xsd-->
        <xsd:sequence minOccurs="0">
                <xsd:annotation>
                        <xsd:documentation>For Gorund Start/Loop Start type of endpoint.</xsd:documentation>
                </xsd:annotation>
                <xsd:element name="attendantDN" type="axlapi:XDirectoryNumber"/>
        </xsd:sequence>
        <xsd:sequence minOccurs="0">
                <xsd:annotation>
                        <xsd:documentation>For POTS type of endpoint.</xsd:documentation>
                </xsd:annotation>
                <xsd:element name="prefixDN" type="axlapi:XDirectoryNumber" minOccurs="0"/>
                <xsd:element name="numDigits" type="xsd:nonNegativeInteger" nillable="false"/>
                <xsd:element name="expectedDigits" type="xsd:nonNegativeInteger"/>
                <xsd:element name="smdiPortNumber" type="xsd:nonNegativeInteger">

share/AXLSoap.xsd  view on Meta::CPAN

7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
<xsd:enumeration value="Protected device does not support shared line and all lines on a protected device must have max calls (and busy trigger) set to 1."/>
<xsd:enumeration value="Device does not support SmartClient feature. "/>
<xsd:enumeration value="Remote Cisco Unified Communications Manager is already defined for other ICT Trunk."/>
<xsd:enumeration value="Cannot add more than one IP Media Streaming software devices per type (CFB,MOH,ANN,SVR) per server."/>
<xsd:enumeration value="Cannot use QSIG Variant or ASN1 Rose OID Encoding because QSIG is not enabled for this device. Enable QSIG protocol or tunneling and try again."/>
<xsd:enumeration value="Attempted to insert an invalid product into the device table. Make sure the product is an endpoint device and try again."/>
<xsd:enumeration value="The specified name has invalid characters or is not formatted correctly for this device type."/>
<xsd:enumeration value="The autogenerated profile name has invalid characters or is not formatted correctly for this device type."/>
<xsd:enumeration value="The specified name has invalid characters or is not formatted correctly for this type of device, profile or template."/>
<xsd:enumeration value="Gatekeeper table may only reference devices that are Gatekeepers (model = 122)"/>
<xsd:enumeration value="Failure attempting to insert into Region table"/>

share/AXLSoap.xsd  view on Meta::CPAN

17753
17754
17755
17756
17757
17758
17759
17760
17761
17762
17763
17764
17765
17766
17767
17768
17769
17770
17771
<xsd:annotation>
        <xsd:documentation>In the IOS model, SUBUNIT corresponds to a VIC, and a VIC contains 1 or more PORTs.</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
        <xsd:element name="product" type="xsd:string"/><!--This field is of the type axl:XMGCPVic in AXLEnums.xsd-->
        <xsd:element name="endpoints" minOccurs="0">
                <xsd:complexType>
                        <xsd:annotation>
                                <xsd:documentation>The max attribute identifies the maximum number of endpoints this endpoint list is allowed.</xsd:documentation>
                        </xsd:annotation>
                        <xsd:sequence minOccurs="0">
                                <xsd:element name="endpoint" minOccurs="0" maxOccurs="unbounded">
                                        <xsd:annotation>
                                                <xsd:documentation>If new endpoints are mentioned to be added to the gateway, the tags would be mandatory as in the addVG224Req.</xsd:documentation>
                                        </xsd:annotation>
                                        <xsd:complexType>
                                                <xsd:annotation>
                                                        <xsd:documentation>In the IOS model, ENDPOINT corresponds to a PORT inside a VIC.</xsd:documentation>
                                                </xsd:annotation>

share/AXLSoap.xsd  view on Meta::CPAN

17935
17936
17937
17938
17939
17940
17941
17942
17943
17944
17945
17946
17947
17948
17949
17950
17951
<xsd:sequence minOccurs="0">
        <xsd:element name="unattendedPort" type="xsd:boolean" default="false" nillable="false" minOccurs="0"/>
        <xsd:element name="trunkDirection" type="xsd:string"/><!--This field is of the type axl:XTrunkDirection in AXLEnums.xsd-->
        <xsd:sequence minOccurs="0">
                <xsd:annotation>
                        <xsd:documentation>For Gorund Start/Loop Start type of endpoint.</xsd:documentation>
                </xsd:annotation>
                <xsd:element name="attendantDN" type="axlapi:XDirectoryNumber"/>
        </xsd:sequence>
        <xsd:sequence minOccurs="0">
                <xsd:annotation>
                        <xsd:documentation>For POTS type of endpoint.</xsd:documentation>
                </xsd:annotation>
                <xsd:element name="prefixDN" type="axlapi:XDirectoryNumber" minOccurs="0"/>
                <xsd:element name="numDigits" type="xsd:nonNegativeInteger" nillable="false"/>
                <xsd:element name="expectedDigits" type="xsd:nonNegativeInteger"/>
                <xsd:element name="smdiPortNumber" type="xsd:nonNegativeInteger">

share/AXLSoap.xsd  view on Meta::CPAN

18408
18409
18410
18411
18412
18413
18414
18415
18416
18417
18418
<xsd:element name="getVoiceMailPortResponse" type="axlapi:GetVoiceMailPortRes"/>
<xsd:element name="removeVoiceMailPort" type="axlapi:NameAndGUIDRequest"/>
<xsd:element name="removeVoiceMailPortResponse" type="axlapi:StandardResponse"/>
<xsd:complexType name="AddGatewayEndpointReq" abstract="false" final="#all">
        <xsd:annotation>
                <xsd:documentation>Adds a new Gateway endpoint to the database.</xsd:documentation>
        </xsd:annotation>
        <xsd:complexContent>
                <xsd:extension base="axlapi:APIRequest">
                        <xsd:sequence>
                                <xsd:element name="gateway" type="axlapi:XGateway" nillable="false">

share/AXLSoap.xsd  view on Meta::CPAN

18426
18427
18428
18429
18430
18431
18432
18433
18434
18435
18436
</xsd:complexType>
<xsd:element name="addGatewayEndpoint" type="axlapi:AddGatewayEndpointReq"/>
<xsd:element name="addGatewayEndpointResponse" type="axlapi:StandardResponse"/>
<xsd:complexType name="UpdateGatewayEndpointReq" abstract="false" final="#all">
        <xsd:annotation>
                <xsd:documentation>Update an existing Gateway endpoint in the database.</xsd:documentation>
        </xsd:annotation>
        <xsd:complexContent>
                <xsd:extension base="axlapi:NameAndGUIDRequest">
                        <xsd:sequence>
                                <xsd:element name="newName" type="axlapi:String50" nillable="false" minOccurs="0">

share/AXLSoap.xsd  view on Meta::CPAN

19727
19728
19729
19730
19731
19732
19733
19734
19735
19736
19737
19738
19739
19740
19741
19742
19743
19744
19745
19746
19747
19748
19749
19750
19751
19752
19753
19754
19755
19756
19757
19758
19759
19760
19761
19762
<xsd:extension base="axlapi:APIRequest">
        <xsd:sequence>
                <xsd:choice>
                        <xsd:element name="uuid" type="axlapi:XUUID">
                                <xsd:annotation>
                                        <xsd:documentation>The pkid of the MGCP gateway for which the endpoint is being added</xsd:documentation>
                                </xsd:annotation>
                        </xsd:element>
                        <xsd:element name="domainName" type="axlapi:String64">
                                <xsd:annotation>
                                        <xsd:documentation>The domain name of MGCP Gateway for which the endpoint is being added</xsd:documentation>
                                </xsd:annotation>
                        </xsd:element>
                </xsd:choice>
                <xsd:element name="unit">
                        <xsd:annotation>
                                <xsd:documentation>The unit(slot) index for which the endpoint is being added</xsd:documentation>
                        </xsd:annotation>
                        <xsd:complexType>
                                <xsd:attribute name="index" type="xsd:nonNegativeInteger" use="required"/>
                        </xsd:complexType>
                </xsd:element>
                <xsd:element name="subunit">
                        <xsd:annotation>
                                <xsd:documentation>The subunit index for which the endpoint is being added</xsd:documentation>
                        </xsd:annotation>
                        <xsd:complexType>
                                <xsd:attribute name="index" type="xsd:nonNegativeInteger" use="required"/>
                        </xsd:complexType>
                </xsd:element>
                <xsd:element name="endpoint">
                        <xsd:complexType>
                                <xsd:complexContent>
                                        <xsd:extension base="axlapi:XMGCPEndpoint">
                                                <xsd:attribute name="index" type="xsd:nonNegativeInteger" use="required"/>
                                        </xsd:extension>

share/AXLSoap.xsd  view on Meta::CPAN

19907
19908
19909
19910
19911
19912
19913
19914
19915
19916
19917
19918
19919
19920
19921
19922
19923
19924
19925
19926
19927
19928
19929
19930
19931
19932
19933
19934
19935
19936
19937
19938
19939
19940
19941
19942
19943
19944
19945
19946
19947
19948
19949
19950
19951
19952
</xsd:complexType>
<xsd:element name="removeMGCPSubunit" type="axlapi:RemoveMGCPSubunitReq"/>
<xsd:element name="removeMGCPSubunitResponse" type="axlapi:StandardResponse"/>
<xsd:complexType name="RemoveMGCPEndpointReq">
        <xsd:annotation>
                <xsd:documentation>Removes the specified endpoint(port) of MGCP Gateway from the database.</xsd:documentation>
        </xsd:annotation>
        <xsd:complexContent>
                <xsd:extension base="axlapi:APIRequest">
                        <xsd:sequence>
                                <xsd:choice>
                                        <xsd:element name="uuid" type="axlapi:XUUID" nillable="false">
                                                <xsd:annotation>
                                                        <xsd:documentation>The GUID of the MGCP whose endpoint is to be removed.</xsd:documentation>
                                                </xsd:annotation>
                                        </xsd:element>
                                        <xsd:element name="domainName" type="xsd:string" nillable="false">
                                                <xsd:annotation>
                                                        <xsd:documentation>The domain name of the MGCP whose endpoint is to be removed.</xsd:documentation>
                                                </xsd:annotation>
                                        </xsd:element>
                                </xsd:choice>
                                <xsd:element name="unit" nillable="false">
                                        <xsd:annotation>
                                                <xsd:documentation>The unit(slot) number from which the endpoint is to be removed(specified as the attribute "index")</xsd:documentation>
                                        </xsd:annotation>
                                        <xsd:complexType>
                                                <xsd:attribute name="index" type="xsd:nonNegativeInteger" use="required"/>
                                        </xsd:complexType>
                                </xsd:element>
                                <xsd:element name="subunit" nillable="false">
                                        <xsd:annotation>
                                                <xsd:documentation>The subunit from which the endpoint(port) is to be removed (specified as the attribute "index")</xsd:documentation>
                                        </xsd:annotation>
                                        <xsd:complexType>
                                                <xsd:attribute name="index" type="xsd:nonNegativeInteger" use="required"/>
                                        </xsd:complexType>
                                </xsd:element>
                                <xsd:element name="endpoint" nillable="false">
                                        <xsd:annotation>
                                                <xsd:documentation>The endpoint(port) number to be removed (specified as the attribute "index")</xsd:documentation>
                                        </xsd:annotation>
                                        <xsd:complexType>
                                                <xsd:attribute name="index" type="xsd:nonNegativeInteger" use="required"/>
                                        </xsd:complexType>
                                </xsd:element>

share/AXLSoap.xsd  view on Meta::CPAN

19959
19960
19961
19962
19963
19964
19965
19966
19967
19968
19969
        <xsd:complexType name="UpdateMGCPReq">
                <xsd:annotation>
                        <xsd:documentation>Updates an existing MGCP Gateway information in the database.
To modify unit, use removeMGCPUnit-addMGCPUnit.
To modify subunit, use removeMGCPSubunit-addMGCPSubunit
To modify endpoint, use removeMGCPEndpoint-addMGCPEndpoint</xsd:documentation>
                </xsd:annotation>
                <xsd:complexContent>
                        <xsd:extension base="axlapi:APIRequest">
                                <xsd:sequence>
                                        <xsd:choice>

 view all matches for this distribution


AcePerl

 view release on metacpan or  search on metacpan

Ace/Sequence.pm  view on Meta::CPAN

915
916
917
918
919
920
921
922
923
924
925
In many cases, the source sequence will be identical to the sequence
initially passed to the new() method.  However, there are exceptions
to this rule.  One common exception occurs when the offset and/or
length cross the boundaries of the passed-in sequence.  In this case,
the ACeDB database is searched for the smallest sequence that contains
both endpoints of the I<Ace::Sequence> object.
 
The other common exception occurs in Ace 4.8, where there is support
for "sequence-like" objects that contain the C<SMap> ("Sequence Map")
tag.  The C<SMap> tag provides genomic location information for
arbitrary object -- not just those descended from the Sequence class.

Ace/Sequence.pm  view on Meta::CPAN

942
943
944
945
946
947
948
949
950
951
952
  $name = $seq->asString;
 
Returns a human-readable identifier for the sequence in the form
I<Source/start-end>, where "Source" is the name of the source
sequence, and "start" and "end" are the endpoints of the sequence
relative to the source (using 1-based indexing).  This method is
called automatically when the I<Ace::Sequence> is used in a string
context.
 
=head2 source_seq()

 view all matches for this distribution


Acme-AutoLoad

 view release on metacpan or  search on metacpan

lib/Acme/AutoLoad.pm  view on Meta::CPAN

257
258
259
260
261
262
263
264
265
266
267
=head1 DISCLAIMER
 
This module is not recommended for use in production environments.
This MAGIC LINE will eval code from the network, which is generally a BAD IDEA!
Relying on remote network is generally dangerous for security and functionality.
For example, if CPAN or any required network endpoint ever goes down or malfunctions
or gets hacked, then it could cause problems for you.
See also CAVEATS Section "2. Slow" below.
USE AT YOUR OWN RISK!
 
=head1 PREREQUISITES

 view all matches for this distribution


Acme-CPANModulesBundle-Import-MojoliciousAdvent-2017

 view release on metacpan or  search on metacpan

devdata/https_mojolicious.io_blog_2017_12_08_day-8-mocking-a-rest-api  view on Meta::CPAN

204
205
206
207
208
209
210
211
212
213
214
]
</code></pre>
 
<p>So now I can write a bunch of JSON in my script and it will be exposed
as an API. But I&#39;d like it to be easier to make lists of things: REST
APIs often have one endpoint as a list and another as an individual item
in that list. We can make a list by composing our individual parts using
Mojolicious templates and the <code>include</code> template helper:</p>
 
<pre><code class="hljs"><span class="hljs-comment"># test-api.pl</span><span class="hljs-comment">
</span><span class="hljs-keyword">use</span> <span class="hljs-function">Mojolicious::Lite</span>;

devdata/https_mojolicious.io_blog_2017_12_08_day-8-mocking-a-rest-api  view on Meta::CPAN

230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
{ &quot;ip&quot;: &quot;10.0.0.1&quot;, &quot;os&quot;: &quot;Debian 9&quot; }
@@ servers/2.json.ep
{ &quot;ip&quot;: &quot;10.0.0.2&quot;, &quot;os&quot;: &quot;Debian 8&quot; }
</code></pre>
 
<p>Now I can test the list endpoint again:</p>
 
<pre><code>$ perl test-api.pl get /servers
[
    { &quot;ip&quot;: &quot;10.0.0.1&quot;, &quot;os&quot;: &quot;Debian 9&quot; }
,
    { &quot;ip&quot;: &quot;10.0.0.2&quot;, &quot;os&quot;: &quot;Debian 8&quot; }
]
</code></pre>
 
<p>And also one of the individual item endpoints:</p>
 
<pre><code>$ perl test-api.pl get /servers/1
{ &quot;ip&quot;: &quot;10.0.0.1&quot;, &quot;os&quot;: &quot;Debian 9&quot; }
</code></pre>

 view all matches for this distribution


Acme-CPANModulesBundle-Import-MojoliciousAdvent-2018

 view release on metacpan or  search on metacpan

devdata/https_mojolicious.io_blog_2018_12_07_openapi_  view on Meta::CPAN

181
182
183
184
185
186
187
188
189
190
191
192
193
<h4>Defining an Endpoint</h4>
 
<p>Each of the paths available to the API are defined within the paths object.</p>
 
<pre><code>paths:
  # The path to the endpoint
  /search/web:
    # The HTTP method that the endpoint accepts
    get:
      # A unique identifier for the method
      operationId: search_web
      # This attribute points to the name of the class in the appliction
      # and the method to call separated by `#`

devdata/https_mojolicious.io_blog_2018_12_07_openapi_  view on Meta::CPAN

291
292
293
294
295
296
297
298
299
300
    - &quot;null&quot;
</code></pre>
 
<h3>The MetaCPAN Specification</h3>
 
<p>The entire specification doesn’t need to be complete in order to get OpenAPI up and running. When documenting an existing API, it’s possible to with one portion of the API. With MetaCPAN we started with the search endpoints.</p>
 
<p>The <a href="https://github.com/metacpan/metacpan-api/blob/master/root/static/v1.yml">spec file can be viewed here</a> and the <a href="https://fastapi.metacpan.org/static/index.html">API documentation here</a></p>
 
<h2>Further Reading</h2>

 view all matches for this distribution


Acme-CPANModulesBundle-Import-PerlDancerAdvent-2018

 view release on metacpan or  search on metacpan

devdata/http_advent.perldancer.org_2018_20  view on Meta::CPAN

130
131
132
133
134
135
136
137
138
139
<pre class="prettyprint">use Test::More;
my $t = Test::Mojo-&gt;with_roles('+PSGI')-&gt;new('app.psgi');</pre>
 
<p>With that out of the way, on to the tests!
In our first tests we'll focus on the plain text endpoint <code>/text</code>.</p>
<pre class="prettyprint">$t-&gt;get_ok('/text')
  -&gt;status_is(200)
  -&gt;content_type_like(qr[text/plain])
  -&gt;content_is('hello world');</pre>

devdata/http_advent.perldancer.org_2018_20  view on Meta::CPAN

150
151
152
153
154
155
156
157
158
159
<pre class="prettyprint">$t-&gt;get_ok('/text', form =&gt; { name =&gt; 'santa' })
  -&gt;status_is(200)
  -&gt;content_type_like(qr[text/plain])
  -&gt;content_is('hello santa');</pre>
 
<p>Moving on we request the data endpoint, both without and with a query, then similarly test the responses.</p>
<pre class="prettyprint">$t-&gt;get_ok('/data')
  -&gt;status_is(200)
  -&gt;content_type_like(qr[application/json])
  -&gt;json_is('/hello' =&gt; 'world');

devdata/http_advent.perldancer.org_2018_20  view on Meta::CPAN

164
165
166
167
168
169
170
171
172
173
174
  -&gt;json_is('/hello' =&gt; 'rudolph');</pre>
 
<p>You can see we use the <code>json_is</code> method to test the responses.
Now, the test could have been <code>-&gt;json_is({hello =&gt; 'rudolph'})</code> if had wanted to test the entire document.
By passing a <a href="https://mojolicious.org/perldoc/Mojo/JSON/Pointer">JSON Pointer</a> I can inspect only the portions I'm interested in.</p>
<p>Finally I'm going to test the HTML endpoint.
As I said above, the result resists easy parsing.
We want to test the <code>dd</code> tag contents that follows a <code>dt</code> tag with the id <code>hello</code>, all inside a <code>dl</code> tag with the id <code>data</code>.
That would be a monstrous regexp (hehe).
However it is a piece of cake using <a href="https://mojolicious.org/perldoc/Mojo/DOM/CSS">CSS Selectors</a>.</p>
<pre class="prettyprint">$t-&gt;get_ok('/html')

 view all matches for this distribution


( run in 0.529 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )