class HelpScout::Customer

Constants

BASIC_ATTRIBUTES
EMBEDDED_ATTRIBUTES

Attributes

hrefs[R]

Public Class Methods

new(params = {}) click to toggle source
# 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

  embedded_params = params.fetch(:_embedded, {})
  EMBEDDED_ATTRIBUTES.each do |attribute|
    next unless embedded_params[attribute]

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

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