Sha256: 025ab4ec350a74265de738a424d59bf313e4929b6a53171aacf835fb87b7b1fb

Contents?: true

Size: 815 Bytes

Versions: 9

Compression:

Stored size: 815 Bytes

Contents

require "jdc/cli/populators/base"
require "jdc/cli/populators/populator_methods"

module JDC 
  module Populators
    class Organization < Base
      include PopulatorMethods

      def changed
        info[:space] = nil
      end

      private

      def choices
        organization_response = client.organizations_first_page(:depth => 0)
        if organization_response[:next_page]
          "Login successful. Too many organizations (>50) to list. Remember to set your target organization using 'target -o [ORGANIZATION]'."
        else
          organization_response[:results]
        end
      end

      def valid?(organization)
        return false unless organization.guid
        organization.users.include? client.current_user
      rescue JFoundry::APIError
        false
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
jdc-0.2.7 lib/jdc/cli/populators/organization.rb
jdc-0.2.5 lib/jdc/cli/populators/organization.rb
jdc-0.2.4 lib/jdc/cli/populators/organization.rb
jdc-0.2.3 lib/jdc/cli/populators/organization.rb
jdc-0.2.2 lib/jdc/cli/populators/organization.rb
jdc-0.2.3.pre lib/jdc/cli/populators/organization.rb
jdc-0.2.2.pre lib/jdc/cli/populators/organization.rb
jdc-0.2.1.pre lib/jdc/cli/populators/organization.rb
jdc-0.2.0 lib/jdc/cli/populators/organization.rb