Class: BoffinIO::Customer

Inherits:
APIResource show all
Includes:
APIOperations::Create, APIOperations::List, APIOperations::Update
Defined in:
lib/boffinio/customer.rb

Instance Attribute Summary

Attributes inherited from BoffinIOObject

#api_key

Instance Method Summary collapse

Methods included from APIOperations::Update

#save, #serialize_metadata, #serialize_params

Methods included from APIOperations::Create

included

Methods included from APIOperations::List

included

Methods inherited from APIResource

class_name, #refresh, retrieve, url, #url

Methods inherited from BoffinIOObject

#[], #[]=, #_dump, _load, #as_json, construct_from, #each, #initialize, #inspect, #keys, #refresh_from, #respond_to?, #to_hash, #to_json, #to_s, #values

Constructor Details

This class inherits a constructor from BoffinIO::BoffinIOObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class BoffinIO::BoffinIOObject

Instance Method Details

#cancel_subscription(params = {}) ⇒ Object



9
10
11
12
13
# File 'lib/boffinio/customer.rb', line 9

def cancel_subscription(params={})
  response, api_key = BoffinIO.request(:delete, subscriptions_url, @api_key, params)
  refresh_from({ :subscription => response }, api_key, true)
  subscription
end

#create_subscription(params) ⇒ Object



21
22
23
24
25
# File 'lib/boffinio/customer.rb', line 21

def create_subscription(params)
  response, api_key = BoffinIO.request(:post, subscriptions_url, @api_key, params)
  refresh_from({ :subscription => response }, api_key, true)
  subscription
end

#update_subscription(params) ⇒ Object



15
16
17
18
19
# File 'lib/boffinio/customer.rb', line 15

def update_subscription(params)
  response, api_key = BoffinIO.request(:post, subscriptions_url, @api_key, params)
  refresh_from({ :subscription => response }, api_key, true)
  subscription
end