Sha256: 89edba4058d54ecc8dc181a085c74f822c1eb02c53fabe6bd4d562c21e408629

Contents?: true

Size: 1.34 KB

Versions: 16

Compression:

Stored size: 1.34 KB

Contents

# -*- coding: utf-8 -*-
require "magellan/cli/resources"

module Magellan
  module Cli
    module Resources

      class Team < Base
        include Deletable

        self.resource_key = "magellan~auth~team"
        self.resource_dependency = { "organization" =>  Organization.parameter_name }
        self.field_associations = {"organization_id" => {name: "organization", class: "Organization"} }

        desc "create NAME ROLE", I18n.t(:create, scope: [:resources, :team, :cmd], resource_name: resource_name)
        def create(name, role)
          unless %w{ reader admin }.include?(role)
            raise "ROLE should be 'reader' or 'admin'"
          end
          o = load_selection!(Organization)
          params = {
            parameter_name => {
              "organization_id" => o["id"],
              "name" => name,
              "role" => role,
            }
          }
          post_json("/admin/#{self.resource_key}/new.json", params)
          select(name)
        end

=begin
        desc "invite EMAIL", I18n.t(:invite, scope: [:resources, :team, :cmd], resource_name: resource_name)
        def invite(email)
          o = load_selection!(self.class)
          params = {
            "email" => email
          }
          post_json("/admin/#{self.resource_key}/#{o["id"]}/team_invite.json", params)
        end
=end
      end

    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
magellan-cli-0.10.0 lib/magellan/cli/resources/team.rb
magellan-cli-0.9.1 lib/magellan/cli/resources/team.rb
magellan-cli-0.9.0 lib/magellan/cli/resources/team.rb
magellan-cli-0.8.3 lib/magellan/cli/resources/team.rb
magellan-cli-0.8.2 lib/magellan/cli/resources/team.rb
magellan-cli-0.8.1 lib/magellan/cli/resources/team.rb
magellan-cli-0.8.0 lib/magellan/cli/resources/team.rb
magellan-cli-0.7.11 lib/magellan/cli/resources/team.rb
magellan-cli-0.7.10 lib/magellan/cli/resources/team.rb
magellan-cli-0.7.9 lib/magellan/cli/resources/team.rb
magellan-cli-0.7.8 lib/magellan/cli/resources/team.rb
magellan-cli-0.7.7 lib/magellan/cli/resources/team.rb
magellan-cli-0.7.6 lib/magellan/cli/resources/team.rb
magellan-cli-0.7.5 lib/magellan/cli/resources/team.rb
magellan-cli-0.7.4 lib/magellan/cli/resources/team.rb
magellan-cli-0.7.3 lib/magellan/cli/resources/team.rb