Class: LucidIntercom::UserAttributes

Inherits:
Attributes show all
Defined in:
lib/lucid_intercom/user_attributes.rb

Instance Method Summary collapse

Methods inherited from Attributes

#app_data, #shopify_data

Instance Method Details

#companyCompanyAttributes

Returns:



8
# File 'lib/lucid_intercom/user_attributes.rb', line 8

param :company, default: -> { CompanyAttributes.new(shopify_data, app_data) }

#idString

Returns:

  • (String)


36
37
38
# File 'lib/lucid_intercom/user_attributes.rb', line 36

def id
  shopify_data[id_key.to_s]
end

#id_keySymbol

Either :user_id or :email. Currently, we are using the email address.

Returns:

  • (Symbol)


29
30
31
# File 'lib/lucid_intercom/user_attributes.rb', line 29

def id_key
  :email
end

#to_h(browser: false, convert: Container[:convert]) ⇒ Hash

Parameters:

  • browser (Boolean) (defaults to: false)

    format for browser snippet

  • convert (#call) (defaults to: Container[:convert])

Returns:

  • (Hash)


16
17
18
19
20
21
22
# File 'lib/lucid_intercom/user_attributes.rb', line 16

def to_h(browser: false, convert: Container[:convert])
  convert.({}.tap do |h|
    h[:user_hash] = user_hash(id) if browser # or myshopify_domain
    h[:email] = shopify_data['email']
    h[:name] = shopify_data['shop_owner']
  end)
end