lucid_intercom 0.4.2 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +12 -22
  3. data/lib/lucid_intercom/attributes.rb +10 -42
  4. data/lib/lucid_intercom/changed_plan_event.rb +31 -0
  5. data/lib/lucid_intercom/company_attributes.rb +21 -0
  6. data/lib/lucid_intercom/company_custom_attributes.rb +48 -0
  7. data/lib/lucid_intercom/config.rb +44 -0
  8. data/lib/lucid_intercom/convert.rb +32 -0
  9. data/lib/lucid_intercom/{errors/error.rb → error.rb} +0 -0
  10. data/lib/lucid_intercom/event.rb +77 -0
  11. data/lib/lucid_intercom/installed_event.rb +31 -0
  12. data/lib/lucid_intercom/post_request.rb +26 -0
  13. data/lib/lucid_intercom/render_snippet.rb +28 -24
  14. data/lib/lucid_intercom/response.rb +51 -0
  15. data/lib/lucid_intercom/send_event.rb +22 -60
  16. data/lib/lucid_intercom/snippet.html.erb +2 -14
  17. data/lib/lucid_intercom/uninstalled_event.rb +27 -0
  18. data/lib/lucid_intercom/update_user.rb +24 -54
  19. data/lib/lucid_intercom/user_attributes.rb +47 -0
  20. data/lib/lucid_intercom/version.rb +1 -1
  21. data/lib/lucid_intercom.rb +18 -6
  22. metadata +56 -16
  23. data/lib/lucid_intercom/attributes/base.rb +0 -63
  24. data/lib/lucid_intercom/attributes/company.rb +0 -22
  25. data/lib/lucid_intercom/attributes/custom.rb +0 -47
  26. data/lib/lucid_intercom/attributes/user.rb +0 -28
  27. data/lib/lucid_intercom/credentials.rb +0 -35
  28. data/lib/lucid_intercom/errors/missing_credentials_error.rb +0 -7
  29. data/lib/lucid_intercom/errors/request_error.rb +0 -17
  30. data/lib/lucid_intercom/errors.rb +0 -3
  31. data/lib/lucid_intercom/events/base.rb +0 -23
  32. data/lib/lucid_intercom/events/changed_plan.rb +0 -37
  33. data/lib/lucid_intercom/events/installed.rb +0 -37
  34. data/lib/lucid_intercom/events/uninstalled.rb +0 -33
  35. data/lib/lucid_intercom/events.rb +0 -5
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'lucid_intercom/credentials'
4
- require 'lucid_intercom/send_event'
5
- require 'lucid_intercom/update_user'
6
- require 'lucid_intercom/events/base'
7
-
8
- module LucidIntercom
9
- module Events
10
- class Uninstalled < Base
11
- def call
12
- LucidIntercom::UpdateUser.new(shop_attributes, {plan: nil}, credentials).()
13
- LucidIntercom::SendEvent.new(shop_attributes, credentials).(event_name, event_metadata)
14
- end
15
-
16
- #
17
- # @return [String]
18
- #
19
- private def event_name
20
- "#{credentials.app_prefix}_uninstalled"
21
- end
22
-
23
- #
24
- # @return [Hash]
25
- #
26
- private def event_metadata
27
- {
28
- company_id: shop_attributes['myshopify_domain'],
29
- }
30
- end
31
- end
32
- end
33
- end
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'lucid_intercom/events/installed'
4
- require 'lucid_intercom/events/uninstalled'
5
- require 'lucid_intercom/events/changed_plan'