Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Listing.find_all_by_shop_id() throws error with state=sold #90

Open
sarahbwalsh opened this issue Oct 31, 2014 · 3 comments
Open

Listing.find_all_by_shop_id() throws error with state=sold #90

sarahbwalsh opened this issue Oct 31, 2014 · 3 comments

Comments

@sarahbwalsh
Copy link

Listing.find_all_by_shop_id() is throwing Etsy::EtsyJSONInvalid when the state is set to sold.

Example:

access = { :access_token => 'mytoken', :access_secret => 'mysecret' }
listings = Etsy::Listing.find_all_by_shop_id(myshop_id, access.merge(:state => :sold, :limit => 100, :offset => 0))

All other valid states (active, inactive, expired, featured) work as expected.

@kytrinyx
Copy link
Collaborator

I wonder if they changed the name of the state from sold to sold_out?

https://www.etsy.com/developers/documentation/reference/listing#section_listing_states

@sarahbwalsh
Copy link
Author

So I poked through the listings.rb file and found:

if state == :sold
  sold_listings(shop_id, options)
else
  get_all("/shops/#{shop_id}/listings/#{state}", options)
end

So passing sold doesn't actually use that as state parameter to pull listings. sold_listings() actually calls Etsy::Transaction.find_all_by_shop_id() to pull the sold out listings. I get the same Etsy::EtsyJSONInvalid error trying to call either of the Transaction methods (find_all_by_shop_id and find_all_by_buyer_id) directly, so it looks like the issue is with transactions. Note that I do have listings_r included in my oauth permission scope, so that isn't the problem.

@kytrinyx
Copy link
Collaborator

Got it, it looks like you're right, that the transactions are the problem. I'll dig into this, thanks for reporting it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants