Class: Ey::Core::Client::Account
- Extended by:
- Associations
- Defined in:
- lib/ey-core/models/account.rb
Instance Attribute Summary collapse
-
#name_prefix ⇒ Object
only used on account create.
-
#plan ⇒ Object
only used on account create.
Instance Method Summary collapse
Methods included from Associations
assoc_accessor, assoc_coverage, assoc_reader, assoc_writer, associations, collection_reader
Methods inherited from Model
#destroy, range_parser, #save, #to_s, #update!, #url
Instance Attribute Details
#name_prefix ⇒ Object
only used on account create
35 36 37 |
# File 'lib/ey-core/models/account.rb', line 35 def name_prefix @name_prefix end |
#plan ⇒ Object
only used on account create
35 36 37 |
# File 'lib/ey-core/models/account.rb', line 35 def plan @plan end |
Instance Method Details
#cancel!(params = {}) ⇒ Object
37 38 39 40 |
# File 'lib/ey-core/models/account.rb', line 37 def cancel!(params = {}) result = self.connection.cancel_account(self.id, params[:requested_by].id).body Ey::Core::Client::AccountCancellation.new(result["cancellation"]) end |
#save! ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/ey-core/models/account.rb', line 42 def save! requires_one :name, :name_prefix params = { "account" => { "plan" => self.plan || "standard-20140130", }, "owner" => self.owner_id, } if self.name params["account"]["name"] = self.name elsif self.name_prefix params["account"]["name_prefix"] = self.name_prefix end params["account"]["signup_via"] = self.signup_via if self.signup_via params["account"]["type"] = self.type if self.type if new_record? merge_attributes(self.connection.create_account(params).body["account"]) else raise NotImplementedError # update end end |