elyngved / ruby-mws

A Ruby library that wraps the Amazon MWS API.
MIT License
41 stars 64 forks source link

How do I get the tests to pass? #7

Closed homanchou closed 11 years ago

homanchou commented 11 years ago

Hi, I just forked the project and I would like to contribute to the feeds api. But first, can you help me understand what I need to do to get the tests to pass? I just ran rspec spec and I get failures like this (I tried looking through the source and tests, I took a look at the ephemeral_response gem and tried adding a credential.yml file afterwards, but I wasn't able to progress much):

....FFFFFFF.......

Failures:

1) MWS::API::Inventory requests list_inventory_supply should return items based on seller SKUs Failure/Error: items = @mws.inventory.list_inventory_supply :timestamp => @timestamp, MWS::ErrorResponse: RequestExpired: Request has expired. Timestamp date: 2012-04-25T21:42:11-04:00

./lib/ruby-mws/api/response.rb:22:in `handle_error_response'

 # ./lib/ruby-mws/api/response.rb:8:in`parse'
 # ./lib/ruby-mws/api/base.rb:49:in `send_request'
 # (eval):4:in`list_inventory_supply'
 # ./spec/ruby-mws/api/inventory_spec.rb:15:in `block (4 levels) in <top (required)>'

2) MWS::API::Inventory requests list_inventory_supply should return items with inventory changes since a certain time Failure/Error: items = @mws.inventory.list_inventory_supply :timestamp => @timestamp, MWS::ErrorResponse: RequestExpired: Request has expired. Timestamp date: 2012-04-25T21:42:11-04:00

./lib/ruby-mws/api/response.rb:22:in `handle_error_response'

 # ./lib/ruby-mws/api/response.rb:8:in`parse'
 # ./lib/ruby-mws/api/base.rb:49:in `send_request'
 # (eval):4:in`list_inventory_supply'
 # ./spec/ruby-mws/api/inventory_spec.rb:22:in `block (4 levels) in <top (required)>'

3) MWS::API::Order requests list_orders should receive a list of orders Failure/Error: orders = @mws.orders.list_orders :last_updated_after => "2012-01-15T13:07:26-05:00" , MWS::ErrorResponse: RequestExpired: Request has expired. Timestamp date: 2012-04-25T21:42:55-04:00

./lib/ruby-mws/api/response.rb:22:in `handle_error_response'

 # ./lib/ruby-mws/api/response.rb:8:in`parse'
 # ./lib/ruby-mws/api/base.rb:49:in `send_request'
 # (eval):4:in`list_orders'
 # ./spec/ruby-mws/api/order_spec.rb:14:in `block (4 levels) in <top (required)>'

4) MWS::API::Order requests list_orders_by_next_token should receive a list_orders_by_next_token_result Failure/Error: orders = @mws.orders.list_orders_by_next_token :timestamp => @timestamp, MWS::ErrorResponse: RequestExpired: Request has expired. Timestamp date: 2012-04-25T21:42:55-04:00

./lib/ruby-mws/api/response.rb:22:in `handle_error_response'

 # ./lib/ruby-mws/api/response.rb:8:in`parse'
 # ./lib/ruby-mws/api/base.rb:49:in `send_request'
 # (eval):4:in`list_orders_by_next_token'
 # ./spec/ruby-mws/api/order_spec.rb:23:in `block (4 levels) in <top (required)>'

5) MWS::API::Order requests get_order should return one order for one order id Failure/Error: order = @mws.orders.get_order :amazon_order_id => "102-4850183-7065809", MWS::ErrorResponse: RequestExpired: Request has expired. Timestamp date: 2012-04-25T21:42:55-04:00

./lib/ruby-mws/api/response.rb:22:in `handle_error_response'

 # ./lib/ruby-mws/api/response.rb:8:in`parse'
 # ./lib/ruby-mws/api/base.rb:49:in `send_request'
 # (eval):4:in`get_order'
 # ./spec/ruby-mws/api/order_spec.rb:32:in `block (4 levels) in <top (required)>'

6) MWS::API::Order requests get_order should return multiple orders for multiple order ids Failure/Error: orders = @mws.orders.get_order :amazon_order_id => ["102-4850183-7065809", "002-3400187-5292203"], MWS::ErrorResponse: RequestExpired: Request has expired. Timestamp date: 2012-04-25T21:42:55-04:00

./lib/ruby-mws/api/response.rb:22:in `handle_error_response'

 # ./lib/ruby-mws/api/response.rb:8:in`parse'
 # ./lib/ruby-mws/api/base.rb:49:in `send_request'
 # (eval):4:in`get_order'
 # ./spec/ruby-mws/api/order_spec.rb:40:in `block (4 levels) in <top (required)>'

7) MWS::API::Order requests list_order_items should return a list of items for an order Failure/Error: order = @mws.orders.list_order_items :amazon_order_id => "102-4850183-7065809", MWS::ErrorResponse: RequestExpired: Request has expired. Timestamp date: 2012-04-25T21:42:55-04:00

./lib/ruby-mws/api/response.rb:22:in `handle_error_response'

 # ./lib/ruby-mws/api/response.rb:8:in`parse'
 # ./lib/ruby-mws/api/base.rb:49:in `send_request'
 # (eval):4:in`list_order_items'
 # ./spec/ruby-mws/api/order_spec.rb:50:in `block (4 levels) in <top (required)>'
homanchou commented 11 years ago

Nevermind, I think I figured it out. I will update the readme in my fork and issue a pull request when I am ready.

elyngved commented 11 years ago

Hey, it's kind of a crappy system that I plan on changing around. You'll see @timestamp variables in the specs. You'll have to update it to whatever Time.now returns. Thanks for the contributions!