Class: Io::Flow::V0::Models::Invitation
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::Invitation
- 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
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#expiration ⇒ Object
readonly
Returns the value of attribute expiration.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#organization ⇒ Object
readonly
Returns the value of attribute organization.
-
#role ⇒ Object
readonly
Returns the value of attribute role.
-
#roles ⇒ Object
readonly
Returns the value of attribute roles.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ Invitation
constructor
A new instance of Invitation.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ Invitation
Returns a new instance of Invitation.
46635 46636 46637 46638 46639 46640 46641 46642 46643 46644 46645 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46635 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :organization, :email, :name, :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.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Role) ? x : ::Io::Flow::V0::Models::Role.apply(x))) @roles = (x = opts.delete(:roles); x.nil? ? nil : HttpClient::Preconditions.assert_class('roles', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::FlowRole) ? x : ::Io::Flow::V0::Models::FlowRole.apply(x)) }) @expiration = HttpClient::Preconditions.assert_class('expiration', HttpClient::Helper.to_date_time_iso8601(opts.delete(:expiration)), DateTime) end |
Instance Attribute Details
#email ⇒ Object (readonly)
Returns the value of attribute email.
46633 46634 46635 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46633 def email @email end |
#expiration ⇒ Object (readonly)
Returns the value of attribute expiration.
46633 46634 46635 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46633 def expiration @expiration end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
46633 46634 46635 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46633 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
46633 46634 46635 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46633 def name @name end |
#organization ⇒ Object (readonly)
Returns the value of attribute organization.
46633 46634 46635 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46633 def organization @organization end |
#role ⇒ Object (readonly)
Returns the value of attribute role.
46633 46634 46635 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46633 def role @role end |
#roles ⇒ Object (readonly)
Returns the value of attribute roles.
46633 46634 46635 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46633 def roles @roles end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
46651 46652 46653 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46651 def copy(incoming={}) Invitation.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
46655 46656 46657 46658 46659 46660 46661 46662 46663 46664 46665 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46655 def to_hash { :id => id, :organization => organization.to_hash, :email => email, :name => name.to_hash, :role => role.nil? ? nil : role.value, :roles => roles.nil? ? nil : roles.map { |o| o.value }, :expiration => expiration } end |
#to_json ⇒ Object
46647 46648 46649 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46647 def to_json JSON.dump(to_hash) end |