Class: HelpScout::User

Inherits:
Base
  • Object
show all
Extended by:
Getable, Listable
Defined in:
lib/help_scout/user.rb

Constant Summary collapse

BASIC_ATTRIBUTES =
%i[
  id
  first_name
  last_name
  email
  created_at
  updated_at
  role
  timezone
  type
  photoUrl
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Getable

get

Methods included from Listable

list, list_path

Methods inherited from Base

#as_json, #to_h, #to_json

Constructor Details

#initialize(params = {}) ⇒ User

Returns a new instance of User.



24
25
26
27
28
29
30
31
32
# File 'lib/help_scout/user.rb', line 24

def initialize(params = {})
  BASIC_ATTRIBUTES.each do |attribute|
    next unless params[attribute]

    instance_variable_set("@#{attribute}", params[attribute])
  end

  @hrefs = HelpScout::Util.map_links(params[:_links])
end

Instance Attribute Details

#hrefsObject (readonly)

Returns the value of attribute hrefs.



22
23
24
# File 'lib/help_scout/user.rb', line 22

def hrefs
  @hrefs
end