Skip to content

Commit 0a84f0b

Browse files
author
Pierre Larochelle
committed
Merge pull request #6 from plarochelle/test-feeds-endpoint
Test feeds endpoint
2 parents 2813b26 + fba5977 commit 0a84f0b

2 files changed

Lines changed: 63 additions & 1 deletion

File tree

README.markdown

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,20 @@ This object can be used to access all API services. Below are examples on how to
114114

115115
* GetReport - Used to request a report by report ID. All reports are currently returned as a flat file string.
116116

117-
`@mws.reports.get_report :report_id => '11223344'`
117+
`@mws.reports.get_report :report_id => '11223344'`
118+
119+
Testing
120+
-------
121+
122+
Add the file `spec/credentials.yml` that looks like
123+
124+
```
125+
aws_access_key_id: '[access key]'
126+
secret_access_key: '[secret access key]'
127+
seller_id: '[seller id]'
128+
marketplace_id: '[marketplace id]'
129+
```
130+
131+
Then run `bundle exec rspec spec/`
132+
133+
There's still work and research to be done on how to integrate our changes in with the author's. Because we're using different credentials than the author and there are hardcodede order ids in the specs we'll never have all the specs passing for all of us.

spec/ruby-mws/api/feed_spec.rb

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
require 'spec_helper'
2+
3+
describe MWS::API::Feed do
4+
5+
before :all do
6+
EphemeralResponse.activate
7+
@mws = MWS.new(auth_params)
8+
end
9+
10+
context "requests" do
11+
describe "submit_feed" do
12+
it "should be able to ack an order" do
13+
response = @mws.feeds.submit_feed(MWS::API::Feed::ORDER_ACK, {
14+
:amazon_order_id => '105-1063273-7151427'
15+
})
16+
response.feed_submission_info.should_not be_nil
17+
18+
info = response.feed_submission_info
19+
info.feed_processing_status.should == "_SUBMITTED_"
20+
info.feed_type.should == MWS::API::Feed::ORDER_ACK
21+
end
22+
23+
it "should be able to ack a shipment" do
24+
response = @mws.feeds.submit_feed(MWS::API::Feed::SHIP_ACK, {
25+
:amazon_order_id => '105-8268075-6520231',
26+
:shipping_method => '2nd Day',
27+
:items => [
28+
{
29+
:amazon_order_item_code => '27030690916666',
30+
:quantity => 1
31+
},
32+
{
33+
:amazon_order_item_code => '62918663121794',
34+
:quantity => 1
35+
}
36+
]
37+
})
38+
response.feed_submission_info.should_not be_nil
39+
40+
info = response.feed_submission_info
41+
info.feed_processing_status.should == "_SUBMITTED_"
42+
info.feed_type.should == MWS::API::Feed::SHIP_ACK
43+
end
44+
end
45+
end
46+
end

0 commit comments

Comments
 (0)