Skip to content

Commit

Permalink
Merge pull request #6 from plarochelle/test-feeds-endpoint
Browse files Browse the repository at this point in the history
Test feeds endpoint
  • Loading branch information
Pierre Larochelle committed Feb 19, 2014
2 parents 2813b26 + fba5977 commit 0a84f0b
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 1 deletion.
18 changes: 17 additions & 1 deletion README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,20 @@ This object can be used to access all API services. Below are examples on how to

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

`@mws.reports.get_report :report_id => '11223344'`
`@mws.reports.get_report :report_id => '11223344'`

Testing
-------

Add the file `spec/credentials.yml` that looks like

```
aws_access_key_id: '[access key]'
secret_access_key: '[secret access key]'
seller_id: '[seller id]'
marketplace_id: '[marketplace id]'
```

Then run `bundle exec rspec spec/`

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.
46 changes: 46 additions & 0 deletions spec/ruby-mws/api/feed_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
require 'spec_helper'

describe MWS::API::Feed do

before :all do
EphemeralResponse.activate
@mws = MWS.new(auth_params)
end

context "requests" do
describe "submit_feed" do
it "should be able to ack an order" do
response = @mws.feeds.submit_feed(MWS::API::Feed::ORDER_ACK, {
:amazon_order_id => '105-1063273-7151427'
})
response.feed_submission_info.should_not be_nil

info = response.feed_submission_info
info.feed_processing_status.should == "_SUBMITTED_"
info.feed_type.should == MWS::API::Feed::ORDER_ACK
end

it "should be able to ack a shipment" do
response = @mws.feeds.submit_feed(MWS::API::Feed::SHIP_ACK, {
:amazon_order_id => '105-8268075-6520231',
:shipping_method => '2nd Day',
:items => [
{
:amazon_order_item_code => '27030690916666',
:quantity => 1
},
{
:amazon_order_item_code => '62918663121794',
:quantity => 1
}
]
})
response.feed_submission_info.should_not be_nil

info = response.feed_submission_info
info.feed_processing_status.should == "_SUBMITTED_"
info.feed_type.should == MWS::API::Feed::SHIP_ACK
end
end
end
end

0 comments on commit 0a84f0b

Please sign in to comment.