2
votes

Ok so I'm jumping into some basic Shopify App via Rails 4 and the Embedded frame. My question is this, to pull in order details you can use this line in the controller I use this below and it works, I can output order ID's and details to the app view...

@orders = ShopifyAPI::Order.find(:all, :params => {:limit => 10})

What line code would I use in the home_controller.rb to access risk values per order?

So basally I'm trying to write this in the controller to pull in details GET /admin/orders/#{id}/risks.json https://docs.shopify.com/api/order_risks#index

but not .json, I want it to be in ruby for the app.

1
what do you mean "but not .json, I want it to be in ruby for the app."matanco
Basically how do I write this... GET /admin/orders/#{id}/risks.json in this format... @orders = ShopifyAPI::Order.find(:all, :params => {:limit => 10}Matt Kennedy

1 Answers

1
votes

well according to the module code you can do something like:

ShopifyAPI::OrderRisk.find(:all, :params => {:order_id =>params[:order_id]})

some good docs:

https://github.com/Shopify/shopify_api/blob/master/lib/shopify_api/resources/order_risk.rb

https://www.omniref.com/ruby/gems/shopify_api/3.2.1/symbols/ShopifyAPI::OrderRisk?d=92139572&n=0#