0
votes

I am building a Rails app to access ShopifyAPI. How can I add a 'calculated' field on the returned object. e.g. In my controller, to get all orders, I am calling:

@orders = ShopifyAPI::Order.find(:all, :params => { :status => 'any'})

This works fine but I would like @orders to contain a new calculated field 'fullname' (concat of order.customer.firstname + order.customer.lastname)

Any ideas really appreciated :-) Thanks.

1

1 Answers

1
votes

A GET on a resource means you are transferring it from A to B, and in this case you're moving orders from your shop to your app. If you want to concatenate the customer names you do that in your app code. You cannot alter the format of data requested from an API to suit you. You get it as is.