Module: Kontena::Plugin::Cloud::Organization::Common

Included in:
Node::CreateCommand, Node::ListCommand, ListCommand, Platform::ListCommand, Platform::UseCommand
Defined in:
lib/kontena/plugin/cloud/organization/common.rb

Instance Method Summary collapse

Instance Method Details

#fetch_organizationsObject



5
6
7
8
9
10
# File 'lib/kontena/plugin/cloud/organization/common.rb', line 5

def fetch_organizations
  organizations = cloud_client.get("/organizations/")['data']
  organizations.map do |o|
    Kontena::Cli::Models::Organization.new(o)
  end
end

#prompt_organizationObject



12
13
14
15
16
17
18
19
# File 'lib/kontena/plugin/cloud/organization/common.rb', line 12

def prompt_organization
  organizations = fetch_organizations
  prompt.select("Choose organization") do |menu|
    organizations.each do |o|
      menu.choice o.name, o.name
    end
  end
end