Class: LucidIntercom::RenderSnippet
- Inherits:
-
Object
- Object
- LucidIntercom::RenderSnippet
- Defined in:
- lib/lucid_intercom/render_snippet.rb
Constant Summary collapse
- TEMPLATE =
File.read("#{__dir__}/snippet.html").freeze
Instance Method Summary collapse
Instance Method Details
#call(shopify_data = {}, app_data = {}) ⇒ String
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/lucid_intercom/render_snippet.rb', line 21 def call(shopify_data = {}, app_data = {}) settings = shopify_data.empty? ? unauthenticated_settings : { **unauthenticated_settings, **UserAttributes.new(shopify_data).to_h(browser: true), company: CompanyAttributes.new(shopify_data).to_h(browser: true).merge(CompanyCustomAttributes.new(shopify_data, app_data).to_h) } TEMPLATE % { settings: settings.to_json, app_id: settings[:app_id], } end |