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



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

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



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

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

#can_manage_compliance?Boolean

Returns:

  • (Boolean)


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

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

#privileged_rolesObject



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

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