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_or_user = {}, app_data = {}) ⇒ String
21 22 23 24 25 26 27 28 |
# File 'lib/lucid_intercom/render_snippet.rb', line 21 def call(shopify_data_or_user = {}, app_data = {}) user = shopify_data_or_user user = UserAttributes.new(user, app_data) if user.is_a?(Hash) settings = shopify_data_or_user.is_a?(Hash) && shopify_data_or_user.empty? ? unauthenticated_settings : authenticated_settings(user) TEMPLATE % {settings: settings.to_json, app_id: settings[:app_id]} end |