Sha256: 0ed25db9ae697cb5e06bf8b40108276f7c3e1d396c9339766ecbd027903f52a6

Contents?: true

Size: 757 Bytes

Versions: 9

Compression:

Stored size: 757 Bytes

Contents

require 'kontena/client'
require_relative '../common'

module Kontena::Cli::Grids
  class Users
    include Kontena::Cli::Common

    def add(email)
      require_api_url
      token = require_token
      data = { email: email }
      client(token).post("grids/#{current_grid}/users", data)
    end

    def remove(email)
      require_api_url
      token = require_token
      result = client(token).delete("grids/#{current_grid}/users/#{email}")
    end

    def list
      require_api_url
      token = require_token
      result = client(token).get("grids/#{current_grid}/users")
      puts "%-40s %-40s" % ['Email', 'Name']
      result['users'].each { |user|
        puts "%-40.40s %-40.40s" % [user['email'], user['name']]
      }
    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
kontena-cli-0.7.3 lib/kontena/cli/grids/users.rb
kontena-cli-0.7.2 lib/kontena/cli/grids/users.rb
kontena-cli-0.7.1 lib/kontena/cli/grids/users.rb
kontena-cli-0.7.0 lib/kontena/cli/grids/users.rb
kontena-cli-0.6.1 lib/kontena/cli/grids/users.rb
kontena-cli-0.6.0 lib/kontena/cli/grids/users.rb
kontena-cli-0.5.0 lib/kontena/cli/grids/users.rb
kontena-cli-0.0.2 lib/kontena/cli/grids/users.rb
kontena-cli-0.0.1 lib/kontena/cli/grids/users.rb