view release on metacpan or search on metacpan
lib/AI/Chat.pm view on Meta::CPAN
view all matches for this distribution
2627282930313233343536
$attr
{
'model'
} =
'gpt-4o-mini'
unless
$attr
{
'model'
};
return
bless
\
%attr
,
$class
;
}
# Define endpoints for APIs
my
%url
= (
);
# Define HTTP Headers for APIs
view release on metacpan or search on metacpan
lib/AI/CleverbotIO.pm view on Meta::CPAN
7891011121314151617
lib/AI/CleverbotIO.pm view on Meta::CPAN
6465666768697071727374
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
view all matches for this distribution
8081828384858687888990
);
$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 release on metacpan or search on metacpan
lib/AI/Embedding.pm view on Meta::CPAN
view all matches for this distribution
2627282930313233343536
$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 release on metacpan or search on metacpan
lib/AI/Fuzzy/Label.pm view on Meta::CPAN
view all matches for this distribution
125126127128129130131132133134
return
$membership
;
}
sub
range {
# returns the distance from one endpoint to the other
my
(
$self
) =
@_
;
return
abs
(
$self
->{high} -
$self
->{low} );
}
view release on metacpan or search on metacpan
lib/AI/Image.pm view on Meta::CPAN
view all matches for this distribution
3031323334353637383940
$attr
{
'size'
} =
'512x512'
unless
$attr
{
'size'
};
return
bless
\
%attr
,
$class
;
}
# Define endpoints for APIs
my
%url
= (
);
# Define HTTP Headers for APIs
view release on metacpan or search on metacpan
lib/AI/Ollama/Client/Impl.pm view on Meta::CPAN
view all matches for this distribution
314315316317318319320321322323324
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 release on metacpan or search on metacpan
examples/amfclient.pl view on Meta::CPAN
424344454647484950515253545556
} (
'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
view all matches for this distribution
67686970717273my
$json_data
=
$json
->encode(
$response
->getData );
if
(
$response
->is_success ) {
$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 release on metacpan or search on metacpan
lib/API/CLI.pm view on Meta::CPAN
view all matches for this distribution
122123124125126127128129130131
# 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 release on metacpan or search on metacpan
lib/API/Client.pm view on Meta::CPAN
397398399400401402403404405406407
);
[
$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
view all matches for this distribution
889890891892893894895896897898=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 release on metacpan or search on metacpan
lib/API/DeutscheBahn/Fahrplan.pm view on Meta::CPAN
view all matches for this distribution
404142434445464748495051525354555657=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 release on metacpan or search on metacpan
bin/drip_client.pl view on Meta::CPAN
view all matches for this distribution
171172173174175176177178179180181182183
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 release on metacpan or search on metacpan
lib/API/Eulerian/EDW/Request.pm view on Meta::CPAN
169170171172173174175176177178use
Data::Dumper;
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
193194195196197198199200201202203# 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
view all matches for this distribution
205206207208209210211212213214215216217218219
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 release on metacpan or search on metacpan
lib/API/INSEE/Sirene.pm view on Meta::CPAN
99100101102103104105106107108109
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
143144145146147148149150151152153154
$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
211212213214215216217218219220221222223224225
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
298299300301302303304305306307308}
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
315316317318319320321322323324my
@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
334335336337338339340341342343344345346347348349350351352353354355
}
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
594595596597598599600601602603You 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
630631632633634635636637638639640=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
view all matches for this distribution
651652653654655656657658659660
$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 release on metacpan or search on metacpan
lib/API/Instagram.pm view on Meta::CPAN
33343536373839404142has
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
_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
view all matches for this distribution
185186187188189190191192193194
$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 release on metacpan or search on metacpan
lib/API/Medium.pm view on Meta::CPAN
view all matches for this distribution
72737475767778798081828384
$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 release on metacpan or search on metacpan
lib/API/Octopart.pm view on Meta::CPAN
view all matches for this distribution
368369370371372373374375376377378my
$response
;
my
$tries
= 0;
while
(
$tries
< 3)
{
HTTP::Headers->new(
'Host'
=>
'octopart.com'
,
'Content-Type'
=>
'application/json'
,
'Accept'
=>
'application/json'
,
'Accept-Encoding'
=>
'gzip, deflate'
,
view release on metacpan or search on metacpan
lib/API/Wunderlist.pm view on Meta::CPAN
view all matches for this distribution
292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
$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
can be used to find more information. L<https://developer.wunderlist.com/documentation/endpoints/file_preview>.
=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
can be used to find more information. L<https://developer.wunderlist.com/documentation/endpoints/membership>.
=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
can be used to find more information. L<https://developer.wunderlist.com/documentation/endpoints/positions>.
=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
can be used to find more information. L<https://developer.wunderlist.com/documentation/endpoints/reminder>.
=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
can be used to find more information. L<https://developer.wunderlist.com/documentation/endpoints/subtask>.
=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
can be used to find more information. L<https://developer.wunderlist.com/documentation/endpoints/task_comment>.
=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
can be used to find more information. L<https://developer.wunderlist.com/documentation/endpoints/webhooks>.
=head1 AUTHOR
Al Newkirk <anewkirk@ana.io>
view release on metacpan or search on metacpan
t/APISchema-Generator-Markdown.t view on Meta::CPAN
view all matches for this distribution
7677787980818283848586
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 release on metacpan or search on metacpan
lib/APP/REST/RestTestSuite.pm view on Meta::CPAN
259260261262263264265266267268269270271272273274275276277
if
(
$self
->{html_log_required}
&& (
$self
->{html_log_required} =~ /yes/i ) )
{
$fh
qq|<HTML> <HEAD> <TITLE>LOG for $self->{endpoint}</TITLE> </HEAD>|
.
qq|<BODY><textarea rows="999999" cols="120" style="border:none;">|
;
$err_fh
qq|<HTML> <HEAD> <TITLE>ERROR LOG for $self->{endpoint}</TITLE> </HEAD>|
.
qq|<BODY><textarea rows="999999" cols="120" style="border:none;">|
;
}
STDERR
"\nTest Suite executed on $self->{endpoint}\n"
;
$fh
"\nTest Suite executed on $self->{endpoint}\n"
;
$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
465466467468469470471472473474475476477478479if
(
$self
->{html_log_required}
&& (
$self
->{html_log_required} =~ /yes/i ) )
{
$fh
qq|<HTML> <HEAD> <TITLE>LOG for $self->{endpoint}</TITLE> </HEAD>|
.
qq|<BODY><textarea rows="999999" cols="120" style="border:none;">|
;
}
STDERR
"\nTest Suite executed on $self->{endpoint}\n"
;
$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
809810811812813814815816817818819820821822823824825826827828829830831832833834835
STDERR
"username configured: $self->{username}\n"
;
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
view all matches for this distribution
1077107810791080108110821083108410851086#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 release on metacpan or search on metacpan
applications/htmlroot/cgi-bin/moderator/generateCollectorCrontabSchedulingReport.pl view on Meta::CPAN
view all matches for this distribution
180181182183184185186187188189190191push
(
@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 release on metacpan or search on metacpan
lib/AWS/CLIWrapper.pm view on Meta::CPAN
26272829303132333435my
(
$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
view all matches for this distribution
787788789790791792793794795796797Constructor 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 release on metacpan or search on metacpan
lib/AWS/S3.pm view on Meta::CPAN
3637383940414243444546
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
262263264265266267268269270271Optional. Boolean.
Default is C<0>
=head2 endpoint
Optional. String.
Default is C<s3.amazonaws.com>
lib/AWS/S3.pm view on Meta::CPAN
view all matches for this distribution
293294295296297298299300301302=head2 secure
Boolean. Read-only.
=head2 endpoint
String. Read-only.
=head2 ua
view release on metacpan or search on metacpan
lib/AWS/SNS/Verify.pm view on Meta::CPAN
108109110111112113114115116117118119120121122123124
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
view all matches for this distribution
178179180181182183184185186187188189190191192193
}
}
=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 release on metacpan or search on metacpan
lib/AWS/Signature4.pm view on Meta::CPAN
106107108109110111112113114115116117Given 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
view all matches for this distribution
143144145146147148149150151152153}
=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 release on metacpan or search on metacpan
share/AXLSoap.xsd view on Meta::CPAN
3371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395
</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
34723473347434753476347734783479348034813482
<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
54965497549854995500550155025503550455055506
</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
58745875587658775878587958805881588258835884588558865887588858895890<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
59225923592459255926592759285929593059315932593359345935593659375938<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
76987699770077017702770377047705770677077708<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
17753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771<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
1793517936179371793817939179401794117942179431794417945179461794717948179491795017951<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
1840818409184101841118412184131841418415184161841718418<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
1842618427184281842918430184311843218433184341843518436</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
197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762<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
19907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952</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
view all matches for this distribution
1995919960199611996219963199641996519966199671996819969
<xsd:complexType name=
"UpdateMGCPReq"
>
<xsd:annotation>
<xsd:documentation>Updates an existing MGCP Gateway information in the database.
</xsd:annotation>
<xsd:complexContent>
<xsd:extension base=
"axlapi:APIRequest"
>
<xsd:sequence>
<xsd:choice>
view release on metacpan or search on metacpan
Ace/Sequence.pm view on Meta::CPAN
915916917918919920921922923924925In 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
view all matches for this distribution
942943944945946947948949950951952
$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 release on metacpan or search on metacpan
lib/Acme/AutoLoad.pm view on Meta::CPAN
view all matches for this distribution
257258259260261262263264265266267=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 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
204205206207208209210211212213214]
</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
view all matches for this distribution
230231232233234235236237238239240241242243244245246247248249{
"
;ip
"
;:
"
;10.0.0.1
"
;,
"
;os
"
;:
"
;Debian 9
"
; }
@@ servers/2.json.ep
{
"
;ip
"
;:
"
;10.0.0.2
"
;,
"
;os
"
;:
"
;Debian 8
"
; }
</code></pre>
<p>Now I can test the list endpoint again:</p>
<pre><code>$ perl test-api.pl get /servers
[
{
"
;ip
"
;:
"
;10.0.0.1
"
;,
"
;os
"
;:
"
;Debian 9
"
; }
,
{
"
;ip
"
;:
"
;10.0.0.2
"
;,
"
;os
"
;:
"
;Debian 8
"
; }
]
</code></pre>
<p>And also one of the individual item endpoints:</p>
<pre><code>$ perl test-api.pl get /servers/1
{
"
;ip
"
;:
"
;10.0.0.1
"
;,
"
;os
"
;:
"
;Debian 9
"
; }
</code></pre>
view release on metacpan or search on metacpan
devdata/https_mojolicious.io_blog_2018_12_07_openapi_ view on Meta::CPAN
181182183184185186187188189190191192193<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
view all matches for this distribution
291292293294295296297298299300
-
"
;null
"
;
</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 release on metacpan or search on metacpan
devdata/http_advent.perldancer.org_2018_20 view on Meta::CPAN
130131132133134135136137138139use
Test::Mojo;
my
$t
= Test::Mojo-
>
;with_roles(
'+PSGI'
)-
>
;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
-
>
;get_ok(
'/text'
)
-
>
;status_is(200)
-
>
;content_type_like(
qr[text/plain]
)
-
>
;content_is(
'hello world'
);</pre>
devdata/http_advent.perldancer.org_2018_20 view on Meta::CPAN
150151152153154155156157158159<pre class=
"prettyprint"
>
$t
-
>
;get_ok(
'/text'
, form =
>
; { name =
>
;
'santa'
})
-
>
;status_is(200)
-
>
;content_type_like(
qr[text/plain]
)
-
>
;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
-
>
;get_ok(
'/data'
)
-
>
;status_is(200)
-
>
;content_type_like(
qr[application/json]
)
-
>
;json_is(
'/hello'
=
>
;
'world'
);
devdata/http_advent.perldancer.org_2018_20 view on Meta::CPAN
view all matches for this distribution
164165166167168169170171172173174
-
>
;json_is(
'/hello'
=
>
;
'rudolph'
);</pre>
Now, the test could have been <code>-
>
;json_is({hello =
>
;
'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
-
>
;get_ok(
'/html'
)