Class: Aptible::Auth::Organization

Inherits:
Resource
  • Object
show all
Defined in:
lib/aptible/auth/organization.rb

Instance Method Summary collapse

Methods inherited from Resource

#namespace, #root_url

Instance Method Details

#accountsObject



41
42
43
44
45
46
47
48
49
# File 'lib/aptible/auth/organization.rb', line 41

def accounts
  return @accounts if @accounts
  require 'aptible/api'

  accounts = Aptible::Api::Account.all(token: token, headers: headers)
  @accounts = accounts.select do ||
    (link = .links[:organization]) && link.href == href
  end
end

#billing_detailObject



26
27
28
29
30
# File 'lib/aptible/auth/organization.rb', line 26

def billing_detail
  @billing_detail ||= Aptible::Billing::BillingDetail.find(
    id, token: token, headers: headers
  )
end

#can_manage_compliance?Boolean

Returns:

  • (Boolean)


32
33
34
35
# File 'lib/aptible/auth/organization.rb', line 32

def can_manage_compliance?
  return false unless billing_detail
  %w(production pilot).include?(billing_detail.plan)
end

#privileged_rolesObject



37
38
39
# File 'lib/aptible/auth/organization.rb', line 37

def privileged_roles
  roles.select(&:privileged?)
end