File Coverage

blib/lib/WWW/Wolfram/DataDrop.pm
Criterion Covered Total %
statement 8 26 30.7
branch n/a
condition n/a
subroutine 3 9 33.3
pod 0 5 0.0
total 11 40 27.5


line stmt bran cond sub pod time code
1             package WWW::Wolfram::DataDrop;
2              
3 1     1   13117 use strict;
  1         1  
  1         22  
4 1     1   16 use 5.008_005;
  1         2  
5             our $VERSION = '0.01';
6              
7             require Exporter;
8             our @ISA = 'Exporter';
9             our @EXPORT = qw/Databin/;
10              
11 1     1   556 use LWP::UserAgent;
  1         31724  
  1         173  
12              
13             sub Databin {
14 0     0 0   my ($id, %opts) = @_;
15 0           my $self = __PACKAGE__->new(bin => $id, %opts);
16 0           return $self;
17             }
18              
19             sub new {
20 0     0 0   my ($class, %opts) = @_;
21 0           my $self = \%opts;
22 0           my $ua_opts = delete $self->{opts};
23 0           $self->{ua} = LWP::UserAgent->new(%$ua_opts);
24 0           return bless $self, $class;
25             }
26              
27             sub add {
28 0     0 0   my ($self, %values) = @_;
29 0           $values{bin} = $self->{bin};
30 0           return $self->_send(%values);
31             }
32              
33             sub _send {
34 0     0     my ($self, %values) = @_;
35 0           my $res = $self->ua->post($self->url, [%values]);
36 0           return $res->is_success;
37             }
38              
39             sub ua {
40 0     0 0   my $self = shift;
41 0           return $self->{ua};
42             }
43              
44             sub url {
45 0     0 0   my $self = shift;
46 0           return 'https://datadrop.wolframcloud.com/api/v1.0/Add';
47             }
48              
49             1;
50             __END__