Sha256: 1d3110d0208c9b39fbc5245aa48ec7f25fb195ea9e881d71242e84dee685feae

Contents?: true

Size: 1.32 KB

Versions: 19

Compression:

Stored size: 1.32 KB

Contents

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

module Magellan
  module Cli
    module Resources

      class Team < Base
        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

19 entries across 19 versions & 1 rubygems

Version Path
magellan-cli-0.7.2 lib/magellan/cli/resources/team.rb
magellan-cli-0.7.1 lib/magellan/cli/resources/team.rb
magellan-cli-0.7.0 lib/magellan/cli/resources/team.rb
magellan-cli-0.6.5 lib/magellan/cli/resources/team.rb
magellan-cli-0.6.4 lib/magellan/cli/resources/team.rb
magellan-cli-0.6.3 lib/magellan/cli/resources/team.rb
magellan-cli-0.6.2 lib/magellan/cli/resources/team.rb
magellan-cli-0.6.1 lib/magellan/cli/resources/team.rb
magellan-cli-0.6.0 lib/magellan/cli/resources/team.rb
magellan-cli-0.5.9 lib/magellan/cli/resources/team.rb
magellan-cli-0.5.8 lib/magellan/cli/resources/team.rb
magellan-cli-0.5.7 lib/magellan/cli/resources/team.rb
magellan-cli-0.5.6 lib/magellan/cli/resources/team.rb
magellan-cli-0.5.5 lib/magellan/cli/resources/team.rb
magellan-cli-0.5.4 lib/magellan/cli/resources/team.rb
magellan-cli-0.5.3 lib/magellan/cli/resources/team.rb
magellan-cli-0.5.2 lib/magellan/cli/resources/team.rb
magellan-cli-0.5.1 lib/magellan/cli/resources/team.rb
magellan-cli-0.5.0 lib/magellan/cli/resources/team.rb