Class: Aptible::Api::Account
- Defined in:
- lib/aptible/api/account.rb
Class Method Summary collapse
Instance Method Summary collapse
- #billforward_subscription ⇒ Object
- #dumptruck_port ⇒ Object
- #operations ⇒ Object
- #organization ⇒ Object
- #organization_url ⇒ Object
- #production? ⇒ Boolean
Methods inherited from Resource
Class Method Details
.generate_handle(organization_name, plan_id) ⇒ Object
63 64 65 66 |
# File 'lib/aptible/api/account.rb', line 63 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
#billforward_subscription ⇒ Object
33 34 35 36 37 |
# File 'lib/aptible/api/account.rb', line 33 def billforward_subscription return nil if billforward_subscription_id.nil? @billforward_subscription ||= Aptible::BillForward::Subscription.find(billforward_subscription_id) end |
#dumptruck_port ⇒ Object
48 49 50 51 |
# File 'lib/aptible/api/account.rb', line 48 def dumptruck_port # TODO: Fetch from API 45022 end |
#operations ⇒ Object
43 44 45 46 |
# File 'lib/aptible/api/account.rb', line 43 def operations # TODO: Implement /accounts/:id/operations [] end |
#organization ⇒ Object
57 58 59 60 61 |
# File 'lib/aptible/api/account.rb', line 57 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
53 54 55 |
# File 'lib/aptible/api/account.rb', line 53 def organization_url links['organization'].href end |
#production? ⇒ Boolean
39 40 41 |
# File 'lib/aptible/api/account.rb', line 39 def production? type == 'production' end |