peddler 0.5.3 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +237 -8
- data/lib/mws/feeds.rb +1 -0
- data/lib/mws/feeds/client.rb +97 -0
- data/lib/mws/feeds/parsers/feed.rb +14 -0
- data/lib/mws/feeds/parsers/feed_submission.rb +25 -0
- data/lib/mws/feeds/parsers/feed_submission_count.rb +13 -0
- data/lib/mws/feeds/parsers/feed_submission_list.rb +20 -0
- data/lib/mws/feeds/parsers/feed_submission_result.rb +10 -0
- data/lib/mws/feeds/parsers/feed_submissions.rb +18 -0
- data/lib/mws/feeds/requests/feed.rb +38 -0
- data/lib/mws/feeds/requests/feed_submission_count.rb +20 -0
- data/lib/mws/feeds/requests/feed_submission_list.rb +28 -0
- data/lib/mws/feeds/requests/feed_submission_result.rb +18 -0
- data/lib/mws/feeds/requests/feed_submissions.rb +20 -0
- data/lib/mws/fulfillment_inbound_shipment/client.rb +7 -0
- data/lib/mws/fulfillment_inventory/client.rb +7 -0
- data/lib/mws/fulfillment_outbound_shipment/client.rb +7 -0
- data/lib/mws/off_amazon_payments/client.rb +7 -0
- data/lib/mws/orders.rb +1 -0
- data/lib/mws/orders/client.rb +88 -0
- data/lib/mws/orders/parsers/invoice_data.rb +25 -0
- data/lib/mws/orders/parsers/order.rb +113 -0
- data/lib/mws/orders/parsers/order_item.rb +110 -0
- data/lib/mws/orders/parsers/order_items.rb +20 -0
- data/lib/mws/orders/parsers/orders.rb +20 -0
- data/lib/mws/orders/parsers/payment_execution_detail.rb +20 -0
- data/lib/mws/orders/parsers/payment_execution_detail_item.rb +17 -0
- data/lib/mws/orders/parsers/service_status.rb +36 -0
- data/lib/mws/orders/parsers/service_status_message.rb +17 -0
- data/lib/mws/orders/parsers/shipping_address.rb +37 -0
- data/lib/mws/orders/requests/order_items.rb +26 -0
- data/lib/mws/orders/requests/orders.rb +39 -0
- data/lib/mws/orders/requests/service_status.rb +15 -0
- data/lib/mws/products/client.rb +7 -0
- data/lib/mws/recommendations/client.rb +7 -0
- data/lib/mws/reports/client.rb +6 -0
- data/lib/mws/sellers/client.rb +7 -0
- data/lib/mws/subscriptions/client.rb +7 -0
- data/lib/peddler.rb +11 -1
- data/lib/peddler/client.rb +62 -0
- data/lib/peddler/parsers/base.rb +15 -0
- data/lib/peddler/parsers/collection.rb +23 -0
- data/lib/peddler/parsers/model.rb +43 -0
- data/lib/peddler/parsers/text.rb +13 -0
- data/lib/peddler/parsers/xml.rb +25 -0
- data/lib/peddler/request.rb +50 -0
- data/lib/peddler/request/parameters.rb +56 -0
- data/lib/peddler/request/structured_list.rb +43 -0
- data/lib/peddler/response_wrapper.rb +32 -0
- data/lib/peddler/version.rb +1 -1
- data/test/fixtures/feeds/feed_submission.xml +14 -0
- data/test/fixtures/feeds/feed_submission_count.xml +9 -0
- data/test/fixtures/feeds/feed_submission_list.xml +17 -0
- data/test/fixtures/feeds/feed_submissions.xml +15 -0
- data/test/fixtures/mws.yml +8 -0
- data/test/fixtures/mws.yml.example +4 -0
- data/test/fixtures/orders/order_items.xml +83 -0
- data/test/fixtures/orders/orders.xml +109 -0
- data/test/fixtures/orders/service_status.xml +19 -0
- data/test/helper.rb +5 -0
- data/test/integration/feeds/test_feed_submission_count.rb +13 -0
- data/test/integration/feeds/test_feed_submission_list.rb +15 -0
- data/test/integration/feeds/test_feed_submission_result.rb +15 -0
- data/test/integration/orders/test_order_items.rb +19 -0
- data/test/integration/orders/test_orders.rb +20 -0
- data/test/integration/orders/test_service_status.rb +12 -0
- data/test/integration_helper.rb +16 -0
- data/test/mws/feeds/parsers/test_feed.rb +13 -0
- data/test/mws/feeds/parsers/test_feed_submission.rb +25 -0
- data/test/mws/feeds/parsers/test_feed_submission_count.rb +13 -0
- data/test/mws/feeds/parsers/test_feed_submission_list.rb +14 -0
- data/test/mws/feeds/parsers/test_feed_submission_result.rb +13 -0
- data/test/mws/feeds/parsers/test_feed_submissions.rb +17 -0
- data/test/mws/feeds/requests/test_feed.rb +63 -0
- data/test/mws/feeds/requests/test_feed_submission_count.rb +23 -0
- data/test/mws/feeds/requests/test_feed_submission_list.rb +40 -0
- data/test/mws/feeds/requests/test_feed_submissions.rb +29 -0
- data/test/mws/orders/parsers/test_order.rb +86 -0
- data/test/mws/orders/parsers/test_order_item.rb +69 -0
- data/test/mws/orders/parsers/test_order_items.rb +14 -0
- data/test/mws/orders/parsers/test_orders.rb +14 -0
- data/test/mws/orders/parsers/test_payment_execution_detail.rb +14 -0
- data/test/mws/orders/parsers/test_payment_execution_detail_item.rb +17 -0
- data/test/mws/orders/parsers/test_service_status.rb +39 -0
- data/test/mws/orders/parsers/test_service_status_message.rb +17 -0
- data/test/mws/orders/parsers/test_shipping_address.rb +36 -0
- data/test/mws/orders/requests/test_order_items.rb +39 -0
- data/test/mws/orders/requests/test_orders.rb +49 -0
- data/test/mws/orders/requests/test_service_status.rb +25 -0
- data/test/parser_helper.rb +11 -0
- data/test/peddler/parsers/test_collection.rb +8 -0
- data/test/peddler/parsers/test_model.rb +34 -0
- data/test/peddler/request/test_parameters.rb +35 -0
- data/test/peddler/request/test_structured_list.rb +18 -0
- data/test/peddler/test_client.rb +42 -0
- data/test/request_helper.rb +20 -0
- metadata +213 -10
- data/lib/peddler/apis.rb +0 -45
- data/lib/peddler/service.rb +0 -83
- data/test/service_test.rb +0 -42
- data/test/test_helper.rb +0 -3
@@ -0,0 +1,19 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<GetServiceStatusResponse
|
3
|
+
xmlns="https://mws.amazonservices.com/Orders/2011-01-01">
|
4
|
+
<GetServiceStatusResult>
|
5
|
+
<Status>GREEN_I</Status>
|
6
|
+
<Timestamp>2010-09-24T21:38:09.676Z</Timestamp>
|
7
|
+
<MessageId>173964729I</MessageId>
|
8
|
+
<Messages>
|
9
|
+
<Message>
|
10
|
+
<Locale>en_US</Locale>
|
11
|
+
<Text>We are experiencing high latency in UK because of heavy
|
12
|
+
traffic.</Text>
|
13
|
+
</Message>
|
14
|
+
</Messages>
|
15
|
+
</GetServiceStatusResult>
|
16
|
+
<ResponseMetadata>
|
17
|
+
<RequestId>d80c6c7b-f7c7-4fa7-bdd7-854711cb3bcc</RequestId>
|
18
|
+
</ResponseMetadata>
|
19
|
+
</GetServiceStatusResponse>
|
data/test/helper.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'integration_helper'
|
2
|
+
require 'mws/feeds'
|
3
|
+
|
4
|
+
class FeedSubmissionCountTest < IntegrationTest
|
5
|
+
self.api = MWS::Feeds
|
6
|
+
|
7
|
+
def test_gets_feed_submission_count
|
8
|
+
@clients.each do |client|
|
9
|
+
res = client.get_feed_submission_count
|
10
|
+
assert_kind_of Integer, res.count
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'integration_helper'
|
2
|
+
require 'mws/feeds'
|
3
|
+
|
4
|
+
class FeedSubmissionListTest < IntegrationTest
|
5
|
+
self.api = MWS::Feeds
|
6
|
+
|
7
|
+
def test_gets_feed_submission_list
|
8
|
+
@clients.each do |client|
|
9
|
+
feeds = client.get_feed_submission_list
|
10
|
+
refute_empty feeds.to_a
|
11
|
+
more_feeds = client.get_feed_submission_list_by_next_token
|
12
|
+
refute_empty more_feeds.to_a
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'integration_helper'
|
2
|
+
require 'mws/feeds'
|
3
|
+
|
4
|
+
class FeedSubmissionResultTest < IntegrationTest
|
5
|
+
self.api = MWS::Feeds
|
6
|
+
|
7
|
+
def test_gets_feed_submission_result
|
8
|
+
@clients.each do |client|
|
9
|
+
feeds = client.get_feed_submission_list(feed_processing_status_list: '_DONE_', max_count: 1)
|
10
|
+
feed_submission_id = feeds.first.id
|
11
|
+
result = client.get_feed_submission_result(feed_submission_id)
|
12
|
+
refute_empty result.to_s
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'integration_helper'
|
2
|
+
require 'mws/orders'
|
3
|
+
|
4
|
+
class OrderItemsTest < IntegrationTest
|
5
|
+
self.api = MWS::Orders
|
6
|
+
|
7
|
+
def sample_amazon_order_id(client)
|
8
|
+
order = client.list_orders(created_after: Date.today - 365).to_a.sample
|
9
|
+
order.amazon_order_id
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_list_order_items
|
13
|
+
@clients.each do |client|
|
14
|
+
amazon_order_id = sample_amazon_order_id(client)
|
15
|
+
order_items = client.list_order_items(amazon_order_id)
|
16
|
+
refute_empty order_items
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'integration_helper'
|
2
|
+
require 'mws/orders'
|
3
|
+
|
4
|
+
class OrdersTest < IntegrationTest
|
5
|
+
self.api = MWS::Orders
|
6
|
+
|
7
|
+
def test_lists_and_gets_orders
|
8
|
+
@clients.each do |client|
|
9
|
+
amazon_order_ids = []
|
10
|
+
orders = client.list_orders(created_after: Date.today - 365)
|
11
|
+
amazon_order_ids << orders.to_a.sample.amazon_order_id
|
12
|
+
|
13
|
+
orders = client.list_orders_by_next_token
|
14
|
+
amazon_order_ids << orders.to_a.sample.amazon_order_id
|
15
|
+
|
16
|
+
orders = client.get_order(*amazon_order_ids)
|
17
|
+
assert orders
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class IntegrationTest < MiniTest::Test
|
5
|
+
class << self
|
6
|
+
attr_accessor :api
|
7
|
+
end
|
8
|
+
|
9
|
+
def accounts
|
10
|
+
YAML.load_file(File.expand_path('../fixtures/mws.yml', __FILE__))
|
11
|
+
end
|
12
|
+
|
13
|
+
def setup
|
14
|
+
@clients = accounts.map { |mws| self.class.api.const_get(:Client).new(*mws.values) }
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'parser_helper'
|
2
|
+
require 'mws/feeds/parsers/feed'
|
3
|
+
|
4
|
+
class FeedParserTest < ParserTest
|
5
|
+
def setup
|
6
|
+
node = fixture('feeds/feed_submission').xpath('//xmlns:FeedSubmissionInfo').first
|
7
|
+
@feed = MWS::Feeds::Parsers::Feed.new(node)
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_submission
|
11
|
+
assert_kind_of MWS::Feeds::Parsers::FeedSubmission, @feed.submission
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'parser_helper'
|
2
|
+
require 'mws/feeds/parsers/feed_submission'
|
3
|
+
|
4
|
+
class FeedSubmissionParserTest < ParserTest
|
5
|
+
def setup
|
6
|
+
node = fixture('feeds/feed_submission').xpath('//xmlns:FeedSubmissionInfo').first
|
7
|
+
@feed = MWS::Feeds::Parsers::FeedSubmission.new(node)
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_id
|
11
|
+
assert_kind_of String, @feed.id
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_type
|
15
|
+
assert_kind_of String, @feed.type
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_submitted_at
|
19
|
+
assert_kind_of Time, @feed.submitted_at
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_processing_status
|
23
|
+
assert_kind_of String, @feed.processing_status
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'parser_helper'
|
2
|
+
require 'mws/feeds/parsers/feed_submission_count'
|
3
|
+
|
4
|
+
class FeedSubmissionCountParserTest < ParserTest
|
5
|
+
def setup
|
6
|
+
node = fixture('feeds/feed_submission_count').xpath('//xmlns:GetFeedSubmissionCountResult')
|
7
|
+
@feeds = MWS::Feeds::Parsers::FeedSubmissionCount.new(node)
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_feed_submission_count
|
11
|
+
assert_kind_of Integer, @feeds.count
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'parser_helper'
|
2
|
+
require 'mws/feeds/parsers/feed_submission_list'
|
3
|
+
|
4
|
+
class FeedSubmissionListParserTest < ParserTest
|
5
|
+
def setup
|
6
|
+
node = fixture('feeds/feed_submission_list').xpath('//xmlns:GetFeedSubmissionListResult')
|
7
|
+
@feed_submission_list = MWS::Feeds::Parsers::FeedSubmissionList.new(node)
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_has_feed_submission_list
|
11
|
+
refute_empty @feed_submission_list.to_a
|
12
|
+
@feed_submission_list.each { |feed| assert_kind_of MWS::Feeds::Parsers::FeedSubmission, feed }
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'parser_helper'
|
2
|
+
require 'mws/feeds/parsers/feed_submission_result'
|
3
|
+
|
4
|
+
class FeedSubmissionResultParserTest < ParserTest
|
5
|
+
def setup
|
6
|
+
@body = 'foo'
|
7
|
+
@result = MWS::Feeds::Parsers::FeedSubmissionResult.new(@body)
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_content
|
11
|
+
assert_equal @body, @result.to_s
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'parser_helper'
|
2
|
+
require 'mws/feeds/parsers/feed_submissions'
|
3
|
+
|
4
|
+
class FeedSubmissionsParserTest < ParserTest
|
5
|
+
def setup
|
6
|
+
node = fixture('feeds/feed_submissions').xpath('//xmlns:CancelFeedSubmissionsResult')
|
7
|
+
@cancelations = MWS::Feeds::Parsers::FeedSubmissions.new(node)
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_cancelation_count
|
11
|
+
assert_kind_of Integer, @cancelations.count
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_canceled_feed_submissions
|
15
|
+
refute_empty @cancelations.feed_submissions
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'request_helper'
|
2
|
+
require 'mws/feeds/requests/feed'
|
3
|
+
|
4
|
+
class FeedRequestTest < RequestTest
|
5
|
+
def mock_response_body
|
6
|
+
<<-EOF
|
7
|
+
<Response xmlns="ns">
|
8
|
+
<Result>
|
9
|
+
<FeedSubmissionInfo>
|
10
|
+
<FeedSubmissionId>123456</FeedSubmissionId>
|
11
|
+
<FeedType>_POST_PRODUCT_DATA_</FeedType>
|
12
|
+
<SubmittedDate>2009-02-20T02:10:35+00:00</SubmittedDate>
|
13
|
+
<FeedProcessingStatus>_CANCELLED_</FeedProcessingStatus>
|
14
|
+
</FeedSubmissionInfo>
|
15
|
+
</Response>
|
16
|
+
</Result>
|
17
|
+
EOF
|
18
|
+
end
|
19
|
+
|
20
|
+
def setup
|
21
|
+
@feed = MWS::Feeds::Requests::Feed.new(mock_client)
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_submits_flat_file
|
25
|
+
@feed.client.expect(:default_country, 'US')
|
26
|
+
res = @feed.submit('foo', '_POST_FLAT_FILE_DATA_')
|
27
|
+
assert_kind_of MWS::Feeds::Parsers::Feed, res
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_submits_xml
|
31
|
+
@feed.client.expect(:default_country, 'US')
|
32
|
+
xml = '<?xml version="1.0"?><Foo></Foo>'
|
33
|
+
res = @feed.submit(xml, '_POST_XML_DATA_')
|
34
|
+
assert_kind_of MWS::Feeds::Parsers::Feed, res
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_headers_for_latin_flat_file
|
38
|
+
@feed.client.expect(:default_country, 'US')
|
39
|
+
@feed.body = 'foo'
|
40
|
+
@feed.set_content_type
|
41
|
+
assert_equal "text/tab-separated-values; charset=ISO-8859-1", @feed.headers.fetch('Content-Type')
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_headers_for_chinese_flat_file
|
45
|
+
@feed.client.expect(:default_country, 'CN')
|
46
|
+
@feed.body = 'foo'
|
47
|
+
@feed.set_content_type
|
48
|
+
assert_equal 'text/tab-separated-values; charset=UTF-16', @feed.headers.fetch('Content-Type')
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_headers_for_japanese_flat_file
|
52
|
+
@feed.client.expect(:default_country, 'JP')
|
53
|
+
@feed.body = 'foo'
|
54
|
+
@feed.set_content_type
|
55
|
+
assert_equal 'text/tab-separated-values; charset=Shift_JIS', @feed.headers.fetch('Content-Type')
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_headers_for_xml
|
59
|
+
@feed.body = '<?xml version="1.0"?><Foo></Foo>'
|
60
|
+
@feed.set_content_type
|
61
|
+
assert_equal 'text/xml; charset=ISO-8859-1', @feed.headers.fetch('Content-Type')
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'request_helper'
|
2
|
+
require 'mws/feeds/requests/feed_submission_count'
|
3
|
+
|
4
|
+
class FeedSubmissionCountRequestTest < RequestTest
|
5
|
+
def mock_response_body
|
6
|
+
<<-EOF
|
7
|
+
<Response xmlns="ns">
|
8
|
+
<Result>
|
9
|
+
<Count>1</Count>
|
10
|
+
</Response>
|
11
|
+
</Result>
|
12
|
+
EOF
|
13
|
+
end
|
14
|
+
|
15
|
+
def setup
|
16
|
+
@feeds = MWS::Feeds::Requests::FeedSubmissionCount.new(mock_client)
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_gets_feed_submission_count
|
20
|
+
res = @feeds.get(submitted_from_date: 0)
|
21
|
+
assert_equal 1, res.count
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'request_helper'
|
2
|
+
require 'mws/feeds/requests/feed_submission_list'
|
3
|
+
|
4
|
+
class FeedSubmissionListRequestTest < RequestTest
|
5
|
+
def mock_response_body
|
6
|
+
<<-EOF
|
7
|
+
<Response xmlns="ns">
|
8
|
+
<Result>
|
9
|
+
<NextToken>123</NextToken>
|
10
|
+
<FeedSubmissionInfo>
|
11
|
+
<FeedSubmissionId>123456</FeedSubmissionId>
|
12
|
+
<FeedType>_POST_PRODUCT_DATA_</FeedType>
|
13
|
+
<SubmittedDate>2009-02-20T02:10:35+00:00</SubmittedDate>
|
14
|
+
<FeedProcessingStatus>_SUBMITTED_</FeedProcessingStatus>
|
15
|
+
</FeedSubmissionInfo>
|
16
|
+
</Response>
|
17
|
+
</Result>
|
18
|
+
EOF
|
19
|
+
end
|
20
|
+
|
21
|
+
def setup
|
22
|
+
@feeds = MWS::Feeds::Requests::FeedSubmissionList.new(mock_client)
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_gets_feed_submission_list
|
26
|
+
res = @feeds.get(submitted_from_date: 0)
|
27
|
+
assert_kind_of MWS::Feeds::Parsers::FeedSubmissionList, res
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_returns_next_token
|
31
|
+
@feeds.last_response = mock_response
|
32
|
+
assert_equal '123', @feeds.next_token
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_gets_feed_submission_list_by_next_token
|
36
|
+
@feeds.last_response = mock_response
|
37
|
+
res = @feeds.get_by_next_token
|
38
|
+
assert_kind_of MWS::Feeds::Parsers::FeedSubmissionList, res
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'request_helper'
|
2
|
+
require 'mws/feeds/requests/feed_submissions'
|
3
|
+
|
4
|
+
class FeedSubmissionsRequesttTest < RequestTest
|
5
|
+
def mock_response_body
|
6
|
+
<<-EOF
|
7
|
+
<Response xmlns="ns">
|
8
|
+
<Result>
|
9
|
+
<Count>1</Count>
|
10
|
+
<FeedSubmissionInfo>
|
11
|
+
<FeedSubmissionId>123456</FeedSubmissionId>
|
12
|
+
<FeedType>_POST_PRODUCT_DATA_</FeedType>
|
13
|
+
<SubmittedDate>2009-02-20T02:10:35+00:00</SubmittedDate>
|
14
|
+
<FeedProcessingStatus>_CANCELLED_</FeedProcessingStatus>
|
15
|
+
</FeedSubmissionInfo>
|
16
|
+
</Response>
|
17
|
+
</Result>
|
18
|
+
EOF
|
19
|
+
end
|
20
|
+
|
21
|
+
def setup
|
22
|
+
@feeds = MWS::Feeds::Requests::FeedSubmissions.new(mock_client)
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_cancels_feedback_submissions
|
26
|
+
res = @feeds.cancel(submitted_from_date: 0)
|
27
|
+
assert_kind_of MWS::Feeds::Parsers::FeedSubmissions, res
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
require 'parser_helper'
|
2
|
+
require 'mws/orders/parsers/order'
|
3
|
+
|
4
|
+
class OrderParserTest < ParserTest
|
5
|
+
def setup
|
6
|
+
node = fixture('orders/orders').xpath('//xmlns:Order').first
|
7
|
+
@order = MWS::Orders::Parsers::Order.new(node)
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_amazon_order_id
|
11
|
+
assert_kind_of String, @order.amazon_order_id
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_purchase_time
|
15
|
+
assert_kind_of Time, @order.purchased_at
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_last_update_time
|
19
|
+
assert_kind_of Time, @order.last_updated_at
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_status
|
23
|
+
assert_kind_of String, @order.status
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_type
|
27
|
+
assert_kind_of String, @order.type
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_sales_channel
|
31
|
+
assert_kind_of String, @order.sales_channel
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_ship_service_level
|
35
|
+
assert_kind_of String, @order.ship_service_level
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_fulfillment_channel
|
39
|
+
assert_kind_of String, @order.fulfillment_channel
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_total
|
43
|
+
assert_kind_of Money, @order.total
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_shipping_address
|
47
|
+
assert_kind_of MWS::Orders::Parsers::ShippingAddress, @order.shipping_address
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_number_of_items_shipped
|
51
|
+
assert_kind_of Integer, @order.number_of_items_shipped
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_number_of_items_unshipped
|
55
|
+
assert_kind_of Integer, @order.number_of_items_unshipped
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_payment_execution_detail
|
59
|
+
assert_kind_of MWS::Orders::Parsers::PaymentExecutionDetail, @order.payment_execution_detail
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_payment_method
|
63
|
+
assert_kind_of String, @order.payment_method
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_marketplace_id
|
67
|
+
assert_kind_of String, @order.marketplace_id
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_buyer_name
|
71
|
+
assert_kind_of String, @order.buyer_name
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_buyer_email
|
75
|
+
assert_kind_of String, @order.buyer_email
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_shipment_service_level_category
|
79
|
+
assert_kind_of String, @order.shipment_service_level_category
|
80
|
+
end
|
81
|
+
|
82
|
+
def test_no_shipping_adress
|
83
|
+
@order.shipping_address.document.remove
|
84
|
+
assert_nil @order.shipping_address
|
85
|
+
end
|
86
|
+
end
|