diff --git a/README.md b/README.md index c5a1bea8..4b826c13 100644 --- a/README.md +++ b/README.md @@ -109,20 +109,6 @@ end ## The APIs -### Cart Information - -With the MWS Cart Information API, you can retrieve shopping carts that your Amazon Webstore customers have created. The Cart Information API enables you to programmatically integrate Amazon Webstore cart information with your CRM systems, marketing applications, and other systems that require cart data. - -- [Amazon references](https://developer.amazonservices.com/gp/mws/api.html?group=cartinformation§ion=cartinformation) -- [Peddler API docs](http://www.rubydoc.info/gems/peddler/MWS/CartInformation/Client) - -### Customer Information - -With the MWS Customer Information API, you can retrieve information from the customer accounts of your Amazon Webstore customers. This customer information includes customer name, contact information, customer account type, and associated Amazon Webstore marketplaces. The Customer Information API enables you to programmatically integrate Amazon Webstore customer account information with your CRM systems, marketing applications, and other systems that require customer data. - -- [Amazon references](https://developer.amazonservices.com/gp/mws/api.html?group=customerinformation§ion=customerinformation) -- [Peddler API docs](http://www.rubydoc.info/gems/peddler/MWS/CustomerInformation/Client) - ### Feeds The MWS Feeds API lets you upload inventory and order data to Amazon. You can also use this API to get information about the processing of feeds. diff --git a/lib/mws.rb b/lib/mws.rb index 461ec2cc..900aa842 100644 --- a/lib/mws.rb +++ b/lib/mws.rb @@ -1,6 +1,4 @@ require 'forwardable' -require 'mws/cart_information' -require 'mws/customer_information' require 'mws/feeds' require 'mws/finances' require 'mws/fulfillment_inbound_shipment' diff --git a/lib/mws/cart_information.rb b/lib/mws/cart_information.rb deleted file mode 100644 index 419d36f8..00000000 --- a/lib/mws/cart_information.rb +++ /dev/null @@ -1 +0,0 @@ -require 'mws/cart_information/client' diff --git a/lib/mws/cart_information/client.rb b/lib/mws/cart_information/client.rb deleted file mode 100644 index a5b47bdb..00000000 --- a/lib/mws/cart_information/client.rb +++ /dev/null @@ -1,74 +0,0 @@ -require 'peddler/client' - -module MWS - module CartInformation - # With the Cart Information API, you can retrieve shopping carts that your - # Amazon Webstore customers have created. The Cart Information API enables - # you to programmatically integrate Amazon Webstore cart information with - # your CRM systems, marketing applications, and other systems that require - # cart data. - # - # @note The Cart Information API only returns cart information for Webstores - # with Seller-Branded Checkout. No cart information is returned for Amazon - # Webstores with Amazon.com checkout. If your Webstore offers both - # checkout options, cart information is returned only for Seller-Branded - # Checkout accounts. - # @note In addition to registering for Amazon MWS, you must also request - # authorization to use the Cart Information API section. - class Client < ::Peddler::Client - version '2014-03-01' - path "/CartInformation/#{version}" - - # Lists shopping carts - # - # @see http://docs.developer.amazonservices.com/en_US/cart_info/CartInfo_ListCarts.html - # @param [String, #iso8601] date_range_start - # @param [Hash] opts - # @option opts [String] :marketplace_id - # @option opts [String, #iso8601] :date_range_end - # @return [Peddler::XMLParser] - def list_carts(date_range_start, opts = {}) - operation('ListCarts') - .add(opts.update('DateRangeStart' => date_range_start)) - - run - end - - # Lists the next page of shopping carts - # - # @see http://docs.developer.amazonservices.com/en_US/cart_info/CartInfo_ListCartsByNextToken.html - # @param [String] next_token - # @return [Peddler::XMLParser] - def list_carts_by_next_token(next_token) - operation('ListCartsByNextToken') - .add('NextToken' => next_token) - - run - end - - # Returns shopping carts based on specified values - # - # @see http://docs.developer.amazonservices.com/en_US/cart_info/CartInfo_GetCarts.html - # @overload get_carts(marketplace_id, *cart_ids) - # @param [String] marketplace_id - # @param [String] cart_id one or more cart_ids - # @return [Peddler::XMLParser] - def get_carts(marketplace_id, *cart_id_list) - operation('GetCarts') - .add('MarketplaceId' => marketplace_id, 'CartIdList' => cart_id_list) - .structure!('CartIdList', 'CartId') - - run - end - - # Gets the service status of the API - # - # @see http://docs.developer.amazonservices.com/en_US/cart_info/MWS_GetServiceStatus.html - # @return [Peddler::XMLParser] - def get_service_status - operation('GetServiceStatus') - run - end - end - end -end diff --git a/lib/mws/customer_information.rb b/lib/mws/customer_information.rb deleted file mode 100644 index 2e8e7141..00000000 --- a/lib/mws/customer_information.rb +++ /dev/null @@ -1 +0,0 @@ -require 'mws/customer_information/client' diff --git a/lib/mws/customer_information/client.rb b/lib/mws/customer_information/client.rb deleted file mode 100644 index 522e4f13..00000000 --- a/lib/mws/customer_information/client.rb +++ /dev/null @@ -1,80 +0,0 @@ -require 'peddler/client' - -module MWS - module CustomerInformation - # With the Customer Information API, you can retrieve information from the - # customer accounts of your Amazon Webstore customers. This customer - # information includes customer name, contact information, customer account - # type, and associated Amazon Webstore marketplaces. The Customer - # Information API enables you to programmatically integrate Amazon Webstore - # customer account information with your CRM systems, marketing - # applications, and other systems that require customer data. - # - # @note The Customer Information API section only returns customer - # information for Webstores with Seller-Branded Checkout. No customer - # information is returned for Webstores with Amazon.com checkout. If your - # Webstore offers both checkout options, customer information is returned - # only for Seller-Branded Checkout accounts. - # @note In addition to registering for Amazon MWS, you must request - # authorization to use the Customer Information API. - class Client < ::Peddler::Client - version '2014-03-01' - path "/CustomerInformation/#{version}" - - # Lists customer accounts based on search criteria that you specify - # - # @see http://docs.developer.amazonservices.com/en_US/customer_info/CustomerInfo_ListCustomers.html - # @param [Hash] opts - # @option opts [String] :marketplace_id - # @option opts [String, #iso8601] :date_range_start - # @option opts [String, #iso8601] :date_range_end - # @option opts [String] :date_range_type - # @return [Peddler::XMLParser] - def list_customers(opts = {}) - operation('ListCustomers') - .add(opts) - - run - end - - # Lists the next page of customer accounts - # - # @see http://docs.developer.amazonservices.com/en_US/customer_info/CustomerInfo_ListCustomersByNextToken.html - # @param [String] next_token - # @return [Peddler::XMLParser] - def list_customers_by_next_token(next_token) - operation('ListCustomersByNextToken') - .add('NextToken' => next_token) - - run - end - - # Returns customer accounts based on the CustomerId values that you - # specify - # - # @see http://docs.developer.amazonservices.com/en_US/customer_info/CustomerInfo_GetCustomersForCustomerId.html - # @overload get_customers_for_customer_id(*customer_ids, opts = {}) - # @param [String] customer_id one or more customer_ids - # @param [Hash] opts - # @option opts [String] :marketplace_id - # @return [Peddler::XMLParser] - def get_customers_for_customer_id(*customer_id_list) - opts = extract_options(customer_id_list) - operation('GetCustomersForCustomerId') - .add(opts.update('CustomerIdList' => customer_id_list)) - .structure!('CustomerIdList', 'CustomerId') - - run - end - - # Gets the service status of the API - # - # @see http://docs.developer.amazonservices.com/en_US/customer_info/MWS_GetServiceStatus.html - # @return [Peddler::XMLParser] - def get_service_status - operation('GetServiceStatus') - run - end - end - end -end diff --git a/test/integration/test_cart_information.rb b/test/integration/test_cart_information.rb deleted file mode 100644 index fbba0f95..00000000 --- a/test/integration/test_cart_information.rb +++ /dev/null @@ -1,11 +0,0 @@ -require 'integration_helper' -require 'mws/cart_information' - -class TestCartInformation < IntegrationTest - def test_gets_service_status - clients.each do |client| - res = client.get_service_status - refute_empty res.parse - end - end -end diff --git a/test/integration/test_customer_information.rb b/test/integration/test_customer_information.rb deleted file mode 100644 index 96775260..00000000 --- a/test/integration/test_customer_information.rb +++ /dev/null @@ -1,11 +0,0 @@ -require 'integration_helper' -require 'mws/customer_information' - -class TestCustomerInformation < IntegrationTest - def test_gets_service_status - clients.each do |client| - res = client.get_service_status - refute_empty res.parse - end - end -end diff --git a/test/unit/mws/test_cart_information_client.rb b/test/unit/mws/test_cart_information_client.rb deleted file mode 100644 index 0c41d32e..00000000 --- a/test/unit/mws/test_cart_information_client.rb +++ /dev/null @@ -1,61 +0,0 @@ -require 'helper' -require 'mws/cart_information/client' - -class TestMWSCartInformationClient < MiniTest::Test - def setup - @client = MWS::CartInformation::Client.new - end - - def test_lists_carts - operation = { - 'Action' => 'ListCarts', - 'DateRangeStart' => '1' - } - - @client.stub(:run, nil) do - @client.list_carts('1') - end - - assert_equal operation, @client.operation - end - - def test_lists_carts_by_next_token - operation = { - 'Action' => 'ListCartsByNextToken', - 'NextToken' => '1' - } - - @client.stub(:run, nil) do - @client.list_carts_by_next_token('1') - end - - assert_equal operation, @client.operation - end - - def test_gets_carts - operation = { - 'Action' => 'GetCarts', - 'MarketplaceId' => '1', - 'CartIdList.CartId.1' => '2', - 'CartIdList.CartId.2' => '3' - } - - @client.stub(:run, nil) do - @client.get_carts('1', '2', '3') - end - - assert_equal operation, @client.operation - end - - def test_gets_service_status - operation = { - 'Action' => 'GetServiceStatus' - } - - @client.stub(:run, nil) do - @client.get_service_status - end - - assert_equal operation, @client.operation - end -end diff --git a/test/unit/mws/test_customer_information_client.rb b/test/unit/mws/test_customer_information_client.rb deleted file mode 100644 index 02d1f798..00000000 --- a/test/unit/mws/test_customer_information_client.rb +++ /dev/null @@ -1,59 +0,0 @@ -require 'helper' -require 'mws/customer_information/client' - -class TestMWSCustomerInformationClient < MiniTest::Test - def setup - @client = MWS::CustomerInformation::Client.new - end - - def test_lists_customers - operation = { - 'Action' => 'ListCustomers' - } - - @client.stub(:run, nil) do - @client.list_customers - end - - assert_equal operation, @client.operation - end - - def test_lists_customers_by_next_token - operation = { - 'Action' => 'ListCustomersByNextToken', - 'NextToken' => '1' - } - - @client.stub(:run, nil) do - @client.list_customers_by_next_token('1') - end - - assert_equal operation, @client.operation - end - - def test_gets_customers_for_customer_id - operation = { - 'Action' => 'GetCustomersForCustomerId', - 'CustomerIdList.CustomerId.1' => '1', - 'CustomerIdList.CustomerId.2' => '2' - } - - @client.stub(:run, nil) do - @client.get_customers_for_customer_id('1', '2') - end - - assert_equal operation, @client.operation - end - - def test_gets_service_status - operation = { - 'Action' => 'GetServiceStatus' - } - - @client.stub(:run, nil) do - @client.get_service_status - end - - assert_equal operation, @client.operation - end -end