Class: Desmos::User
- Inherits:
-
Object
- Object
- Desmos::User
- Defined in:
- lib/desmos/user.rb
Instance Attribute Summary collapse
-
#hash ⇒ Object
Returns the value of attribute hash.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ User
constructor
A new instance of User.
- #request_options ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ User
Returns a new instance of User.
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/desmos/user.rb', line 5 def initialize( = {}) .recursive_symbolize_keys! @type = 'user' @hash = [:hash] raise ArgumentError, ':id is a required attribute' unless [:id] @id = [:id] raise ArgumentError, ':name is a required attribute' unless [:name] @name = [:name] end |
Instance Attribute Details
#hash ⇒ Object
Returns the value of attribute hash.
3 4 5 |
# File 'lib/desmos/user.rb', line 3 def hash @hash end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/desmos/user.rb', line 3 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/desmos/user.rb', line 3 def name @name end |
#type ⇒ Object
Returns the value of attribute type.
3 4 5 |
# File 'lib/desmos/user.rb', line 3 def type @type end |
Class Method Details
.build_from_hash(options = {}) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/desmos/user.rb', line 17 def self.build_from_hash( = {}) .recursive_symbolize_keys! return if [:id].blank? return if [:name].blank? new() end |
Instance Method Details
#request_options ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/desmos/user.rb', line 24 def = {} .merge!(:user_id => id) .merge!(:user_name => name) .merge!(:user_type => type) .merge!(:user_hash => hash) if hash end |