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(client:, params:) ⇒ User
constructor
A new instance of User.
Methods inherited from Resource
#==, #created_at, #eql?, #hash, #to_json, #updated_at
Constructor Details
#initialize(client:, params:) ⇒ User
Returns a new instance of User
5 6 7 8 9 10 |
# File 'lib/helium/user.rb', line 5 def initialize(client:, params:) super(client: client, params: params) @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 |