The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

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

VERSION

Version 0.08

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);

SUBROUTINES/METHODS

get_currency_list

This method returns an available currencies.

Input: nothing

Result: SilverGoldBull::API::Response object

get_payment_method_list

This method returns an available payment methods.

Input: nothing

Result: SilverGoldBull::API::Response object

get_shipping_method_list

This method returns an available shipping methods.

Input: nothing

Result: SilverGoldBull::API::Response object

get_product_list

This method returns product list.

Input: nothing

Result: SilverGoldBull::API::Response object

get_product

This method returns detailed information about product by id.

Input: product id

Result: SilverGoldBull::API::Response object

get_order_list

This method returns order list.

Input: nothing

Result: SilverGoldBull::API::Response object

get_order

This method returns detailed information about order by id.

Input: order id;

Result: SilverGoldBull::API::Response object

create_order

This method creates a new order.

Input: SilverGoldBull::API::Order object

Result: SilverGoldBull::API::Response object

create_quote

This method creates a quote.

Input: SilverGoldBull::API::Quote object

Result: SilverGoldBull::API::Response object

AUTHOR

Denis Boyun, <denisboyun at gmail.com>

BUGS

Please report any bugs or feature requests to bug-silvergoldbull-api at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=SilverGoldBull-API. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc SilverGoldBull::API

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

Copyright 2016 Denis Boyun.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.