I use stone shopify_api .
The API dock shows that you can smooth out the answer of ShopifyAPI::Order by specifying which fields to return. For example, the following returns only the id attribute and shipping_address attribute
ShopifyAPI::Order.find(:all, params: {fields: "id,shipping_address"})
shipping_address turns out to be a hash with several fields inside it. Can I specify which fields are nested in shipping_address for return? , eg.
ShopifyAPI::Order.find(:all, params: {fields: "id,shipping_address['country_code']"})
It might return something like
#<ShopifyAPI::Order:0x0000010558b348 @attributes={ "id"=>12345678, "shipping_address"=>#<ShopifyAPI::ShippingAddress:0x0000010558aa88 @attributes={"country_code"=>"US"}, @prefix_options={}, @persisted=false> }, @prefix_options={}, @persisted=true>
I know that I can select these attributes ( order.shipping_address.country_code ), but this is more in the interests of a "skinny" reaction.
Bonus Question 1: What are the tangible benefits of using the fields parameter?
Bonus Question 2: When (if ever) can Shopify return a zero shipping address?
source share