WebService-Slack-WebApi
view release on metacpan or search on metacpan
my $ua = LWP::UserAgent->new( timeout => 10 );
my $slack = WebService::Slack::WebApi->new( ua => $ua );
If you use both parameters `ua` and `opt`, WebService::Slack::WebApi
will throw an exception. This combination is illegal.
## Proxy
`opt` can contain `env_proxy` as boolean value .
If `env_proxy` is true then proxy settings are loaded from `$ENV{HTTP_PROXY}` and `$ENV{NO_PROXY}` by calling `Furl#env_proxy` method.
See also https://metacpan.org/pod/Furl#furl-env\_proxy.
# METHODS
This module provides all methods declared in the API reference (https://api.slack.com/methods).
## Basis
`WebService::Slack::WebApi::Namespace::method_name` corresponds to `namespace.methodName` in Slack Web API.
For example `WebService::Slack::WebApi::Chat::post_message` corresponds to `chat.postMessage`.
lib/WebService/Slack/WebApi.pm view on Meta::CPAN
my $ua = LWP::UserAgent->new( timeout => 10 );
my $slack = WebService::Slack::WebApi->new( ua => $ua );
If you use both parameters C<ua> and C<opt>, WebService::Slack::WebApi
will throw an exception. This combination is illegal.
=head2 Proxy
C<opt> can contain C<env_proxy> as boolean value .
If C<env_proxy> is true then proxy settings are loaded from C<$ENV{HTTP_PROXY}> and C<$ENV{NO_PROXY}> by calling C<Furl#env_proxy> method.
See also https://metacpan.org/pod/Furl#furl-env_proxy.
=head1 METHODS
This module provides all methods declared in the API reference (https://api.slack.com/methods).
=head2 Basis
C<WebService::Slack::WebApi::Namespace::method_name> corresponds to C<namespace.methodName> in Slack Web API.
For example C<WebService::Slack::WebApi::Chat::post_message> corresponds to C<chat.postMessage>.
t/01_web_api.t view on Meta::CPAN
subtest 'opts' => sub {
subtest 'proxy' => sub {
subtest 'opt_proxy' => sub {
my $obj = WebService::Slack::WebApi->new(token => 'hoge', opt => {proxy => 'proxy'});
my $ua = $obj->client->ua;
is ${ $ua->{'ua'} }->{'proxy'}, 'proxy';
};
subtest 'env_proxy' => sub {
local $ENV{HTTP_PROXY} = 'proxy';
local $ENV{http_proxy} = 'proxy';
my $obj = WebService::Slack::WebApi->new(token => 'hoge', opt => {env_proxy => 1});
my $ua = $obj->client->ua;
is ${ $ua->{'ua'} }->{'proxy'}, 'proxy';
};
};
};
done_testing;
( run in 1.049 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )