Class: Helium::User
Instance Attribute Summary collapse
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Attributes inherited from Resource
Instance Method Summary collapse
-
#as_json ⇒ Object
TODO can probably generalize this a bit more.
-
#initialize(opts = {}) ⇒ User
constructor
A new instance of User.
Methods inherited from Resource
#==, all, create, #created_at, #destroy, #eql?, find, #hash, #to_json, #update, #updated_at
Constructor Details
#initialize(opts = {}) ⇒ User
Returns a new instance of User
5 6 7 8 9 10 |
# File 'lib/helium/user.rb', line 5 def initialize(opts = {}) super(opts) @name = @params.dig('attributes', 'name') @email = @params.dig('meta', 'email') end |
Instance Attribute Details
#email ⇒ Object (readonly)
Returns the value of attribute email
3 4 5 |
# File 'lib/helium/user.rb', line 3 def email @email end |
#name ⇒ Object (readonly)
Returns the value of attribute name
3 4 5 |
# File 'lib/helium/user.rb', line 3 def name @name end |
Instance Method Details
#as_json ⇒ Object
TODO can probably generalize this a bit more
13 14 15 16 17 18 |
# File 'lib/helium/user.rb', line 13 def as_json super.merge({ name: name, email: email }) end |