peddler 0.6.5 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.md +62 -81
- data/lib/mws/cart_information.rb +13 -0
- data/lib/mws/customer_information.rb +16 -0
- data/lib/mws/feeds.rb +110 -1
- data/lib/mws/fulfillment_inbound_shipment.rb +13 -1
- data/lib/mws/fulfillment_inventory.rb +15 -1
- data/lib/mws/fulfillment_outbound_shipment.rb +17 -1
- data/lib/mws/off_amazon_payments.rb +15 -1
- data/lib/mws/orders.rb +100 -1
- data/lib/mws/products.rb +238 -1
- data/lib/mws/recommendations.rb +13 -1
- data/lib/mws/reports.rb +221 -1
- data/lib/mws/sellers.rb +40 -1
- data/lib/mws/subscriptions.rb +175 -1
- data/lib/peddler/client.rb +77 -37
- data/lib/peddler/csv_parser.rb +42 -0
- data/lib/peddler/operation.rb +44 -0
- data/lib/peddler/parser.rb +21 -0
- data/lib/peddler/structured_list.rb +22 -0
- data/lib/peddler/version.rb +1 -1
- data/lib/peddler/xml_parser.rb +25 -0
- data/lib/peddler.rb +2 -0
- data/test/helper.rb +1 -1
- data/test/integration/test_feeds.rb +18 -0
- data/test/integration/test_orders.rb +22 -0
- data/test/integration/test_products.rb +53 -0
- data/test/integration/test_reports.rb +47 -0
- data/test/integration/test_sellers.rb +18 -0
- data/test/integration/test_subscriptions.rb +26 -0
- data/test/integration_helper.rb +41 -8
- data/test/mws.yml +32 -0
- data/test/mws.yml.example +4 -0
- data/test/unit/peddler/test_client.rb +97 -0
- data/test/unit/peddler/test_csv_parser.rb +24 -0
- data/test/unit/peddler/test_operation.rb +34 -0
- data/test/{peddler/request → unit/peddler}/test_structured_list.rb +5 -5
- data/test/unit/peddler/test_xml_parser.rb +19 -0
- data/test/{test_peddler.rb → unit/test_peddler.rb} +2 -2
- data/test/vcr_cassettes/Feeds.yml +695 -0
- data/test/vcr_cassettes/Orders.yml +29855 -0
- data/test/vcr_cassettes/Products.yml +8597 -0
- data/test/vcr_cassettes/Reports.yml +1881 -0
- data/test/vcr_cassettes/Sellers.yml +697 -0
- data/test/vcr_cassettes/Subscriptions.yml +1369 -0
- metadata +91 -297
- data/lib/mws/feeds/client.rb +0 -116
- data/lib/mws/feeds/parsers/feed.rb +0 -14
- data/lib/mws/feeds/parsers/feed_submission_count.rb +0 -10
- data/lib/mws/feeds/parsers/feed_submission_info.rb +0 -25
- data/lib/mws/feeds/parsers/feed_submission_list.rb +0 -23
- data/lib/mws/feeds/parsers/feed_submission_result.rb +0 -10
- data/lib/mws/feeds/parsers/feed_submissions.rb +0 -18
- data/lib/mws/feeds/requests/feed.rb +0 -38
- data/lib/mws/feeds/requests/feed_submission_count.rb +0 -20
- data/lib/mws/feeds/requests/feed_submission_list.rb +0 -30
- data/lib/mws/feeds/requests/feed_submission_result.rb +0 -18
- data/lib/mws/feeds/requests/feed_submissions.rb +0 -20
- data/lib/mws/fulfillment_inbound_shipment/client.rb +0 -7
- data/lib/mws/fulfillment_inventory/client.rb +0 -7
- data/lib/mws/fulfillment_outbound_shipment/client.rb +0 -7
- data/lib/mws/off_amazon_payments/client.rb +0 -7
- data/lib/mws/orders/client.rb +0 -98
- data/lib/mws/orders/parsers/invoice_data.rb +0 -25
- data/lib/mws/orders/parsers/order.rb +0 -113
- data/lib/mws/orders/parsers/order_item.rb +0 -110
- data/lib/mws/orders/parsers/order_items.rb +0 -23
- data/lib/mws/orders/parsers/orders.rb +0 -23
- data/lib/mws/orders/parsers/payment_execution_detail.rb +0 -20
- data/lib/mws/orders/parsers/payment_execution_detail_item.rb +0 -17
- data/lib/mws/orders/parsers/service_status.rb +0 -36
- data/lib/mws/orders/parsers/service_status_message.rb +0 -17
- data/lib/mws/orders/parsers/shipping_address.rb +0 -37
- data/lib/mws/orders/requests/order_items.rb +0 -28
- data/lib/mws/orders/requests/orders.rb +0 -41
- data/lib/mws/orders/requests/service_status.rb +0 -15
- data/lib/mws/products/client.rb +0 -7
- data/lib/mws/recommendations/client.rb +0 -7
- data/lib/mws/reports/client.rb +0 -249
- data/lib/mws/reports/parsers/report.rb +0 -10
- data/lib/mws/reports/parsers/report_acknowledgements.rb +0 -20
- data/lib/mws/reports/parsers/report_count.rb +0 -10
- data/lib/mws/reports/parsers/report_info.rb +0 -29
- data/lib/mws/reports/parsers/report_list.rb +0 -23
- data/lib/mws/reports/parsers/report_request.rb +0 -14
- data/lib/mws/reports/parsers/report_request_count.rb +0 -10
- data/lib/mws/reports/parsers/report_request_info.rb +0 -49
- data/lib/mws/reports/parsers/report_request_list.rb +0 -23
- data/lib/mws/reports/parsers/report_requests.rb +0 -18
- data/lib/mws/reports/parsers/report_schedule.rb +0 -21
- data/lib/mws/reports/parsers/report_schedule_count.rb +0 -10
- data/lib/mws/reports/parsers/report_schedule_list.rb +0 -23
- data/lib/mws/reports/parsers/report_scheduler.rb +0 -19
- data/lib/mws/reports/requests/report.rb +0 -18
- data/lib/mws/reports/requests/report_acknowledgements.rb +0 -27
- data/lib/mws/reports/requests/report_count.rb +0 -20
- data/lib/mws/reports/requests/report_list.rb +0 -30
- data/lib/mws/reports/requests/report_request.rb +0 -21
- data/lib/mws/reports/requests/report_request_count.rb +0 -20
- data/lib/mws/reports/requests/report_request_list.rb +0 -30
- data/lib/mws/reports/requests/report_requests.rb +0 -20
- data/lib/mws/reports/requests/report_schedule_count.rb +0 -19
- data/lib/mws/reports/requests/report_schedule_list.rb +0 -23
- data/lib/mws/reports/requests/report_scheduler.rb +0 -29
- data/lib/mws/sellers/client.rb +0 -53
- data/lib/mws/sellers/parsers/marketplace.rb +0 -33
- data/lib/mws/sellers/parsers/marketplace_participations.rb +0 -32
- data/lib/mws/sellers/parsers/participation.rb +0 -21
- data/lib/mws/sellers/parsers/service_status.rb +0 -36
- data/lib/mws/sellers/parsers/service_status_message.rb +0 -17
- data/lib/mws/sellers/requests/marketplace_participations.rb +0 -27
- data/lib/mws/sellers/requests/service_status.rb +0 -15
- data/lib/mws/subscriptions/client.rb +0 -7
- data/lib/peddler/parsers/base.rb +0 -15
- data/lib/peddler/parsers/collection.rb +0 -23
- data/lib/peddler/parsers/counter.rb +0 -13
- data/lib/peddler/parsers/model.rb +0 -42
- data/lib/peddler/parsers/text.rb +0 -8
- data/lib/peddler/parsers/tokenable.rb +0 -13
- data/lib/peddler/parsers/xml.rb +0 -30
- data/lib/peddler/request/parameters.rb +0 -57
- data/lib/peddler/request/structured_list.rb +0 -48
- data/lib/peddler/request.rb +0 -52
- 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.rb +0 -27
- data/test/fixtures/feeds/feed_submission.xml +0 -14
- data/test/fixtures/feeds/feed_submission_count.xml +0 -9
- data/test/fixtures/feeds/feed_submission_list.xml +0 -17
- data/test/fixtures/feeds/feed_submissions.xml +0 -15
- data/test/fixtures/mws.yml +0 -12
- data/test/fixtures/mws.yml.example +0 -4
- data/test/fixtures/orders/order_items.xml +0 -83
- data/test/fixtures/orders/orders.xml +0 -109
- data/test/fixtures/orders/service_status.xml +0 -19
- data/test/fixtures/reports/report.xml +0 -8
- data/test/fixtures/reports/report_acknowledgements.xml +0 -18
- data/test/fixtures/reports/report_count.xml +0 -9
- data/test/fixtures/reports/report_list.xml +0 -17
- data/test/fixtures/reports/report_request_count.xml +0 -9
- data/test/fixtures/reports/report_request_list.xml +0 -24
- data/test/fixtures/reports/report_requests.xml +0 -19
- data/test/fixtures/reports/report_schedule_count.xml +0 -10
- data/test/fixtures/reports/report_schedule_list.xml +0 -16
- data/test/fixtures/reports/report_scheduler.xml +0 -15
- data/test/fixtures/sellers/market_participations.xml +0 -27
- data/test/fixtures/sellers/service_status.xml +0 -9
- data/test/integration/feeds/test_feed_submission_count.rb +0 -13
- data/test/integration/feeds/test_feed_submission_list.rb +0 -17
- data/test/integration/feeds/test_feed_submission_result.rb +0 -15
- data/test/integration/orders/test_order_items.rb +0 -19
- data/test/integration/orders/test_orders.rb +0 -23
- data/test/integration/orders/test_service_status.rb +0 -12
- data/test/integration/reports/test_report.rb +0 -15
- data/test/integration/reports/test_report_count.rb +0 -13
- data/test/integration/reports/test_report_list.rb +0 -17
- data/test/integration/reports/test_report_request_count.rb +0 -13
- data/test/integration/reports/test_report_request_list.rb +0 -17
- data/test/integration/reports/test_report_schedule_count.rb +0 -13
- data/test/integration/reports/test_report_schedule_list.rb +0 -13
- data/test/integration/reports/test_report_scheduler.rb +0 -16
- data/test/integration/sellers/test_marketplace_participations.rb +0 -13
- data/test/integration/sellers/test_service_status.rb +0 -12
- data/test/mws/feeds/parsers/test_feed.rb +0 -13
- data/test/mws/feeds/parsers/test_feed_submission_count.rb +0 -13
- data/test/mws/feeds/parsers/test_feed_submission_info.rb +0 -25
- data/test/mws/feeds/parsers/test_feed_submission_list.rb +0 -18
- data/test/mws/feeds/parsers/test_feed_submission_result.rb +0 -13
- data/test/mws/feeds/parsers/test_feed_submissions.rb +0 -17
- data/test/mws/feeds/requests/test_feed.rb +0 -63
- data/test/mws/feeds/requests/test_feed_submission_count.rb +0 -23
- data/test/mws/feeds/requests/test_feed_submission_list.rb +0 -37
- data/test/mws/feeds/requests/test_feed_submissions.rb +0 -29
- data/test/mws/orders/parsers/test_order.rb +0 -86
- data/test/mws/orders/parsers/test_order_item.rb +0 -69
- data/test/mws/orders/parsers/test_order_items.rb +0 -18
- data/test/mws/orders/parsers/test_orders.rb +0 -18
- data/test/mws/orders/parsers/test_payment_execution_detail.rb +0 -14
- data/test/mws/orders/parsers/test_payment_execution_detail_item.rb +0 -17
- data/test/mws/orders/parsers/test_service_status.rb +0 -39
- data/test/mws/orders/parsers/test_service_status_message.rb +0 -17
- data/test/mws/orders/parsers/test_shipping_address.rb +0 -36
- data/test/mws/orders/requests/test_order_items.rb +0 -36
- data/test/mws/orders/requests/test_orders.rb +0 -46
- data/test/mws/orders/requests/test_service_status.rb +0 -25
- data/test/mws/reports/parsers/test_report_acknowledgments.rb +0 -14
- data/test/mws/reports/parsers/test_report_count.rb +0 -13
- data/test/mws/reports/parsers/test_report_info.rb +0 -29
- data/test/mws/reports/parsers/test_report_list.rb +0 -18
- data/test/mws/reports/parsers/test_report_request.rb +0 -13
- data/test/mws/reports/parsers/test_report_request_count.rb +0 -13
- data/test/mws/reports/parsers/test_report_request_info.rb +0 -49
- data/test/mws/reports/parsers/test_report_request_list.rb +0 -18
- data/test/mws/reports/parsers/test_report_requests.rb +0 -17
- data/test/mws/reports/parsers/test_report_schedule_count.rb +0 -13
- data/test/mws/reports/parsers/test_report_schedule_list.rb +0 -18
- data/test/mws/reports/parsers/test_report_scheduler.rb +0 -17
- data/test/mws/reports/requests/test_acknowledgements.rb +0 -36
- data/test/mws/reports/requests/test_report_count.rb +0 -23
- data/test/mws/reports/requests/test_report_list.rb +0 -39
- data/test/mws/reports/requests/test_report_request.rb +0 -31
- data/test/mws/reports/requests/test_report_request_count.rb +0 -23
- data/test/mws/reports/requests/test_report_request_list.rb +0 -44
- data/test/mws/reports/requests/test_report_requests.rb +0 -29
- data/test/mws/reports/requests/test_report_schedule_count.rb +0 -22
- data/test/mws/reports/requests/test_report_schedule_list.rb +0 -36
- data/test/mws/reports/requests/test_report_scheduler.rb +0 -33
- data/test/mws/sellers/parsers/test_market_participations.rb +0 -19
- data/test/mws/sellers/parsers/test_service_status.rb +0 -35
- data/test/mws/sellers/requests/test_marketplace_participation_list.rb +0 -39
- data/test/mws/sellers/requests/test_service_status.rb +0 -25
- data/test/parser_helper.rb +0 -11
- data/test/peddler/parsers/test_collection.rb +0 -8
- data/test/peddler/parsers/test_model.rb +0 -70
- data/test/peddler/request/test_parameters.rb +0 -35
- data/test/peddler/test_client.rb +0 -42
- data/test/request_helper.rb +0 -20
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'peddler/parsers/model'
|
2
|
-
require 'mws/reports/parsers/report_schedule'
|
3
|
-
|
4
|
-
module MWS
|
5
|
-
module Reports
|
6
|
-
module Parsers
|
7
|
-
class ReportScheduler < ::Peddler::Parsers::Model
|
8
|
-
value :count do
|
9
|
-
integer_at_xpath('Count')
|
10
|
-
end
|
11
|
-
|
12
|
-
value :report_schedule do
|
13
|
-
node = at_xpath('ReportSchedule')
|
14
|
-
ReportSchedule.new(node) if node
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
require 'peddler/request'
|
2
|
-
require 'mws/reports/parsers/report'
|
3
|
-
|
4
|
-
module MWS
|
5
|
-
module Reports
|
6
|
-
module Requests
|
7
|
-
class Report < ::Peddler::Request
|
8
|
-
def get(id)
|
9
|
-
parameters(:get_report)
|
10
|
-
.update(report_id: id)
|
11
|
-
.camelize_keys!
|
12
|
-
|
13
|
-
execute
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
require 'peddler/request'
|
2
|
-
require 'mws/reports/parsers/report_acknowledgements'
|
3
|
-
|
4
|
-
module MWS
|
5
|
-
module Reports
|
6
|
-
module Requests
|
7
|
-
class ReportAcknowledgements < ::Peddler::Request
|
8
|
-
def update(acknowledged, *ids)
|
9
|
-
parameters(:update_report_acknowledgements)
|
10
|
-
.update(report_id_list: ids, acknowledged: acknowledged)
|
11
|
-
.format_structured_lists!
|
12
|
-
.camelize_keys!
|
13
|
-
|
14
|
-
execute
|
15
|
-
end
|
16
|
-
|
17
|
-
def acknowledge(*ids)
|
18
|
-
update(true, *ids)
|
19
|
-
end
|
20
|
-
|
21
|
-
def unacknowledge(*ids)
|
22
|
-
update(false, *ids)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'peddler/request'
|
2
|
-
require 'mws/reports/parsers/report_count'
|
3
|
-
|
4
|
-
module MWS
|
5
|
-
module Reports
|
6
|
-
module Requests
|
7
|
-
class ReportCount < ::Peddler::Request
|
8
|
-
def get(options = {})
|
9
|
-
parameters(:get_report_count)
|
10
|
-
.update(options)
|
11
|
-
.timestamp!
|
12
|
-
.format_structured_lists!
|
13
|
-
.camelize_keys!
|
14
|
-
|
15
|
-
execute
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'peddler/request'
|
2
|
-
require 'mws/reports/parsers/report_list'
|
3
|
-
|
4
|
-
module MWS
|
5
|
-
module Reports
|
6
|
-
module Requests
|
7
|
-
class ReportList < ::Peddler::Request
|
8
|
-
def get(options = {})
|
9
|
-
parameters(:get_report_list)
|
10
|
-
.update(options)
|
11
|
-
.timestamp!
|
12
|
-
.format_structured_lists!
|
13
|
-
.camelize_keys!
|
14
|
-
|
15
|
-
execute
|
16
|
-
end
|
17
|
-
|
18
|
-
def get_by_next_token(token = next_token)
|
19
|
-
return false unless token
|
20
|
-
|
21
|
-
parameters(:get_report_list_by_next_token)
|
22
|
-
.update(next_token: token)
|
23
|
-
.camelize_keys!
|
24
|
-
|
25
|
-
execute
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'peddler/request'
|
2
|
-
require 'mws/reports/parsers/report_request'
|
3
|
-
|
4
|
-
module MWS
|
5
|
-
module Reports
|
6
|
-
module Requests
|
7
|
-
class ReportRequest < ::Peddler::Request
|
8
|
-
def submit(type, options = {})
|
9
|
-
parameters(:request_report)
|
10
|
-
.update(report_type: type)
|
11
|
-
.update(options)
|
12
|
-
.timestamp!
|
13
|
-
.format_structured_lists!
|
14
|
-
.camelize_keys!
|
15
|
-
|
16
|
-
execute
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'peddler/request'
|
2
|
-
require 'mws/reports/parsers/report_request_count'
|
3
|
-
|
4
|
-
module MWS
|
5
|
-
module Reports
|
6
|
-
module Requests
|
7
|
-
class ReportRequestCount < ::Peddler::Request
|
8
|
-
def get(options = {})
|
9
|
-
parameters(:get_report_request_count)
|
10
|
-
.update(options)
|
11
|
-
.timestamp!
|
12
|
-
.format_structured_lists!
|
13
|
-
.camelize_keys!
|
14
|
-
|
15
|
-
execute
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'peddler/request'
|
2
|
-
require 'mws/reports/parsers/report_request_list'
|
3
|
-
|
4
|
-
module MWS
|
5
|
-
module Reports
|
6
|
-
module Requests
|
7
|
-
class ReportRequestList < ::Peddler::Request
|
8
|
-
def get(options = {})
|
9
|
-
parameters(:get_report_request_list)
|
10
|
-
.update(options)
|
11
|
-
.timestamp!
|
12
|
-
.format_structured_lists!
|
13
|
-
.camelize_keys!
|
14
|
-
|
15
|
-
execute
|
16
|
-
end
|
17
|
-
|
18
|
-
def get_by_next_token(token = next_token)
|
19
|
-
return false unless token
|
20
|
-
|
21
|
-
parameters(:get_report_request_list_by_next_token)
|
22
|
-
.update(next_token: token)
|
23
|
-
.camelize_keys!
|
24
|
-
|
25
|
-
execute
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'peddler/request'
|
2
|
-
require 'mws/reports/parsers/report_requests'
|
3
|
-
|
4
|
-
module MWS
|
5
|
-
module Reports
|
6
|
-
module Requests
|
7
|
-
class ReportRequests < ::Peddler::Request
|
8
|
-
def cancel(options = {})
|
9
|
-
parameters(:cancel_report_requests)
|
10
|
-
.update(options)
|
11
|
-
.timestamp!
|
12
|
-
.format_structured_lists!
|
13
|
-
.camelize_keys!
|
14
|
-
|
15
|
-
execute
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'peddler/request'
|
2
|
-
require 'mws/reports/parsers/report_schedule_count'
|
3
|
-
|
4
|
-
module MWS
|
5
|
-
module Reports
|
6
|
-
module Requests
|
7
|
-
class ReportScheduleCount < ::Peddler::Request
|
8
|
-
def get(*types)
|
9
|
-
parameters(:get_report_schedule_count)
|
10
|
-
.update(report_type_list: types)
|
11
|
-
.format_structured_lists!
|
12
|
-
.camelize_keys!
|
13
|
-
|
14
|
-
execute
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'peddler/request'
|
2
|
-
require 'mws/reports/parsers/report_schedule_list'
|
3
|
-
|
4
|
-
module MWS
|
5
|
-
module Reports
|
6
|
-
module Requests
|
7
|
-
class ReportScheduleList < ::Peddler::Request
|
8
|
-
def get(*types)
|
9
|
-
parameters(:get_report_schedule_list)
|
10
|
-
.update(report_type_list: types)
|
11
|
-
.format_structured_lists!
|
12
|
-
.camelize_keys!
|
13
|
-
|
14
|
-
execute
|
15
|
-
end
|
16
|
-
|
17
|
-
def get_by_next_token(token = next_token)
|
18
|
-
raise NotImplementedError
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
require 'peddler/request'
|
2
|
-
require 'mws/reports/parsers/report_scheduler'
|
3
|
-
|
4
|
-
module MWS
|
5
|
-
module Reports
|
6
|
-
module Requests
|
7
|
-
class ReportScheduler < ::Peddler::Request
|
8
|
-
def manage(type, schedule, scheduled_at = nil)
|
9
|
-
options = {
|
10
|
-
report_type: type,
|
11
|
-
schedule: schedule
|
12
|
-
}
|
13
|
-
options.update(scheduled_date: scheduled_at) if scheduled_at
|
14
|
-
|
15
|
-
parameters(:get_report_count)
|
16
|
-
.update(options)
|
17
|
-
.timestamp!
|
18
|
-
.camelize_keys!
|
19
|
-
|
20
|
-
execute
|
21
|
-
end
|
22
|
-
|
23
|
-
def delete(type)
|
24
|
-
manage(type, '_NEVER_')
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
data/lib/mws/sellers/client.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
require 'mws/sellers/requests/marketplace_participations'
|
2
|
-
require 'mws/sellers/requests/service_status'
|
3
|
-
require 'peddler/client'
|
4
|
-
|
5
|
-
module MWS
|
6
|
-
module Sellers
|
7
|
-
# The Sellers API lets sellers retrieve information about their seller
|
8
|
-
# account, such as the marketplaces they participate in.
|
9
|
-
class Client < ::Peddler::Client
|
10
|
-
path 'Sellers/2011-07-01'
|
11
|
-
|
12
|
-
# Public: List marketplaces that the seller submitting the request can
|
13
|
-
# sell in and her participations, which include seller-specific
|
14
|
-
# information in that marketplace.
|
15
|
-
#
|
16
|
-
# Examples
|
17
|
-
#
|
18
|
-
# client.list_marketplace_participations
|
19
|
-
#
|
20
|
-
# Returns Marketplace Participations.
|
21
|
-
def_delegator :marketplace_participations, :list, :list_marketplace_participations
|
22
|
-
|
23
|
-
# Public: List the next page of marketplace participations using the
|
24
|
-
# NextToken parameter.
|
25
|
-
#
|
26
|
-
# Examples
|
27
|
-
#
|
28
|
-
# client.list_marketplace_participations_by_next_token
|
29
|
-
#
|
30
|
-
# Returns Marketplace Participations.
|
31
|
-
def_delegator :marketplace_participations, :list_by_next_token, :list_marketplace_participations_by_next_token
|
32
|
-
|
33
|
-
# Public: Get the service status of the API.
|
34
|
-
#
|
35
|
-
# Examples
|
36
|
-
#
|
37
|
-
# client.get_service_status
|
38
|
-
#
|
39
|
-
# Returns the Service Status.
|
40
|
-
def_delegator :service_status, :get, :get_service_status
|
41
|
-
|
42
|
-
private
|
43
|
-
|
44
|
-
def marketplace_participations
|
45
|
-
@marketplace_participations ||= Requests::MarketplaceParticipations.new(self)
|
46
|
-
end
|
47
|
-
|
48
|
-
def service_status
|
49
|
-
@service_status ||= Requests::ServiceStatus.new(self)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'peddler/parsers/model'
|
2
|
-
|
3
|
-
module MWS
|
4
|
-
module Sellers
|
5
|
-
module Parsers
|
6
|
-
class Marketplace < ::Peddler::Parsers::Model
|
7
|
-
value(:id) do
|
8
|
-
text_at_xpath('MarketplaceId')
|
9
|
-
end
|
10
|
-
|
11
|
-
value(:name) do
|
12
|
-
text_at_xpath('Name')
|
13
|
-
end
|
14
|
-
|
15
|
-
value(:default_country_code) do
|
16
|
-
text_at_xpath('DefaultCountryCode')
|
17
|
-
end
|
18
|
-
|
19
|
-
value(:default_currency_code) do
|
20
|
-
text_at_xpath('DefaultCurrencyCode')
|
21
|
-
end
|
22
|
-
|
23
|
-
value(:default_language_code) do
|
24
|
-
text_at_xpath('DefaultLanguageCode')
|
25
|
-
end
|
26
|
-
|
27
|
-
value(:domain_name) do
|
28
|
-
text_at_xpath('DomainName')
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
require 'peddler/parsers/model'
|
2
|
-
require 'mws/sellers/parsers/marketplace'
|
3
|
-
require 'mws/sellers/parsers/participation'
|
4
|
-
require 'peddler/parsers/tokenable'
|
5
|
-
|
6
|
-
module MWS
|
7
|
-
module Sellers
|
8
|
-
module Parsers
|
9
|
-
class MarketplaceParticipations < ::Peddler::Parsers::Model
|
10
|
-
include ::Peddler::Parsers::Tokenable
|
11
|
-
|
12
|
-
value(:marketplaces) do
|
13
|
-
marketplace_nodes.map { |node| Marketplace.new(node) }
|
14
|
-
end
|
15
|
-
|
16
|
-
value(:participations) do
|
17
|
-
participation_nodes.map { |node| Participation.new(node) }
|
18
|
-
end
|
19
|
-
|
20
|
-
private
|
21
|
-
|
22
|
-
def participation_nodes
|
23
|
-
xpath('ListParticipations/Participation')
|
24
|
-
end
|
25
|
-
|
26
|
-
def marketplace_nodes
|
27
|
-
xpath('ListMarketplaces/Marketplace')
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'peddler/parsers/model'
|
2
|
-
|
3
|
-
module MWS
|
4
|
-
module Sellers
|
5
|
-
module Parsers
|
6
|
-
class Participation < ::Peddler::Parsers::Model
|
7
|
-
value(:marketplace_id) do
|
8
|
-
text_at_xpath('MarketplaceId')
|
9
|
-
end
|
10
|
-
|
11
|
-
value(:seller_id) do
|
12
|
-
text_at_xpath('SellerId')
|
13
|
-
end
|
14
|
-
|
15
|
-
value(:has_seller_suspended_listings?) do
|
16
|
-
boolean_at_xpath('HasSellerSuspendedListings')
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
require 'mws/sellers/parsers/service_status_message'
|
2
|
-
require 'peddler/parsers/model'
|
3
|
-
|
4
|
-
module MWS
|
5
|
-
module Sellers
|
6
|
-
module Parsers
|
7
|
-
class ServiceStatus < ::Peddler::Parsers::Model
|
8
|
-
value :status do
|
9
|
-
text_at_xpath('Status')
|
10
|
-
end
|
11
|
-
|
12
|
-
value :timestamp do
|
13
|
-
time_at_xpath('Timestamp')
|
14
|
-
end
|
15
|
-
|
16
|
-
value :message_id do
|
17
|
-
text_at_xpath('MessageId')
|
18
|
-
end
|
19
|
-
|
20
|
-
value :messages do
|
21
|
-
xpath('Messages/Message').map { |node| ServiceStatusMessage.new(node) }
|
22
|
-
end
|
23
|
-
|
24
|
-
def ok?
|
25
|
-
status == 'GREEN'
|
26
|
-
end
|
27
|
-
|
28
|
-
def inspect
|
29
|
-
status
|
30
|
-
end
|
31
|
-
|
32
|
-
alias :to_s :inspect
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'peddler/parsers/model'
|
2
|
-
|
3
|
-
module MWS
|
4
|
-
module Sellers
|
5
|
-
module Parsers
|
6
|
-
class ServiceStatusMessage < ::Peddler::Parsers::Model
|
7
|
-
value :locale do
|
8
|
-
text_at_xpath('Locale')
|
9
|
-
end
|
10
|
-
|
11
|
-
value :text do
|
12
|
-
text_at_xpath('Text')
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
require 'peddler/request'
|
2
|
-
require 'mws/sellers/parsers/marketplace_participations'
|
3
|
-
|
4
|
-
module MWS
|
5
|
-
module Sellers
|
6
|
-
module Requests
|
7
|
-
class MarketplaceParticipations < ::Peddler::Request
|
8
|
-
def list
|
9
|
-
parameters(:list_marketplace_participations)
|
10
|
-
.camelize_keys!
|
11
|
-
|
12
|
-
execute
|
13
|
-
end
|
14
|
-
|
15
|
-
def list_by_next_token(token = next_token)
|
16
|
-
return false unless token
|
17
|
-
|
18
|
-
parameters(:list_marketplace_participations_by_next_token)
|
19
|
-
.update(next_token: token)
|
20
|
-
.camelize_keys!
|
21
|
-
|
22
|
-
execute
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'peddler/request'
|
2
|
-
require 'mws/sellers/parsers/service_status'
|
3
|
-
|
4
|
-
module MWS
|
5
|
-
module Sellers
|
6
|
-
module Requests
|
7
|
-
class ServiceStatus < ::Peddler::Request
|
8
|
-
def get
|
9
|
-
parameters(:get_service_status)
|
10
|
-
execute
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
data/lib/peddler/parsers/base.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'peddler/parsers/xml'
|
2
|
-
|
3
|
-
module Peddler
|
4
|
-
module Parsers
|
5
|
-
class Collection < XML
|
6
|
-
include Enumerable
|
7
|
-
|
8
|
-
def each
|
9
|
-
raise NotImplementedError
|
10
|
-
end
|
11
|
-
|
12
|
-
def empty?
|
13
|
-
count == 0
|
14
|
-
end
|
15
|
-
|
16
|
-
def inspect
|
17
|
-
"#<#{self.class} (#{count})>"
|
18
|
-
end
|
19
|
-
|
20
|
-
alias :to_s :inspect
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
require 'cgi'
|
2
|
-
require 'time'
|
3
|
-
require 'money'
|
4
|
-
require 'structure'
|
5
|
-
|
6
|
-
require 'peddler/parsers/xml'
|
7
|
-
|
8
|
-
module Peddler
|
9
|
-
module Parsers
|
10
|
-
class Model < XML
|
11
|
-
include Structure
|
12
|
-
|
13
|
-
def boolean_at_xpath(path)
|
14
|
-
!!text_at_xpath(path).match(/true|yes/i)
|
15
|
-
end
|
16
|
-
|
17
|
-
def float_at_xpath(path)
|
18
|
-
str = text_at_xpath(path)
|
19
|
-
str.to_f if str
|
20
|
-
end
|
21
|
-
|
22
|
-
def integer_at_xpath(path)
|
23
|
-
str = text_at_xpath(path)
|
24
|
-
str.to_i if str
|
25
|
-
end
|
26
|
-
|
27
|
-
def money_at_xpath(path)
|
28
|
-
return unless amount = float_at_xpath("#{path}/Amount")
|
29
|
-
|
30
|
-
currency_code = text_at_xpath("#{path}/CurrencyCode")
|
31
|
-
amount = amount * 100 unless currency_code == 'JPY'
|
32
|
-
|
33
|
-
Money.new(amount, currency_code)
|
34
|
-
end
|
35
|
-
|
36
|
-
def time_at_xpath(path)
|
37
|
-
str = text_at_xpath(path)
|
38
|
-
Time.parse(CGI.unescape(str)) if str
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
data/lib/peddler/parsers/text.rb
DELETED