Listing.find_all_by_shop_id() throws error with state=sold
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.
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
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.
Got it, it looks like you're right, that the transactions are the problem. I'll dig into this, thanks for reporting it.