Class: HelpScout::Customer
- Defined in:
- lib/help_scout/customer.rb
Constant Summary collapse
- BASIC_ATTRIBUTES =
%i[ first_name last_name photo_url job_title photo_type background location created_at updated_at organization gender age id ].freeze
- EMBEDDED_ATTRIBUTES =
%i[ addresses chats emails phones social_profiles websites ].freeze
Instance Attribute Summary collapse
-
#hrefs ⇒ Object
readonly
Returns the value of attribute hrefs.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Customer
constructor
A new instance of Customer.
Methods included from Getable
Methods included from Listable
Methods inherited from Base
Constructor Details
#initialize(params = {}) ⇒ Customer
Returns a new instance of Customer.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/help_scout/customer.rb', line 34 def initialize(params = {}) BASIC_ATTRIBUTES.each do |attribute| next unless params[attribute] instance_variable_set("@#{attribute}", params[attribute]) end = params.fetch(:_embedded, {}) EMBEDDED_ATTRIBUTES.each do |attribute| next unless [attribute] instance_variable_set("@#{attribute}", [attribute]) end @hrefs = HelpScout::Util.map_links(params[:_links]) end |
Instance Attribute Details
#hrefs ⇒ Object (readonly)
Returns the value of attribute hrefs.
32 33 34 |
# File 'lib/help_scout/customer.rb', line 32 def hrefs @hrefs end |