Build Status

NAME

SilverGoldBull::API - Perl client for the SilverGoldBull(https://silvergoldbull.com/) web service

VERSION

version 0.01

INSTALLATION

To install this module, run the following commands:

perl Build.PL
./Build
./Build test
./Build install

SYNOPSIS

use SilverGoldBull::API;
use SilverGoldBull::API::BillingAddress;
use SilverGoldBull::API::ShippingAddress;
use SilverGoldBull::API::Item;
use SilverGoldBull::API::Order;

my $sgb = SilverGoldBull::API->new(api_key => <API_KEY>);#or use SILVERGOLDBULL_API_KEY env variable

#get available currency list
my $response = $sgb->get_currency_list();
if ($response->is_success) {
    my $currency_list = $response->data();
}

my $billing_addr = SilverGoldBull::API::BillingAddress->new({
  'city'       => 'Calgary',
  'first_name' => 'John',
  'region'     => 'AB',
  'email'      => 'sales@silvergoldbull.com',
  'last_name'  => 'Smith',
  'postcode'   => 'T2P 5C5',
  'street'     => '888 - 3 ST SW, 10 FLOOR - WEST TOWER',
  'phone'      => '+1 (403) 668 8648',
  'country'    => 'CA'
});

my $shipping_addr = SilverGoldBull::API::ShippinggAddress->new({
  'city'       => 'Calgary',
  'first_name' => 'John',
  'region'     => 'AB',
  'email'      => 'sales@silvergoldbull.com',
  'last_name'  => 'Smith',
  'postcode'   => 'T2P 5C5',
  'street'     => '888 - 3 ST SW, 10 FLOOR - WEST TOWER',
  'phone'      => '+1 (403) 668 8648',
  'country'    => 'CA'
});

my $item = SilverGoldBull::API::Item->new({
    'bid_price' => 468.37,
    'qty'       => 1,
    'id'        => '2706',
});

my $order_info = {
  "currency"        => "USD",
  "declaration"     => "TEST",
  "shipping_method" => "1YR_STORAGE",
  "payment_method"  => "paypal",
  "shipping"        => $shipping,#or raw hashref
  "billing"         => $billing,#or raw hashref
  "items"           => [$item],#or raw array of hashrefs
};
my $order = SilverGoldBull::API::Order->new($order_info);
my $response = $sgb->create_order($order);

OVERVIEW

This is a Perl client for the SilverGoldBull API at SilverGoldBull API docs.

METHODS

All methods return SilverGoldBull::API::Response object.

get_currency_list

Input: nothing

Result: An available currency list.

get_payment_method_list

Input: nothing

Result: An available payment method list.

get_shipping_method_list

Input: nothing

Result: An available shipping method list.

get_product_list

Input: nothing

Result: An available product list.

get_product

Input: product id;

Result: Product information.

get_order

Input: order id;

Result: Order information.

create_order

Input: SilverGoldBull::API::Order object;

Result: Product information.

create_quote

Input: SilverGoldBull::API::Quote object;

Result: Quote information.

SEE ALSO

LICENSE AND COPYRIGHT

Copyright (C) 2016 Denis Boyun

This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at:

Lhttp://www.perlfoundation.org/artistic_license_2_0