Business-Bitpay

 view release on metacpan or  search on metacpan

META.yml  view on Meta::CPAN

  url: http://module-build.sourceforge.net/META-spec-v1.4.html
  version: 1.4
module_name: Business::Bitpay
name: Business-Bitpay
no_index:
  directory:
    - inc
    - t
requires:
  Carp: 0
  HTTP::Request: 0
  JSON: 0
  LWP::Protocol::https: 0
  LWP::UserAgent: 0
  URI: 0
  perl: 5.8.1
resources:
  bugtracker: https://github.com/und3f/bitpay/issues
  license: http://dev.perl.org/licenses/
  repository: https://github.com/und3f/bitpay
version: 0.05

Makefile.PL  view on Meta::CPAN

use inc::Module::Install;

all_from 'lib/Business/Bitpay.pm';

requires 'Carp';
requires 'HTTP::Request';
requires 'JSON';
requires 'LWP::UserAgent';
requires 'LWP::Protocol::https';
requires 'URI';
test_requires 'Test::More' => '0.88';

tests 't/*.t';

resources
  bugtracker => 'https://github.com/und3f/bitpay/issues',

lib/Business/Bitpay.pm  view on Meta::CPAN

package Business::Bitpay;

use strict;
use warnings;

use 5.008_001;
our $VERSION = '0.05';
eval $VERSION;

use HTTP::Request;
use URI;
use JSON qw(encode_json decode_json);
use LWP::UserAgent;
require Carp;

sub new {
    my ($class, $api_key, @args) = @_ or Carp::croak("api key missed");

    bless {
        key     => $api_key,

lib/Business/Bitpay.pm  view on Meta::CPAN

    $uri->path($uri->path . $api);

    my $method = 'GET';
    my @fields;
    if ($data) {
        $method = 'POST';
        $data   = encode_json $data;
        push @fields, 'Content-Type' => 'application/json';
    }

    my $request = HTTP::Request->new(
        $method => $uri, [
            'User-Agent'   => 'bitpay api',
            'X-BitPay-Plugin-Info' => 'perl' . $VERSION,
            @fields,
        ],
        $data
    );
    $request;
}



( run in 0.432 second using v1.01-cache-2.11-cpan-de7293f3b23 )