Cloudinary

 view release on metacpan or  search on metacpan

Cloudinary-0.16/Cloudinary-0.16/lib/Cloudinary.pm  view on Meta::CPAN

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
package Cloudinary;
use Mojo::Base -base;
use Mojo::Util qw(sha1_sum url_escape);
use Scalar::Util 'weaken';
 
our $VERSION = '0.16';
our (%SHORTER, %LONGER);
my @SIGNATURE_KEYS = qw(callback eager format public_id tags timestamp transformation type);
 
{
  %LONGER = (
    a => 'angle',
    b => 'background',
    c => 'crop',

Cloudinary-0.16/Cloudinary-0.16/lib/Cloudinary.pm  view on Meta::CPAN

107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
}
 
sub _call_api {
  my ($self, $action, $args, $post, $cb) = @_;
  my $url = join '/', $self->_api_url, $self->cloud_name, $args->{resource_type}, $action;
  my $headers = {'Content-Type' => 'multipart/form-data'};
 
  $post->{api_key}   = $self->api_key;
  $post->{signature} = $self->_api_sign_request($post);
 
  Scalar::Util::weaken($self);
  my $tx = $self->_ua->post(
    $url, $headers,
    form => $post,
    $cb ? sub { $self->$cb($_[1]->res->json || {error => $_[1]->error || 'Unknown error'}) } : (),
  );
 
  return $self if $cb;    # non-blocking
  my $res = $tx->error;
  die $res->{message} || 'Unknown error' if $res;
  $res = $tx->res->json;

lib/Cloudinary.pm  view on Meta::CPAN

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
package Cloudinary;
use Mojo::Base -base;
use Mojo::Util qw(sha1_sum url_escape);
use Scalar::Util 'weaken';
 
our $VERSION = '0.16';
our (%SHORTER, %LONGER);
my @SIGNATURE_KEYS = qw(callback eager format public_id tags timestamp transformation type);
 
{
  %LONGER = (
    a => 'angle',
    b => 'background',
    c => 'crop',

lib/Cloudinary.pm  view on Meta::CPAN

107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
}
 
sub _call_api {
  my ($self, $action, $args, $post, $cb) = @_;
  my $url = join '/', $self->_api_url, $self->cloud_name, $args->{resource_type}, $action;
  my $headers = {'Content-Type' => 'multipart/form-data'};
 
  $post->{api_key}   = $self->api_key;
  $post->{signature} = $self->_api_sign_request($post);
 
  Scalar::Util::weaken($self);
  my $tx = $self->_ua->post(
    $url, $headers,
    form => $post,
    $cb ? sub { $self->$cb($_[1]->res->json || {error => $_[1]->error || 'Unknown error'}) } : (),
  );
 
  return $self if $cb;    # non-blocking
  my $res = $tx->error;
  die $res->{message} || 'Unknown error' if $res;
  $res = $tx->res->json;

lib/Mojolicious/Plugin/Cloudinary.pm  view on Meta::CPAN

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use Mojo::Base -base;
use Mojo::Util qw(sha1_sum url_escape);
use Scalar::Util 'weaken';
use base qw(https://metacpan.org/pod/Cloudinary">Cloudinary Mojolicious::Plugin);
 
our $VERSION = 0.0402;    # just need something higher than the previous version
 
has js_image => '/image/blank.png';
 
sub register {
  my ($self, $app, $config) = @_;
 
  for my $k (keys %{$config || {}}) {



( run in 0.348 second using v1.01-cache-2.11-cpan-4e96b696675 )