Sha256: 856f4e742b0e4b2bd9ad65d8eb44f5d215047ea13f71a2d69c6f6da44401ca01

Contents?: true

Size: 1.24 KB

Versions: 245

Compression:

Stored size: 1.24 KB

Contents

module Spaceship
  module Portal
    class Persons < PortalBase
      class << self
        def all
          members = client.team_members
          all_members = []
          member = factory_member(members["members"], "member")
          admins = factory_member(members["admins"], "admin")
          agent  = factory_member(members["agent"], "agent")

          all_members.concat(member)
          all_members.concat(admins)
          all_members << agent

          return all_members
        end

        def factory_member(members, type)
          if members.kind_of?(Hash)
            attrs = members
            attrs[:type] = type
            return Spaceship::Portal::Person.factory(attrs)
          end
          final_members = []
          members.each do |member|
            attrs = member
            attrs[:type] = type
            final_members << Spaceship::Portal::Person.factory(attrs)
          end
          return final_members
        end

        def find(email)
          all.each do |member|
            if member.email_address == email
              return member
            end
          end
          return nil
        end

        def invite(email, role)
          client.team_invite(email, role)
        end
      end
    end
  end
end

Version data entries

245 entries across 245 versions & 1 rubygems

Version Path
fastlane-2.52.0.beta.20170808010002 spaceship/lib/spaceship/portal/persons.rb
fastlane-2.51.0 spaceship/lib/spaceship/portal/persons.rb
fastlane-2.51.0.beta.20170807010003 spaceship/lib/spaceship/portal/persons.rb
fastlane-2.51.0.beta.20170806010003 spaceship/lib/spaceship/portal/persons.rb
fastlane-2.51.0.beta.20170805010003 spaceship/lib/spaceship/portal/persons.rb
fastlane-2.51.0.beta.20170804010003 spaceship/lib/spaceship/portal/persons.rb
fastlane-2.51.0.beta.20170803010003 spaceship/lib/spaceship/portal/persons.rb
fastlane-2.50.1 spaceship/lib/spaceship/portal/persons.rb
fastlane-2.51.0.beta.20170802010003 spaceship/lib/spaceship/portal/persons.rb
fastlane-2.51.0.beta.20170801010002 spaceship/lib/spaceship/portal/persons.rb
fastlane-2.50.0 spaceship/lib/spaceship/portal/persons.rb
fastlane-2.50.0.beta.20170731010002 spaceship/lib/spaceship/portal/persons.rb
fastlane-2.50.0.beta.20170730010002 spaceship/lib/spaceship/portal/persons.rb
fastlane-2.50.0.beta.20170729010003 spaceship/lib/spaceship/portal/persons.rb
fastlane-2.50.0.beta.20170728010002 spaceship/lib/spaceship/portal/persons.rb
fastlane-2.50.0.beta.20170727010003 spaceship/lib/spaceship/portal/persons.rb
fastlane-2.49.0 spaceship/lib/spaceship/portal/persons.rb
fastlane-2.49.0.beta.20170726010003 spaceship/lib/spaceship/portal/persons.rb
fastlane-2.49.0.beta.20170725010003 spaceship/lib/spaceship/portal/persons.rb
fastlane-2.48.0 spaceship/lib/spaceship/portal/persons.rb