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.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Attributes inherited from ExpandableUser
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.
28884 28885 28886 28887 28888 28889 28890 28891 28892 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28884 def initialize(incoming={}) super(:discriminator => 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)) @status = (x = (x = opts.delete(:status); x.nil? ? "active" : x); x.is_a?(::Io::Flow::V0::Models::UserStatus) ? x : ::Io::Flow::V0::Models::UserStatus.apply(x)) end |
Instance Attribute Details
#email ⇒ Object (readonly)
Returns the value of attribute email.
28882 28883 28884 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28882 def email @email end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
28882 28883 28884 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28882 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
28882 28883 28884 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28882 def name @name end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
28882 28883 28884 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28882 def status @status end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
28898 28899 28900 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28898 def copy(incoming={}) User.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
28902 28903 28904 28905 28906 28907 28908 28909 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28902 def subtype_to_hash { :id => id, :email => email, :name => name.to_hash, :status => status.value } end |
#to_json ⇒ Object
28894 28895 28896 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28894 def to_json JSON.dump(to_hash) end |