Class: Io::Flow::V0::Models::User
- Inherits:
-
ExpandableUser
- Object
- ExpandableUser
- Io::Flow::V0::Models::User
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Represents a single user in the system
Instance Attribute Summary collapse
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ User
constructor
A new instance of User.
- #subtype_to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from ExpandableUser
Constructor Details
#initialize(incoming = {}) ⇒ User
Returns a new instance of User.
16608 16609 16610 16611 16612 16613 16614 16615 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16608 def initialize(incoming={}) super(:name => ExpandableUser::Types::USER) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :name], 'User') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @email = (x = opts.delete(:email); x.nil? ? nil : HttpClient::Preconditions.assert_class('email', x, String)) @name = (x = opts.delete(:name); x.is_a?(::Io::Flow::V0::Models::Name) ? x : ::Io::Flow::V0::Models::Name.new(x)) end |
Instance Attribute Details
#email ⇒ Object (readonly)
Returns the value of attribute email.
16606 16607 16608 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16606 def email @email end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
16606 16607 16608 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16606 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
16606 16607 16608 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16606 def name @name end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
16621 16622 16623 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16621 def copy(incoming={}) User.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
16625 16626 16627 16628 16629 16630 16631 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16625 def subtype_to_hash { :id => id, :email => email, :name => name.to_hash } end |
#to_json ⇒ Object
16617 16618 16619 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16617 def to_json JSON.dump(to_hash) end |