Class: Aptible::Api::Account

Inherits:
Resource
  • Object
show all
Defined in:
lib/aptible/api/account.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

#namespace, #root_url

Class Method Details

.generate_handle(organization_name, plan_id) ⇒ Object



69
70
71
72
# File 'lib/aptible/api/account.rb', line 69

def self.generate_handle(organization_name, plan_id)
  rand = ('a'..'z').to_a.sample(8).join
  "#{organization_name.parameterize}-#{plan_id}-#{rand}"
end

Instance Method Details

#dumptruck_portObject



53
54
55
56
# File 'lib/aptible/api/account.rb', line 53

def dumptruck_port
  # TODO: Fetch from API
  45022
end

#each_orphaned_backupObject



74
75
76
77
78
79
80
# File 'lib/aptible/api/account.rb', line 74

def each_orphaned_backup
  base_href = "#{links['backups'].base_href}?orphaned=true"
  Backup.each_page(href: base_href, headers: headers,
                   token: token) do |page|
    page.each { |entry| yield entry }
  end
end

#operationsObject



48
49
50
51
# File 'lib/aptible/api/account.rb', line 48

def operations
  # TODO: Implement /accounts/:id/operations
  []
end

#organizationObject



62
63
64
65
66
67
# File 'lib/aptible/api/account.rb', line 62

def organization
  return @organization if @organization

  auth = Aptible::Auth::Organization.new(token: token, headers: headers)
  @organization = auth.find_by_url(organization_url)
end

#organization_urlObject



58
59
60
# File 'lib/aptible/api/account.rb', line 58

def organization_url
  links['organization'].href
end

#production?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/aptible/api/account.rb', line 44

def production?
  type == 'production'
end