view release on metacpan or search on metacpan
},
"runtime" : {
"requires" : {
"AnyEvent::WebSocket::Client" : "0.39",
"B" : "1.68",
"Carp" : "1.38",
"Data::Dumper" : "2.161",
"Data::Result" : "1.0",
"Exporter" : "5.72",
"HTTP::MultiGet" : "1.008",
"HTTP::Request" : "6.13",
"HTTP::Request::Common" : "6.13",
"IO::Scalar" : "2.111",
"IO::Socket::SSL" : "1.968",
"JSON" : "2.90",
"LWP::UserAgent" : "6.26",
"Log::Dispatch::Handle" : "2.65",
"Log::Log4perl" : "1.49",
"Log::LogMethods" : "1.0",
"Modern::Perl" : "1.20170117",
"Moo" : "2.003002",
"MooX::Types::MooseLike::Base" : "0.29",
- t
- inc
requires:
AnyEvent::WebSocket::Client: '0.39'
B: '1.68'
Carp: '1.38'
Data::Dumper: '2.161'
Data::Result: '1.0'
Exporter: '5.72'
HTTP::MultiGet: '1.008'
HTTP::Request: '6.13'
HTTP::Request::Common: '6.13'
IO::Scalar: '2.111'
IO::Socket::SSL: '1.968'
JSON: '2.90'
LWP::UserAgent: '6.26'
Log::Dispatch::Handle: '2.65'
Log::Log4perl: '1.49'
Log::LogMethods: '1.0'
Modern::Perl: '1.20170117'
Moo: '2.003002'
MooX::Types::MooseLike::Base: '0.29'
Makefile.PL view on Meta::CPAN
B 1.68
Scalar::Util 1.48
Ref::Util 0.203
Log::Dispatch::Handle 2.65
IO::Scalar 2.111
Exporter 5.72
Log::LogMethods 1.0
JSON 2.90
URI::Escape 3.31
HTTP::MultiGet 1.008
HTTP::Request::Common 6.13
LWP::UserAgent 6.26
HTTP::Request 6.13
AnyEvent::WebSocket::Client 0.39
UUID::Tiny 1.04
)
}, # e.g., Module::Name => 1.1
($] >= 5.005 ? ## Add these new keywords supported since 5.005
(ABSTRACT_FROM => 'lib/AnyEvent/SparkBot.pm', # retrieve abstract from module
AUTHOR => 'Mike Shipper <AKALINUX@CPAN.ORG>') : ()),
);
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
package AnyEvent::HTTP::Spark;
use Modern::Perl;
use Moo;
use MooX::Types::MooseLike::Base qw(:all);
use Data::Dumper;
use JSON qw(to_json from_json);
use HTTP::Request::Common qw(POST);
use Ref::Util qw(is_plain_arrayref is_plain_hashref);
use URI::Escape qw(uri_escape_utf8);
use namespace::clean;
use Scalar::Util qw(looks_like_number);
use AnyEvent;
BEGIN {
no namespace::clean;
with 'HTTP::MultiGet::Role','Log::LogMethods','AnyEvent::SparkBot::SharedRole';
}
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_getMe($cb)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$hashRef)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=cut
sub que_getMe {
my ($self,$cb)=@_;
return $self->que_get($cb,"people/me");
}
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_listPeople($cb,$hashRef)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$hashRef)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head2 Get Person
=over 4
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_getPerson($cb,$personId)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$personId)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head2 Create Person
=over 4
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_createPerson($cb,$hashRef)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$hashRef)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head2 Delete Person
=over 4
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_deletePerson($cb,$personId)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$personId)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head2 Update Person
=over 4
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_updatePerson($cb,$personId,$hashRef)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$personId,$hashRef)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head1 Rooms
=head2 List Rooms
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_listRooms($cb,$hashRef)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$hashRef)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head2 Get Room
=over 4
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_getRoom($cb,$roomId)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$roomId)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head2 Create Room
=over 4
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_createRoom($cb,$hashRef)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$hashRef)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head2 Delete Room
=over 4
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_deleteRoom($cb,$roomId)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$roomId)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head2 Update Room
=over 4
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_updateRoom($cb,$roomId,$hashRef)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$roomId,$hashRef)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head1 Memberships
=head2 List Memberships
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_listMemberships($cb,$hashRef)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$hashRef)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head2 Get Membership
=over 4
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_getMembership($cb,$membershipId)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$membershipId)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head2 Create Membership
=over 4
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_createMembership($cb,$hashRef)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$hashRef)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head2 Delete Membership
=over 4
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_deleteMembership($cb,$membershipId)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$membershipId)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head2 Update Membership
=over 4
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_updateMembership($cb,$membershipId,$hashRef)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$membershipId,$hashRef)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head1 Messages
=head2 List Messages
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_listMessages($cb,$hashRef)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$hashRef)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head2 Get Message
=over 4
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_getMessage($cb,$messageId)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$messageId)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head2 Create Message
=over 4
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_createMessage($cb,$hashRef)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$hashRef)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head2 Delete Message
=over 4
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_deleteMessage($cb,$messageId)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$messageId)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head1 Teams
=head2 List Teams
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_listTeams($cb,$hashRef)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$hashRef)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head2 Get Team
=over 4
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_getTeam($cb,$teamId)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$teamId)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head2 Create Team
=over 4
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_createTeam($cb,$hashRef)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$hashRef)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head2 Delete Team
=over 4
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_deleteTeam($cb,$teamId)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$teamId)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head2 Update Team
=over 4
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_updateTeam($cb,$teamId,$hashRef)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$teamId,$hashRef)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head1 Team Memberships
=head2 List Team Memberships
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_listTeamMemberships($cb,$hashRef)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$hashRef)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head2 Get Team Membership
=over 4
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_getTeamMembership($cb,$teamMembershipId)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$teamMembershipId)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head2 Create Team Membership
=over 4
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_createTeamMembership($cb,$hashRef)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$hashRef)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head2 Delete Team Membership
=over 4
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_deleteTeamMembership($cb,$teamMembershipId)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$teamMembershipId)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head2 Update Team Membership
=over 4
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_updateTeamMembership($cb,$teamMembershipId,$hashRef)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$teamMembershipId,$hashRef)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head1 Webhooks
=head2 List Webhooks
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_listWebhooks($cb,$hashRef)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$hashRef)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head2 Get Webhook
=over 4
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_getWebhook($cb,$webhookId)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$webhookId)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head2 Create Webhook
=over 4
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_createWebhook($cb,$hashRef)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$hashRef)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head2 Delete Webhook
=over 4
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_deleteWebhook($cb,$webhookId)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$webhookId)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head2 Update Webhook
=over 4
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_updateWebhook($cb,$webhookId,$hashRef)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$webhookId,$hashRef)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head1 Organizations
=head2 List Organizations
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_listOrganizations($cb,$hashRef)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$hashRef)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head2 Get Organization
=over 4
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_getOrganization($cb,$organizationId)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$organizationId)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head1 Licenses
=head2 List Licenses
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_listLicenses($cb,$hashRef)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$hashRef)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head2 Get License
=over 4
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_getLicense($cb,$licenseId)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$licenseId)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head1 Roles
=head2 List Roles
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_listRoles($cb,$hashRef)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$hashRef)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head2 Get Role
=over 4
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_getRole($cb,$roleId)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$roleId)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head1 Events
=head2 List Events
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_listEvents($cb,$hashRef)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$hashRef)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head2 Get Event
=over 4
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_getEvent($cb,$eventId)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$eventId)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=cut
__PACKAGE__->_build_common("people",qw(list get create delete update));
__PACKAGE__->_build_common("rooms",qw(list get create delete update));
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_listMeetingss($cb,$hashRef)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$hashRef)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head2 Get Meetings
=over 4
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_getMeetings($cb,$roomId)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$roomId)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head2 Create Meetings
=over 4
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_createMeetings($cb,$hashRef)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$hashRef)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head2 Delete Meetings
=over 4
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_deleteMeetings($cb,$roomId)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$roomId)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head2 Update Meetings
=over 4
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $id=$self->que_updateMeetings($cb,$roomId,$hashRef)
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$roomId,$hashRef)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=head1 Attaching files to messages
Posting files to channel steps outside of the traditional json data format.
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=item * Non-Blocking my $result=$self->que_uploadFile($cb,'/path/to/file',%args);
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$roomId,$hashRef)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=cut
sub que_uploadFile {
my ($self,$cb,$file,%args)=@_;
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
$data->{cursorPosition}=$2;
}
}
}
$cb->(@_);
}
=item * my $result=$self->build_post_json($url,$data);
Returns a Data::Result object; When true it contains an HTTP::Request Object For $url, the body will consist of $data converted to json. When false it contains why it failed.
=cut
sub build_post_json {
my ($self,$url,$data)=@_;
my $uri=$self->api_url.$url;
my $json=eval {to_json($data)};
return $self->new_false("Failed to convert \$data to json, error was $@") if $@;
my $request=new HTTP::Request(POST=>$uri,$self->default_headers,$json);
return $self->new_true($request);
}
=item * my $id=$self->queue_builder($cb,$method,$url,$data);
Returns the ID of the object in the request for $method.
=cut
sub queue_builder {
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=cut
sub que_post_json {
my ($self,$cb,$url,$data)=@_;
return $self->queue_builder($cb,'build_post_json',$url,$data);
}
=item * my $result=$self->build_put_json($url,$data);
Returns a Data::Result object; When true it contains an HTTP::Request Object For $url, the body will consist of $data converted to json. When false it contains why it failed.
=cut
sub build_put_json {
my ($self,$url,$data)=@_;
my $uri=$self->api_url.$url;
my $json=eval {to_json($data)};
return $self->new_false("Failed to convert \$data to json, error was $@") if $@;
my $request=new HTTP::Request(PUT=>$uri,$self->default_headers,$json);
return $self->new_true($request);
}
=item * my $id=$self->que_put_json($cb,$url,$data);
Queue's a json put and returns the id
=cut
sub que_put_json {
my ($self,$cb,$url,$data)=@_;
return $self->queue_builder($cb,'build_put_json',$url,$data);
}
=item * my $result=$self->build_post_form($url,$data);
Returns a Data::Result Object, when true it contains the correctly fromatted HTTP::Request Object, when false it contains why it failed.
=cut
sub build_post_form {
my ($self,$url,$data)=@_;
my $uri=$self->api_url.$url;
my $form_ref;
if(is_plain_arrayref($data)) {
$form_ref=$data;
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=cut
sub que_post_form {
my ($self,$cb,$url,$data)=@_;
return $self->queue_builder($cb,'build_post_form',$url,$data);
}
=item * my $result=$self->build_get($url,$data);
Returns a Data::Result Object, when true it contains the correctly fromatted HTTP::Request Object, when false it contains why it failed.
=cut
sub build_get {
my ($self,$url,$data)=@_;
my $uri=$self->api_url.$url.'?';
my @list;
if(is_plain_arrayref($data)) {
@list=@{$data};
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
my $headers=$self->default_headers;
my @args;
while(my ($key,$value)=splice @list,0,2) {
push @args,uri_escape_utf8($key).'='.uri_escape_utf8($value);
}
my $args=join '&',@args;
$uri .=$args;
$uri=~ s/\?$//s;
my $get=new HTTP::Request(GET=>$uri,$self->default_headers);
return $self->new_true($get);
}
=item * my $self->que_getRaw($cb,$raw_url)
Que's a diy get request
=cut
sub que_getRaw {
my ($self,$cb,$url)=@_;
my $req=HTTP::Request->new(GET=>$url,$self->default_headers);
return $self->queue_request($req,$cb);
}
=item * my $id=$self->que_get($cb,$url,$data);
Queue's a form post and returns the id
=cut
sub que_get {
my ($self,$cb,$url,$data)=@_;
return $self->queue_builder($cb,'build_get',$url,$data);
}
=item * my $result=$self->build_head($url,$data);
Returns a Data::Result Object, when true it contains the correctly fromatted HTTP::Request Object, when false it contains why it failed.
=cut
sub build_head {
my ($self,$url,$data)=@_;
my $uri=$self->api_url.$url.'?';
my @list;
if(is_plain_arrayref($data)) {
@list=@{$data};
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
my $headers=$self->default_headers;
my @args;
while(my ($key,$value)=splice @list,0,2) {
push @args,uri_escape_utf8($key).'='.uri_escape_utf8($value);
}
my $args=join '&',@args;
$uri .=$args;
my $get=new HTTP::Request(HEAD=>$uri,$self->default_headers);
return $self->new_true($get);
}
=item * my $id=$self->que_head($cb,$url,$data);
Queue's a form post and returns the id
=cut
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
my $headers=$self->default_headers;
my @args;
while(my ($key,$value)=splice @list,0,2) {
push @args,uri_escape_utf8($key).'='.uri_escape_utf8($value);
}
my $args=join '&',@args;
$uri .=$args;
my $get=new HTTP::Request(DELETE=>$uri,$self->default_headers);
return $self->new_true($get);
}
=item * my $id=$self->que_delete($cb,$url,$data);
Ques a delete to run.
=cut
lib/AnyEvent/SparkBot.pm view on Meta::CPAN
sub que_deleteLastUrl : BENCHMARK_INFO {
my ($self,$cb)=@_;
my $result=$self->getLastConn();
return $self->queue_result($cb,$result) unless $result;
my $json=$result->get_data;
return $self->queue_result($cb,$self->new_false('URL not found in json data strucutre')) unless exists $json->{url};
my $url=$json->{url};
my $req=new HTTP::Request(DELETE=>$url,$self->default_headers);
return $self->queue_request($req,$cb);
}
=item * my $job_id=$self->que_getWsUrl($cb)
Gets the WebSocket URL
Returns a Data::Result Object: When true it contains the url. When false it contains why it failed.
=cut
lib/AnyEvent/SparkBot.pm view on Meta::CPAN
my ($self,$id,$result)=@_;
if($result) {
my $json=$result->get_data;
$self->connInfo($json);
$self->saveLastConn($json);
}
$cb->(@_);
};
my $req=new HTTP::Request(POST=>$self->defaultUrl,$self->default_headers,$self->deviceDesc);
return $self->queue_request($req,$run_cb);
}
=item * $self->log_delete_call($id,$result)
Call back to handle logging clean up of previous session
=cut
sub log_delete_call : BENCHMARK_INFO {
t/AnyEvent-HTTP-Spark.t view on Meta::CPAN
cmp_ok($post->uri,'eq',$self->api_url.'test?test=data','Should have generated the correct url');
diag $post->as_string;
}
{
my ($id,$result,$request,$response);
my $cb=sub {
($self,$id,$result,$request,$response)=@_;
};
$self->handle_delete($cb,1,$self->new_false("Should be false"),HTTP::Request->new(DELETE=>'http://blah'),HTTP::Response->new(204,'looks good'));
ok($result,'delete pass, result object should be true') or die "Should pass this test";
$self->handle_delete($cb,1,$self->new_false("Should be false"),HTTP::Request->new(DELETE=>'http://blah'),HTTP::Response->new(200,'Should fail'));
ok(!$result,'delete fail, result object should be false') or die diag Dumper($result);
}
SKIP: {
skip 'ENV Vars [SPARK_TOKEN, RUN_HTTP_TESTS,TEST_EMAIL] Not set',1 unless $ENV{SPARK_TOKEN} and $ENV{RUN_HTTP_TESTS} and $ENV{TEST_EMAIL};
my $result=$self->listPeople({email=>$ENV{TEST_EMAIL}});
ok($result,'Should get an email address') or diag(Dumper $result);
#diag(Dumper($result->get_data));
sleep 1;
}