Class: ShopifyAPI::RecurringApplicationCharge

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

Class Method Summary collapse

Instance 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

.currentObject



6
7
8
# File 'lib/shopify_api/resources/recurring_application_charge.rb', line 6

def current
  (all || []).find { |c| c.status == 'active' }
end

Instance Method Details

#activateObject



23
24
25
# File 'lib/shopify_api/resources/recurring_application_charge.rb', line 23

def activate
  load_attributes_from_response(post(:activate))
end

#cancelObject



19
20
21
# File 'lib/shopify_api/resources/recurring_application_charge.rb', line 19

def cancel
  load_attributes_from_response(self.destroy)
end

#customize(customize_recurring_app_charge_params = {}) ⇒ Object



27
28
29
# File 'lib/shopify_api/resources/recurring_application_charge.rb', line 27

def customize(customize_recurring_app_charge_params = {})
  load_attributes_from_response(put(:customize, recurring_application_charge: customize_recurring_app_charge_params ))
end

#usage_chargesObject



15
16
17
# File 'lib/shopify_api/resources/recurring_application_charge.rb', line 15

def usage_charges
  UsageCharge.find(:all, params: { recurring_application_charge_id: id })
end