Class: Nurego::Customer
- Inherits:
-
APIResource
- Object
- NuregoObject
- APIResource
- Nurego::Customer
- Includes:
- APIOperations::List
- Defined in:
- lib/nurego/customer.rb
Instance Attribute Summary
Attributes inherited from NuregoObject
Class Method Summary collapse
- .cancel_account ⇒ Object
- .me(api_key = nil) ⇒ Object
- .me_url ⇒ Object
- .update_plan(plan_id, sub_id) ⇒ Object
Instance Method Summary collapse
Methods included from APIOperations::List
Methods inherited from APIResource
class_name, #refresh, retrieve, url, #url
Methods inherited from NuregoObject
#[], #[]=, #as_json, construct_from, #each, #initialize, #inspect, #keys, #refresh_from, #to_hash, #to_json, #to_s, #values
Constructor Details
This class inherits a constructor from Nurego::NuregoObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Nurego::NuregoObject
Class Method Details
.cancel_account ⇒ Object
23 24 25 26 |
# File 'lib/nurego/customer.rb', line 23 def self.cancel_account response, api_key = Nurego.request(:put, "/v1/customers/cancel", nil) Util.convert_to_nurego_object(response, api_key) end |
.me(api_key = nil) ⇒ Object
5 6 7 8 |
# File 'lib/nurego/customer.rb', line 5 def self.me(api_key = nil) response, api_key = Nurego.request(:get, me_url, api_key) Util.convert_to_nurego_object(response, api_key) end |
.me_url ⇒ Object
14 15 16 |
# File 'lib/nurego/customer.rb', line 14 def self.me_url '/v1/customers/me' end |
.update_plan(plan_id, sub_id) ⇒ Object
18 19 20 21 |
# File 'lib/nurego/customer.rb', line 18 def self.update_plan(plan_id, sub_id) response, api_key = Nurego.request(:post, "/v1/customers/subscriptions/#{CGI.escape(sub_id)}", nil, { :plan_id => plan_id }) Util.convert_to_nurego_object(response, api_key) end |
Instance Method Details
#organization ⇒ Object
10 11 12 |
# File 'lib/nurego/customer.rb', line 10 def organization Nurego::Organization.retrieve(id: self[:organization_id]) end |