Class: ShopifyAPI::Refund

Inherits:
Base show all
Defined in:
lib/shopify_api/resources/refund.rb

Class Method Summary collapse

Methods inherited from Base

activate_session, #as_json, clear_session, #encode, #headers, init_prefix, init_prefix_explicit, #persisted?

Methods included from Countable

#count

Methods inherited from ActiveResource::Base

delete, headers

Class Method Details

.calculate(*args) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/shopify_api/resources/refund.rb', line 5

def self.calculate(*args)
  options = { :refund => args[0] }
  params = options.merge(args[1][:params]) if args[1] && args[1][:params]
  self.prefix = "/admin/orders/#{params[:order_id]}/"
  resource = post(:calculate, {}, options.to_json)
  instantiate_record(format.decode(resource.body), {})
end