Sha256: e26b0013cfc378cde0dc3b04ea98fb2c8425f54cd393ab073f7440989e281a47

Contents?: true

Size: 1.45 KB

Versions: 3

Compression:

Stored size: 1.45 KB

Contents

require_relative 'portal_base'

module Spaceship
  module Portal
    class Invite < PortalBase
      # @return (String) Invite Id
      attr_accessor :invite_id

      # @return (String) Inviter name
      attr_accessor :inviter_name

      # @return (String) Recipient Email Address
      attr_accessor :email_address

      # @return (String) Role (member, admin or agent)
      attr_accessor :type

      # @return (String) Invite creation date
      attr_accessor :created

      # @return (String) Invite expiration date
      attr_accessor :expires

      attr_mapping(
        'inviteId' => :invite_id,
        'inviterName' => :inviter_name,
        'recipientEmail' => :email_address,
        'recipientRole' => :type,
        'dateCreated' => :created,
        'dateExpires' => :expires
      )

      class << self
        def factory(attrs)
          begin
            attrs['dateCreated'] = Time.at(attrs['dateCreated'] / 1000).utc
          rescue NoMethodError
            # if attrs['dateCreated'] does not implement /
          rescue TypeError
            # if Time.at receives an invalid type
          end
          begin
            attrs['dateExpires'] = Time.at(attrs['dateExpires'] / 1000).utc
          rescue NoMethodError
          rescue TypeError
          end
          attrs['recipientRole'] = attrs['recipientRole'].downcase
          return self.new(attrs)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fastlane_hotfix-2.165.1 spaceship/lib/spaceship/portal/invite.rb
fastlane_hotfix-2.165.0 spaceship/lib/spaceship/portal/invite.rb
fastlane_hotfix-2.187.0 spaceship/lib/spaceship/portal/invite.rb