Class: Ey::Core::Client::Account

Inherits:
Model
  • Object
show all
Extended by:
Associations
Defined in:
lib/ey-core/models/account.rb

Instance Attribute Summary collapse

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_prefixObject

only used on account create



41
42
43
# File 'lib/ey-core/models/account.rb', line 41

def name_prefix
  @name_prefix
end

#planObject

only used on account create



41
42
43
# File 'lib/ey-core/models/account.rb', line 41

def plan
  @plan
end

Instance Method Details

#cancel!(params = {}) ⇒ Object



43
44
45
46
# File 'lib/ey-core/models/account.rb', line 43

def cancel!(params = {})
  result = self.connection.(self.id, params[:requested_by].id).body
  Ey::Core::Client::AccountCancellation.new(result["cancellation"])
end

#retrieve_docker_registry_credentials(location_id) ⇒ Hashie::Mash

Get authorization data for an Amazon ECR registry.

Parameters:

  • location_id (String)

    Aws region

Returns:

  • (Hashie::Mash)


76
77
78
79
# File 'lib/ey-core/models/account.rb', line 76

def retrieve_docker_registry_credentials(location_id)
  result = self.connection.retrieve_docker_registry_credentials(self.id, location_id).body
  ::Hashie::Mash.new(result['docker_registry_credentials'])
end

#save!Object



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/ey-core/models/account.rb', line 48

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. if self.
  params["account"]["type"]       = self.type       if self.type

  if new_record?
    merge_attributes(self.connection.(params).body["account"])
  else raise NotImplementedError # update
  end
end