Class: Io::Flow::V0::Models::Invitation

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

An invitation via email to a user to join this organization. The user will then walk through a user login/registration process and will immediately become a member of the organization.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ Invitation

Returns a new instance of Invitation.



17990
17991
17992
17993
17994
17995
17996
17997
17998
17999
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17990

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :organization, :email, :name, :role, :expiration], 'Invitation')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @organization = (x = opts.delete(:organization); x.is_a?(::Io::Flow::V0::Models::ExpandableOrganization) ? x : ::Io::Flow::V0::Models::ExpandableOrganization.from_json(x))
  @email = HttpClient::Preconditions.assert_class('email', opts.delete(:email), String)
  @name = (x = opts.delete(:name); x.is_a?(::Io::Flow::V0::Models::Name) ? x : ::Io::Flow::V0::Models::Name.new(x))
  @role = (x = opts.delete(:role); x.is_a?(::Io::Flow::V0::Models::Role) ? x : ::Io::Flow::V0::Models::Role.apply(x))
  @expiration = HttpClient::Preconditions.assert_class('expiration', HttpClient::Helper.to_date_time_iso8601(opts.delete(:expiration)), DateTime)
end

Instance Attribute Details

#emailObject (readonly)

Returns the value of attribute email.



17988
17989
17990
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17988

def email
  @email
end

#expirationObject (readonly)

Returns the value of attribute expiration.



17988
17989
17990
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17988

def expiration
  @expiration
end

#idObject (readonly)

Returns the value of attribute id.



17988
17989
17990
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17988

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



17988
17989
17990
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17988

def name
  @name
end

#organizationObject (readonly)

Returns the value of attribute organization.



17988
17989
17990
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17988

def organization
  @organization
end

#roleObject (readonly)

Returns the value of attribute role.



17988
17989
17990
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17988

def role
  @role
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



18005
18006
18007
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18005

def copy(incoming={})
  Invitation.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



18009
18010
18011
18012
18013
18014
18015
18016
18017
18018
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18009

def to_hash
  {
    :id => id,
    :organization => organization.to_hash,
    :email => email,
    :name => name.to_hash,
    :role => role.value,
    :expiration => expiration
  }
end

#to_jsonObject



18001
18002
18003
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18001

def to_json
  JSON.dump(to_hash)
end