peddler 0.6.3 → 0.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +48 -145
- data/lib/mws/feeds/client.rb +7 -1
- data/lib/mws/feeds/parsers/feed.rb +3 -3
- data/lib/mws/feeds/parsers/feed_submission_count.rb +2 -5
- data/lib/mws/feeds/parsers/{feed_submission.rb → feed_submission_info.rb} +1 -1
- data/lib/mws/feeds/parsers/feed_submission_list.rb +6 -3
- data/lib/mws/feeds/parsers/feed_submissions.rb +2 -2
- data/lib/mws/feeds/requests/feed_submission_list.rb +4 -2
- data/lib/mws/orders/client.rb +12 -2
- data/lib/mws/orders/parsers/order_items.rb +3 -0
- data/lib/mws/orders/parsers/orders.rb +6 -3
- data/lib/mws/orders/requests/order_items.rb +4 -2
- data/lib/mws/orders/requests/orders.rb +4 -2
- data/lib/mws/reports/client.rb +243 -0
- data/lib/mws/reports/parsers/report.rb +10 -0
- data/lib/mws/reports/parsers/report_acknowledgements.rb +20 -0
- data/lib/mws/reports/parsers/report_count.rb +10 -0
- data/lib/mws/reports/parsers/report_info.rb +29 -0
- data/lib/mws/reports/parsers/report_list.rb +23 -0
- data/lib/mws/reports/parsers/report_request_count.rb +10 -0
- data/lib/mws/reports/parsers/report_request_info.rb +49 -0
- data/lib/mws/reports/parsers/report_request_list.rb +23 -0
- data/lib/mws/reports/parsers/report_requests.rb +18 -0
- data/lib/mws/reports/parsers/report_schedule.rb +21 -0
- data/lib/mws/reports/parsers/report_schedule_count.rb +10 -0
- data/lib/mws/reports/parsers/report_schedule_list.rb +23 -0
- data/lib/mws/reports/parsers/report_scheduler.rb +19 -0
- data/lib/mws/reports/requests/report.rb +18 -0
- data/lib/mws/reports/requests/report_acknowledgements.rb +27 -0
- data/lib/mws/reports/requests/report_count.rb +20 -0
- data/lib/mws/reports/requests/report_list.rb +30 -0
- data/lib/mws/reports/requests/report_request_count.rb +20 -0
- data/lib/mws/reports/requests/report_request_info.rb +21 -0
- data/lib/mws/reports/requests/report_request_list.rb +30 -0
- data/lib/mws/reports/requests/report_requests.rb +20 -0
- data/lib/mws/reports/requests/report_schedule_count.rb +19 -0
- data/lib/mws/reports/requests/report_schedule_list.rb +23 -0
- data/lib/mws/reports/requests/report_scheduler.rb +29 -0
- data/lib/mws/sellers/client.rb +46 -0
- data/lib/mws/sellers/parsers/marketplace.rb +33 -0
- data/lib/mws/sellers/parsers/marketplace_participations.rb +32 -0
- data/lib/mws/sellers/parsers/participation.rb +21 -0
- data/lib/mws/sellers/parsers/service_status.rb +36 -0
- data/lib/mws/sellers/parsers/service_status_message.rb +17 -0
- data/lib/mws/sellers/requests/marketplace_participations.rb +27 -0
- data/lib/mws/sellers/requests/service_status.rb +15 -0
- data/lib/peddler/parsers/base.rb +2 -2
- data/lib/peddler/parsers/counter.rb +13 -0
- data/lib/peddler/parsers/model.rb +4 -5
- data/lib/peddler/parsers/text.rb +0 -5
- data/lib/peddler/parsers/tokenable.rb +13 -0
- data/lib/peddler/parsers/xml.rb +10 -5
- data/lib/peddler/request/parameters.rb +2 -1
- data/lib/peddler/request/structured_list.rb +5 -0
- data/lib/peddler/request.rb +13 -15
- data/lib/peddler/response/base.rb +0 -0
- data/lib/peddler/response/payload/base.rb +0 -0
- data/lib/peddler/response/payload/csv.rb +0 -0
- data/lib/peddler/response/payload/xml.rb +0 -0
- data/lib/peddler/{response_wrapper.rb → response.rb} +6 -11
- data/lib/peddler/version.rb +1 -1
- data/test/fixtures/mws.yml +4 -0
- data/test/fixtures/reports/report.xml +8 -0
- data/test/fixtures/reports/report_acknowledgements.xml +18 -0
- data/test/fixtures/reports/report_count.xml +9 -0
- data/test/fixtures/reports/report_list.xml +17 -0
- data/test/fixtures/reports/report_request_count.xml +9 -0
- data/test/fixtures/reports/report_request_list.xml +24 -0
- data/test/fixtures/reports/report_requests.xml +19 -0
- data/test/fixtures/reports/report_schedule_count.xml +10 -0
- data/test/fixtures/reports/report_schedule_list.xml +16 -0
- data/test/fixtures/reports/report_scheduler.xml +15 -0
- data/test/fixtures/sellers/market_participations.xml +27 -0
- data/test/fixtures/sellers/service_status.xml +9 -0
- data/test/integration/feeds/test_feed_submission_list.rb +2 -0
- data/test/integration/orders/test_orders.rb +3 -0
- data/test/integration/reports/test_report.rb +15 -0
- data/test/integration/reports/test_report_count.rb +13 -0
- data/test/integration/reports/test_report_list.rb +17 -0
- data/test/integration/reports/test_report_request_count.rb +13 -0
- data/test/integration/reports/test_report_request_list.rb +17 -0
- data/test/integration/reports/test_report_schedule_count.rb +13 -0
- data/test/integration/reports/test_report_schedule_list.rb +13 -0
- data/test/integration/reports/test_report_scheduler.rb +16 -0
- data/test/integration/sellers/test_marketplace_participations.rb +13 -0
- data/test/integration/sellers/test_service_status.rb +12 -0
- data/test/integration_helper.rb +3 -0
- data/test/mws/feeds/parsers/test_feed.rb +2 -2
- data/test/mws/feeds/parsers/{test_feed_submission.rb → test_feed_submission_info.rb} +3 -3
- data/test/mws/feeds/parsers/test_feed_submission_list.rb +5 -1
- data/test/mws/feeds/parsers/test_feed_submission_result.rb +1 -1
- data/test/mws/feeds/requests/test_feed_submission_list.rb +3 -6
- data/test/mws/orders/parsers/test_order_items.rb +4 -0
- data/test/mws/orders/parsers/test_orders.rb +4 -0
- data/test/mws/orders/parsers/test_service_status.rb +1 -1
- data/test/mws/orders/requests/test_order_items.rb +3 -6
- data/test/mws/orders/requests/test_orders.rb +3 -6
- data/test/mws/reports/parsers/test_report_acknowledgments.rb +14 -0
- data/test/mws/reports/parsers/test_report_count.rb +13 -0
- data/test/mws/reports/parsers/test_report_info.rb +29 -0
- data/test/mws/reports/parsers/test_report_list.rb +18 -0
- data/test/mws/reports/parsers/test_report_request_count.rb +13 -0
- data/test/mws/reports/parsers/test_report_request_info.rb +49 -0
- data/test/mws/reports/parsers/test_report_request_list.rb +18 -0
- data/test/mws/reports/parsers/test_report_requests.rb +17 -0
- data/test/mws/reports/parsers/test_report_schedule_count.rb +13 -0
- data/test/mws/reports/parsers/test_report_schedule_list.rb +18 -0
- data/test/mws/reports/parsers/test_report_scheduler.rb +17 -0
- data/test/mws/reports/requests/test_acknowledgements.rb +36 -0
- data/test/mws/reports/requests/test_report_count.rb +23 -0
- data/test/mws/reports/requests/test_report_info.rb +29 -0
- data/test/mws/reports/requests/test_report_list.rb +39 -0
- data/test/mws/reports/requests/test_report_request_count.rb +23 -0
- data/test/mws/reports/requests/test_report_request_list.rb +44 -0
- data/test/mws/reports/requests/test_report_requests.rb +29 -0
- data/test/mws/reports/requests/test_report_schedule_count.rb +22 -0
- data/test/mws/reports/requests/test_report_schedule_list.rb +36 -0
- data/test/mws/reports/requests/test_report_scheduler.rb +33 -0
- data/test/mws/sellers/parsers/test_market_participations.rb +19 -0
- data/test/mws/sellers/parsers/test_service_status.rb +35 -0
- data/test/mws/sellers/requests/test_marketplace_participation_list.rb +39 -0
- data/test/mws/sellers/requests/test_service_status.rb +25 -0
- data/test/peddler/parsers/test_model.rb +36 -0
- data/test/request_helper.rb +1 -1
- metadata +171 -42
- data/test/peddler/test_request.rb +0 -18
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'parser_helper'
|
2
|
+
require 'mws/reports/parsers/report_requests'
|
3
|
+
|
4
|
+
class ReportRequestsParserTest < ParserTest
|
5
|
+
def setup
|
6
|
+
node = fixture('reports/report_requests').xpath('//xmlns:CancelReportRequestsResult')
|
7
|
+
@cancelations = MWS::Reports::Parsers::ReportRequests.new(node)
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_cancelation_count
|
11
|
+
assert_kind_of Integer, @cancelations.count
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_canceled_report_request_infos
|
15
|
+
refute_empty @cancelations.report_request_infos
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'parser_helper'
|
2
|
+
require 'mws/reports/parsers/report_schedule_count'
|
3
|
+
|
4
|
+
class ReportScheduleCountParserTest < ParserTest
|
5
|
+
def setup
|
6
|
+
node = fixture('reports/report_schedule_count').xpath('//xmlns:GetReportScheduleCountResult')
|
7
|
+
@counter = MWS::Reports::Parsers::ReportScheduleCount.new(node)
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_report_schedule_count
|
11
|
+
assert_kind_of Integer, @counter.to_i
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'parser_helper'
|
2
|
+
require 'mws/reports/parsers/report_schedule_list'
|
3
|
+
|
4
|
+
class ReportScheduleListParserTest < ParserTest
|
5
|
+
def setup
|
6
|
+
node = fixture('reports/report_schedule_list').xpath('//xmlns:GetReportScheduleListResult')
|
7
|
+
@list = MWS::Reports::Parsers::ReportScheduleList.new(node)
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_has_report_schedules
|
11
|
+
refute_empty @list.to_a
|
12
|
+
@list.each { |rs| assert_kind_of MWS::Reports::Parsers::ReportSchedule, rs }
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_has_token
|
16
|
+
assert @list.has_next_token?
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'parser_helper'
|
2
|
+
require 'mws/reports/parsers/report_scheduler'
|
3
|
+
|
4
|
+
class ReportSchedulerParserTest < ParserTest
|
5
|
+
def setup
|
6
|
+
node = fixture('reports/report_scheduler').xpath('//xmlns:ManageReportScheduleResult')
|
7
|
+
@scheduler = MWS::Reports::Parsers::ReportScheduler.new(node)
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_has_count
|
11
|
+
assert_kind_of Integer, @scheduler.count
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_has_report_schedule
|
15
|
+
assert_kind_of MWS::Reports::Parsers::ReportSchedule, @scheduler.report_schedule
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'request_helper'
|
2
|
+
require 'mws/reports/requests/report_acknowledgements'
|
3
|
+
|
4
|
+
class ReportAcknowledgementsTest < RequestTest
|
5
|
+
def mock_response_body
|
6
|
+
<<-EOF
|
7
|
+
<Response xmlns="ns">
|
8
|
+
<Result>
|
9
|
+
<Count>1</Count>
|
10
|
+
<ReportInfo>
|
11
|
+
<ReportId>841997483</ReportId>
|
12
|
+
<ReportType>_GET_MERCHANT_LISTINGS_DATA_</ReportType>
|
13
|
+
<ReportRequestId>2234038326</ReportRequestId>
|
14
|
+
<AvailableDate>2009-01-06T03:48:36+00:00</AvailableDate>
|
15
|
+
<Acknowledged>true</Acknowledged>
|
16
|
+
<AcknowledgedDate>2009-02-20T02:10:41+00:00</AcknowledgedDate>
|
17
|
+
</ReportInfo>
|
18
|
+
</Response>
|
19
|
+
</Result>
|
20
|
+
EOF
|
21
|
+
end
|
22
|
+
|
23
|
+
def setup
|
24
|
+
@report = MWS::Reports::Requests::ReportAcknowledgements.new(mock_client)
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_acknowledges_reports
|
28
|
+
res = @report.acknowledge('123')
|
29
|
+
refute_empty res
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_unacknowledges_reports
|
33
|
+
res = @report.unacknowledge('123')
|
34
|
+
refute_empty res
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'request_helper'
|
2
|
+
require 'mws/reports/requests/report_count'
|
3
|
+
|
4
|
+
class ReportCountRequestTest < 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
|
+
@count = MWS::Reports::Requests::ReportCount.new(mock_client)
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_gets_report_count
|
20
|
+
res = @count.get
|
21
|
+
assert_equal 1, res.count
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'request_helper'
|
2
|
+
require 'mws/reports/requests/report_request_info'
|
3
|
+
|
4
|
+
class ReportRequestInfoTest < RequestTest
|
5
|
+
def mock_response_body
|
6
|
+
<<-EOF
|
7
|
+
<Result xmlns="ns">
|
8
|
+
<ReportRequestInfo>
|
9
|
+
<ReportRequestId>2291326454</ReportRequestId>
|
10
|
+
<ReportType>_GET_MERCHANT_LISTINGS_DATA_</ReportType>
|
11
|
+
<StartDate>2009-01-21T02:10:39+00:00</StartDate>
|
12
|
+
<EndDate>2009-02-13T02:10:39+00:00</EndDate>
|
13
|
+
<Scheduled>false</Scheduled>
|
14
|
+
<SubmittedDate>2009-02-20T02:10:39+00:00</SubmittedDate>
|
15
|
+
<ReportProcessingStatus>_SUBMITTED_</ReportProcessingStatus>
|
16
|
+
</ReportRequestInfo>
|
17
|
+
</Result>
|
18
|
+
EOF
|
19
|
+
end
|
20
|
+
|
21
|
+
def setup
|
22
|
+
@report = MWS::Reports::Requests::ReportRequestInfo.new(mock_client)
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_requests_report
|
26
|
+
res = @report.request('_GET_FLAT_FILE_OPEN_LISTINGS_DATA_')
|
27
|
+
assert_kind_of MWS::Reports::Parsers::ReportRequestInfo, res
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'request_helper'
|
2
|
+
require 'mws/reports/requests/report_list'
|
3
|
+
|
4
|
+
class ReportListRequestTest < RequestTest
|
5
|
+
def mock_response_body
|
6
|
+
<<-EOF
|
7
|
+
<Response xmlns="ns">
|
8
|
+
<Result>
|
9
|
+
<NextToken>2YgYW55IPQhvu5hbCBwbGVhc3VyZS4=</NextToken>
|
10
|
+
<HasNext>true</HasNext>
|
11
|
+
<ReportInfo>
|
12
|
+
<ReportId>898899473</ReportId>
|
13
|
+
<ReportType>_GET_MERCHANT_LISTINGS_DATA_</ReportType>
|
14
|
+
<ReportRequestId>2278662938</ReportRequestId>
|
15
|
+
<AvailableDate>2009-02-10T09:22:33+00:00</AvailableDate>
|
16
|
+
<Acknowledged>false</Acknowledged>
|
17
|
+
</ReportInfo>
|
18
|
+
</Result>
|
19
|
+
</Response>
|
20
|
+
EOF
|
21
|
+
end
|
22
|
+
|
23
|
+
def setup
|
24
|
+
@reports = MWS::Reports::Requests::ReportList.new(mock_client)
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_gets_report_list
|
28
|
+
res = @reports.get
|
29
|
+
assert_kind_of MWS::Reports::Parsers::ReportList, res
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_gets_report_list_by_next_token
|
33
|
+
mock_parsed_response = MiniTest::Mock.new
|
34
|
+
mock_parsed_response.expect(:next_token, '123')
|
35
|
+
@reports.last_parsed_response = mock_parsed_response
|
36
|
+
res = @reports.get_by_next_token
|
37
|
+
assert_kind_of MWS::Reports::Parsers::ReportList, res
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'request_helper'
|
2
|
+
require 'mws/reports/requests/report_request_count'
|
3
|
+
|
4
|
+
class ReportRequestCountRequestTest < RequestTest
|
5
|
+
def mock_response_body
|
6
|
+
<<-EOF
|
7
|
+
<Response xmlns="ns">
|
8
|
+
<Result>
|
9
|
+
<Count>1</Count>
|
10
|
+
</Result>
|
11
|
+
</Response>
|
12
|
+
EOF
|
13
|
+
end
|
14
|
+
|
15
|
+
def setup
|
16
|
+
@count = MWS::Reports::Requests::ReportRequestCount.new(mock_client)
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_gets_report_request_count
|
20
|
+
res = @count.get(submitted_from_date: 0)
|
21
|
+
assert_equal 1, res.count
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'request_helper'
|
2
|
+
require 'mws/reports/requests/report_request_list'
|
3
|
+
|
4
|
+
class ReportRequestListRequestTest < RequestTest
|
5
|
+
def mock_response_body
|
6
|
+
<<-EOF
|
7
|
+
<Response xmlns="ns">
|
8
|
+
<Result>
|
9
|
+
<NextToken>123</NextToken>
|
10
|
+
<ReportRequestInfo>
|
11
|
+
<ReportRequestId>2291326454</ReportRequestId>
|
12
|
+
<ReportType>_GET_MERCHANT_LISTINGS_DATA_</ReportType>
|
13
|
+
<StartDate>2011-01-21T02:10:39+00:00</StartDate>
|
14
|
+
<EndDate>2011-02-13T02:10:39+00:00</EndDate>
|
15
|
+
<Scheduled>false</Scheduled>
|
16
|
+
<SubmittedDate>2011-02-17T23:44:09+00:00</SubmittedDate>
|
17
|
+
<ReportProcessingStatus>_DONE_</ReportProcessingStatus>
|
18
|
+
<GeneratedReportId>3538561173</GeneratedReportId>
|
19
|
+
<StartedProcessingDate>2011-02-17T23:44:43+00:00
|
20
|
+
</StartedProcessingDate>
|
21
|
+
<CompletedDate>2011-02-17T23:44:48+00:00</CompletedDate>
|
22
|
+
</ReportRequestInfo>
|
23
|
+
</Result>
|
24
|
+
</Response>
|
25
|
+
EOF
|
26
|
+
end
|
27
|
+
|
28
|
+
def setup
|
29
|
+
@requests = MWS::Reports::Requests::ReportRequestList.new(mock_client)
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_gets_report_request_list
|
33
|
+
res = @requests.get(submitted_from_date: 0)
|
34
|
+
assert_kind_of MWS::Reports::Parsers::ReportRequestList, res
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_gets_report_request_list_by_next_token
|
38
|
+
mock_parsed_response = MiniTest::Mock.new
|
39
|
+
mock_parsed_response.expect(:next_token, '123')
|
40
|
+
@requests.last_parsed_response = mock_parsed_response
|
41
|
+
res = @requests.get_by_next_token
|
42
|
+
assert_kind_of MWS::Reports::Parsers::ReportRequestList, res
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'request_helper'
|
2
|
+
require 'mws/reports/requests/report_requests'
|
3
|
+
|
4
|
+
class ReportRequestsRequesttTest < RequestTest
|
5
|
+
def mock_response_body
|
6
|
+
<<-EOF
|
7
|
+
<Response xmlns="ns">
|
8
|
+
<Result>
|
9
|
+
<Count>1</Count>
|
10
|
+
<ReportRequestInfo>
|
11
|
+
<ReportRequestId>123456</ReportRequestId>
|
12
|
+
<FeedType>_POST_PRODUCT_DATA_</FeedType>
|
13
|
+
<SubmittedDate>2009-02-20T02:10:35+00:00</SubmittedDate>
|
14
|
+
<FeedProcessingStatus>_CANCELLED_</FeedProcessingStatus>
|
15
|
+
</ReportRequestInfo>
|
16
|
+
</Result>
|
17
|
+
</Response>
|
18
|
+
EOF
|
19
|
+
end
|
20
|
+
|
21
|
+
def setup
|
22
|
+
@reports = MWS::Reports::Requests::ReportRequests.new(mock_client)
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_cancels_feedback_submissions
|
26
|
+
res = @reports.cancel(submitted_from_date: 0)
|
27
|
+
assert_kind_of MWS::Reports::Parsers::ReportRequests, res
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'request_helper'
|
2
|
+
require 'mws/reports/requests/report_schedule_count'
|
3
|
+
|
4
|
+
class ReportScheduleCountRequestTest < RequestTest
|
5
|
+
def mock_response_body
|
6
|
+
<<-EOF
|
7
|
+
<Response xmlns="ns">
|
8
|
+
<Result>
|
9
|
+
<Count>1</Count>
|
10
|
+
</Result>
|
11
|
+
</Response>
|
12
|
+
EOF
|
13
|
+
end
|
14
|
+
|
15
|
+
def setup
|
16
|
+
@count = MWS::Reports::Requests::ReportScheduleCount.new(mock_client)
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_gets_report_schedule_count
|
20
|
+
assert_equal 1, @count.get.to_i
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'request_helper'
|
2
|
+
require 'mws/reports/requests/report_schedule_list'
|
3
|
+
|
4
|
+
class ReportScheduleListRequestTest < RequestTest
|
5
|
+
def mock_response_body
|
6
|
+
<<-EOF
|
7
|
+
<Response xmlns="ns">
|
8
|
+
<Result>
|
9
|
+
<NextToken></NextToken>
|
10
|
+
<HasNext>false</HasNext>
|
11
|
+
<ReportRequestInfo>
|
12
|
+
<ReportSchedule>
|
13
|
+
<ReportType>_GET_ORDERS_DATA_</ReportType>
|
14
|
+
<Schedule>_30_DAYS_</Schedule>
|
15
|
+
<ScheduledDate>2009-02-20T02:10:42+00:00</ScheduledDate>
|
16
|
+
</ReportSchedule>
|
17
|
+
</Result>
|
18
|
+
</Response>
|
19
|
+
EOF
|
20
|
+
end
|
21
|
+
|
22
|
+
def setup
|
23
|
+
@list = MWS::Reports::Requests::ReportScheduleList.new(mock_client)
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_gets_report_request_list
|
27
|
+
res = @list.get
|
28
|
+
assert_kind_of MWS::Reports::Parsers::ReportScheduleList, res
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_gets_report_request_list_by_next_token
|
32
|
+
assert_raises(NotImplementedError) {
|
33
|
+
@list.get_by_next_token
|
34
|
+
}
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'request_helper'
|
2
|
+
require 'mws/reports/requests/report_scheduler'
|
3
|
+
|
4
|
+
class ReportSchedulerRequestTest < RequestTest
|
5
|
+
def mock_response_body
|
6
|
+
<<-EOF
|
7
|
+
<Response xmlns="ns">
|
8
|
+
<Result>
|
9
|
+
<Count>1</Count>
|
10
|
+
<ReportSchedule>
|
11
|
+
<ReportType>_GET_ORDERS_DATA_</ReportType>
|
12
|
+
<Schedule>_30_DAYS_</Schedule>
|
13
|
+
<ScheduledDate>2009-02-20T02:10:42+00:00</ScheduledDate>
|
14
|
+
</ReportSchedule>
|
15
|
+
</Response>
|
16
|
+
</Result>
|
17
|
+
EOF
|
18
|
+
end
|
19
|
+
|
20
|
+
def setup
|
21
|
+
@scheduler = MWS::Reports::Requests::ReportScheduler.new(mock_client)
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_manages_report_schedule
|
25
|
+
res = @scheduler.manage('_GET_ORDERS_DATA_', '_1_HOUR_')
|
26
|
+
assert_kind_of MWS::Reports::Parsers::ReportScheduler, res
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_deletes_report_schedule
|
30
|
+
res = @scheduler.delete('_GET_ORDERS_DATA_')
|
31
|
+
assert_kind_of MWS::Reports::Parsers::ReportScheduler, res
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'parser_helper'
|
2
|
+
require 'mws/sellers/parsers/marketplace_participations'
|
3
|
+
|
4
|
+
class SellerMarketParticipationsParserTest < ParserTest
|
5
|
+
def setup
|
6
|
+
node = fixture('sellers/market_participations').xpath('//xmlns:ListMarketplaceParticipationsResult')
|
7
|
+
@mp = MWS::Sellers::Parsers::MarketplaceParticipations.new(node)
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_has_marketplaces
|
11
|
+
refute_empty @mp.marketplaces
|
12
|
+
@mp.marketplaces.each { |marketplace| assert_kind_of MWS::Sellers::Parsers::Marketplace, marketplace }
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_has_participations
|
16
|
+
refute_empty @mp.participations
|
17
|
+
@mp.participations.each { |participation| assert_kind_of MWS::Sellers::Parsers::Participation, participation }
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'parser_helper'
|
2
|
+
require 'mws/sellers/parsers/service_status'
|
3
|
+
|
4
|
+
class SellersServiceStatusParserTest < ParserTest
|
5
|
+
def setup
|
6
|
+
node = fixture('sellers/service_status').xpath('//xmlns:GetServiceStatusResult').first
|
7
|
+
@service_status = MWS::Sellers::Parsers::ServiceStatus.new(node)
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_status
|
11
|
+
assert_kind_of String, @service_status.status
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_timestamp
|
15
|
+
assert_kind_of Time, @service_status.timestamp
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_messages
|
19
|
+
assert_kind_of Array, @service_status.messages
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_ok?
|
23
|
+
@service_status.stub(:status, 'GREEN') do
|
24
|
+
assert @service_status.ok?
|
25
|
+
end
|
26
|
+
|
27
|
+
@service_status.stub(:status, 'RED') do
|
28
|
+
refute @service_status.ok?
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_inspect
|
33
|
+
assert_equal @service_status.status, @service_status.to_s
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'request_helper'
|
2
|
+
require 'mws/sellers/requests/marketplace_participations'
|
3
|
+
|
4
|
+
class MarketplaceParticipationsRequestTest < RequestTest
|
5
|
+
def mock_response_body
|
6
|
+
<<-EOF
|
7
|
+
<Response xmlns="ns">
|
8
|
+
<Result>
|
9
|
+
<NextToken>MRgZW55IGNhcm5hbCBwbGVhc3VyZS6=</NextToken>
|
10
|
+
<ListParticipations>
|
11
|
+
<Participation>
|
12
|
+
</Participation>
|
13
|
+
</ListParticipations>
|
14
|
+
<ListMarketplaces>
|
15
|
+
<Marketplace>
|
16
|
+
</Marketplace>
|
17
|
+
</ListMarketplaces>
|
18
|
+
</Result>
|
19
|
+
</Response>
|
20
|
+
EOF
|
21
|
+
end
|
22
|
+
|
23
|
+
def setup
|
24
|
+
@mp = MWS::Sellers::Requests::MarketplaceParticipations.new(mock_client)
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_lists_marketplace_participations
|
28
|
+
res = @mp.list
|
29
|
+
assert_kind_of MWS::Sellers::Parsers::MarketplaceParticipations, res
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_gets_report_list_by_next_token
|
33
|
+
mock_parsed_response = MiniTest::Mock.new
|
34
|
+
mock_parsed_response.expect(:next_token, '123')
|
35
|
+
@mp.last_parsed_response = mock_parsed_response
|
36
|
+
res = @mp.list_by_next_token
|
37
|
+
assert_kind_of MWS::Sellers::Parsers::MarketplaceParticipations, res
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'request_helper'
|
2
|
+
require 'mws/sellers/requests/service_status'
|
3
|
+
|
4
|
+
class MWSSellersServiceStatusRequestTest < RequestTest
|
5
|
+
def mock_response_body
|
6
|
+
<<-EOF
|
7
|
+
<Response xmlns="ns">
|
8
|
+
<Result>
|
9
|
+
<GetServiceStatusResult>
|
10
|
+
<Status>GREEN</Status>
|
11
|
+
</GetServiceStatusResult>
|
12
|
+
</Result>
|
13
|
+
</Response>
|
14
|
+
EOF
|
15
|
+
end
|
16
|
+
|
17
|
+
def setup
|
18
|
+
@status = MWS::Sellers::Requests::ServiceStatus.new(mock_client)
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_gets_status
|
22
|
+
res = @status.get
|
23
|
+
assert_kind_of MWS::Sellers::Parsers::ServiceStatus, res
|
24
|
+
end
|
25
|
+
end
|
@@ -31,4 +31,40 @@ class PeddlerModelParserTest < MiniTest::Test
|
|
31
31
|
money = model.money_at_xpath('Price')
|
32
32
|
assert_equal '¥1,000', money.format
|
33
33
|
end
|
34
|
+
|
35
|
+
def test_parses_truthy_value
|
36
|
+
xml = <<-EOF
|
37
|
+
<Bool xmlns="example">
|
38
|
+
true
|
39
|
+
</Bool>
|
40
|
+
EOF
|
41
|
+
model = build(xml)
|
42
|
+
assert_equal true, model.boolean_at_xpath('Bool')
|
43
|
+
|
44
|
+
xml = <<-EOF
|
45
|
+
<Bool xmlns="example">
|
46
|
+
Yes
|
47
|
+
</Bool>
|
48
|
+
EOF
|
49
|
+
model = build(xml)
|
50
|
+
assert_equal true, model.boolean_at_xpath('Bool')
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_parses_falsy_value
|
54
|
+
xml = <<-EOF
|
55
|
+
<Bool xmlns="example>
|
56
|
+
false
|
57
|
+
</Bool>
|
58
|
+
EOF
|
59
|
+
model = build(xml)
|
60
|
+
assert_equal false, model.boolean_at_xpath('Bool')
|
61
|
+
|
62
|
+
xml = <<-EOF
|
63
|
+
<Bool xmlns="example>
|
64
|
+
No
|
65
|
+
</Bool>
|
66
|
+
EOF
|
67
|
+
model = build(xml)
|
68
|
+
assert_equal false, model.boolean_at_xpath('Bool')
|
69
|
+
end
|
34
70
|
end
|