Class: Aptible::Api::Account
- Defined in:
- lib/aptible/api/account.rb
Class Method Summary collapse
Instance Method Summary collapse
- #dumptruck_port ⇒ Object
- #each_orphaned_backup ⇒ Object
- #operations ⇒ Object
- #organization ⇒ Object
- #organization_url ⇒ Object
- #production? ⇒ Boolean
Methods inherited from Resource
Class Method Details
.generate_handle(organization_name, plan_id) ⇒ Object
65 66 67 68 |
# File 'lib/aptible/api/account.rb', line 65 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_port ⇒ Object
49 50 51 52 |
# File 'lib/aptible/api/account.rb', line 49 def dumptruck_port # TODO: Fetch from API 45022 end |
#each_orphaned_backup ⇒ Object
70 71 72 73 74 75 76 |
# File 'lib/aptible/api/account.rb', line 70 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 |
#operations ⇒ Object
44 45 46 47 |
# File 'lib/aptible/api/account.rb', line 44 def operations # TODO: Implement /accounts/:id/operations [] end |
#organization ⇒ Object
58 59 60 61 62 63 |
# File 'lib/aptible/api/account.rb', line 58 def organization return @organization if @organization auth = Aptible::Auth::Organization.new(token: token, headers: headers) @organization = auth.find_by_url(organization_url) end |
#organization_url ⇒ Object
54 55 56 |
# File 'lib/aptible/api/account.rb', line 54 def organization_url links['organization'].href end |
#production? ⇒ Boolean
40 41 42 |
# File 'lib/aptible/api/account.rb', line 40 def production? type == 'production' end |