Class: Helium::User

Inherits:
Resource show all
Defined in:
lib/helium/user.rb

Instance Attribute Summary collapse

Attributes inherited from Resource

#id

Instance Method Summary collapse

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

#emailObject (readonly)

Returns the value of attribute email



3
4
5
# File 'lib/helium/user.rb', line 3

def email
  @email
end

#nameObject (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_jsonObject

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