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.
-
#pending_invite ⇒ Object
(also: #pending_invite?)
readonly
Returns the value of attribute pending_invite.
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.
- #resource_path ⇒ Object
Methods inherited from Resource
#==, all, all_path, create, #created_at, #destroy, #eql?, find, #hash, initialize_from_path, #metadata, resource_name, #resource_name, singleton, #to_json, #update, #updated_at
Methods included from Utils
Constructor Details
#initialize(opts = {}) ⇒ User
Returns a new instance of User.
6 7 8 9 10 11 12 |
# File 'lib/helium/user.rb', line 6 def initialize(opts = {}) super(opts) @name = @params.dig('attributes', 'name') @email = @params.dig('meta', 'email') @pending_invite = @params.dig('meta', 'pending_invite') 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 |
#pending_invite ⇒ Object (readonly) Also known as: pending_invite?
Returns the value of attribute pending_invite.
3 4 5 |
# File 'lib/helium/user.rb', line 3 def pending_invite @pending_invite end |
Instance Method Details
#as_json ⇒ Object
TODO can probably generalize this a bit more
19 20 21 22 23 24 25 |
# File 'lib/helium/user.rb', line 19 def as_json super.merge({ name: name, email: email, pending_invite: pending_invite }) end |
#resource_path ⇒ Object
14 15 16 |
# File 'lib/helium/user.rb', line 14 def resource_path "/user" end |