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.
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.
22259 22260 22261 22262 22263 22264 22265 22266 22267 22268 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22259 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
#email ⇒ Object (readonly)
Returns the value of attribute email.
22257 22258 22259 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22257 def email @email end |
#expiration ⇒ Object (readonly)
Returns the value of attribute expiration.
22257 22258 22259 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22257 def expiration @expiration end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
22257 22258 22259 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22257 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
22257 22258 22259 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22257 def name @name end |
#organization ⇒ Object (readonly)
Returns the value of attribute organization.
22257 22258 22259 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22257 def organization @organization end |
#role ⇒ Object (readonly)
Returns the value of attribute role.
22257 22258 22259 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22257 def role @role end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
22274 22275 22276 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22274 def copy(incoming={}) Invitation.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
22278 22279 22280 22281 22282 22283 22284 22285 22286 22287 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22278 def to_hash { :id => id, :organization => organization.to_hash, :email => email, :name => name.to_hash, :role => role.value, :expiration => expiration } end |
#to_json ⇒ Object
22270 22271 22272 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22270 def to_json JSON.dump(to_hash) end |