intercom-rails 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ae61e5efdf193cc74b1176e5689e18ec2ceca704
4
- data.tar.gz: e5dfb686a1b287f254d6f4fa16f6a6c794f885d4
3
+ metadata.gz: 90db5a172849d4e46208b7e4945becc12bda59a0
4
+ data.tar.gz: 5f6a61ef04bb2a4a55c21aee3959f79453b5b1ab
5
5
  SHA512:
6
- metadata.gz: d8296981fcc1ce3cbbc916f8ba0d99ccf2689c19bc92e9d3b2496908f79de5202aceb8a3c14bf7e79bd367864295cb7a7737f853b70ea226c0c5094cd18b9e95
7
- data.tar.gz: 1b0b1c01a2de42adf788f684616d33ef7de2e147a8f3fe1392105f2619051c067fa337dcfe7cfc2f20fd5a7bb694810961d151405470c2f0de7f33942acd70fc
6
+ metadata.gz: 29c9e1b05d138b9d666948e9209fe049758abe7244147605c31d6d644c615d5b96c74b6ea6a5d6fd7d2efc9484dce4dae481251470b8d5af28437b2e0fdc6328
7
+ data.tar.gz: b7ecd91c086b837ebdf2c3bbd3264f7fdfd4de5a8ecb59af7c3010bfe2a0f55c185b7b788eae1e9c19aadcd9e9d5cb559fac6f43990ebc175d7a2095efbbfda0
@@ -26,9 +26,8 @@ rails generate intercom:config YOUR-APP-ID
26
26
  To make installing Intercom easy, where possible a `<script>` tag **will be automatically inserted before the closing `</body>` tag**. For most Rails apps, **you won't need to do any extra config**. Having trouble? Check out troubleshooting below.
27
27
 
28
28
 
29
- ### Live Chat / Acquire
30
- With our [Acquire package](https://www.intercom.io/live-chat), Intercom Messenger now works with logged out users and visitors to your web site. Include the Intercom snippet on every page by setting:
31
-
29
+ ### Live Chat
30
+ With the Intercom Messenger you can [chat](https://www.intercom.com/live-chat) with users and visitors to your web site. Include the Intercom Messenger on every page by setting:
32
31
  ```ruby
33
32
  config.include_for_logged_out_users = true
34
33
  ```
@@ -54,7 +53,7 @@ If your users can be defined in different ways in your app you can also pass an
54
53
  ```ruby
55
54
  config.user.current = [Proc.new { current_user_object }, Proc.new { @user_object }]
56
55
  ```
57
- * If you want the Intercom Messenger to be available when there is no current user, set `config.include_for_logged_out_users = true` in your config and sign up for the [Acquire](https://www.intercom.io/live-chat) package.
56
+ * If you want the Intercom Messenger to be available when there is no current user, set `config.include_for_logged_out_users = true` in your config and sign up for the [Respond](https://www.intercom.io/live-chat) package.
58
57
 
59
58
  Feel free to mail us: team@intercom.io, if you're still having trouble.
60
59
 
@@ -69,7 +68,7 @@ If you want to use secure mode, ensure you set your API secret in `config/initia
69
68
  **Note: This example is just for the sake of simplicity, you should never include your api secret in source control. Instead, you should use the Rails [secret config](http://guides.rubyonrails.org/4_1_release_notes.html#config-secrets-yml) feature.**
70
69
  ### Shutdown
71
70
 
72
- If you use Intercom Acquire combined with another product like Support, Learn or Engage, any user that uses a shared computer and browser with someone else will be able to see the most recently logged in user’s conversation history until the cookie expires.
71
+ If you use Intercom Respond combined with another product like Engage, any user that uses a shared computer and browser with someone else will be able to see the most recently logged in user’s conversation history until the cookie expires.
73
72
  Because of this, it’s very important to properly shutdown Intercom when a user’s session on your app ends (via manually or automatically logging out).
74
73
 
75
74
  #### Using Devise
@@ -2,6 +2,7 @@ module IntercomRails
2
2
 
3
3
  class Error < StandardError; end
4
4
  class NoUserFoundError < Error; end
5
+ class ExcludedUserFoundError < Error; end
5
6
  class NoCompanyFoundError < Error; end
6
7
 
7
8
  end
@@ -31,11 +31,11 @@ module IntercomRails
31
31
  begin
32
32
  user_proxy = new(search_object.instance_eval(&potential_object), search_object)
33
33
  return user_proxy if user_proxy.valid?
34
+ raise ExcludedUserFoundError if user_proxy.excluded?
34
35
  rescue NameError
35
36
  next
36
37
  end
37
38
  end
38
-
39
39
  raise NoUserFoundError
40
40
  end
41
41
 
@@ -47,10 +47,14 @@ module IntercomRails
47
47
 
48
48
  def valid?
49
49
  return false if user.blank? || user.respond_to?(:new_record?) && user.new_record?
50
- return false if config.user.exclude_if.present? && config.user.exclude_if.call(user)
50
+ return false if excluded?
51
51
  identity_present?
52
52
  end
53
53
 
54
+ def excluded?
55
+ config.user.exclude_if.present? && config.user.exclude_if.call(user)
56
+ end
57
+
54
58
  end
55
59
 
56
60
  end
@@ -32,6 +32,7 @@ module IntercomRails
32
32
  end
33
33
 
34
34
  def valid?
35
+ return false if user_details[:excluded_user] == true
35
36
  valid = user_details[:app_id].present?
36
37
  unless @show_everywhere
37
38
  valid = valid && (user_details[:user_id] || user_details[:email]).present?
@@ -117,6 +118,10 @@ module IntercomRails
117
118
  Proxy::User.current_in_context(controller).to_hash
118
119
  rescue NoUserFoundError
119
120
  {}
121
+ rescue ExcludedUserFoundError
122
+ {
123
+ excluded_user: true
124
+ }
120
125
  end
121
126
 
122
127
  def company_details=(company_details)
@@ -1,3 +1,3 @@
1
1
  module IntercomRails
2
- VERSION = "0.3.4"
2
+ VERSION = "0.3.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: intercom-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben McRedmond
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-10-24 00:00:00.000000000 Z
13
+ date: 2017-04-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -163,7 +163,7 @@ executables: []
163
163
  extensions: []
164
164
  extra_rdoc_files: []
165
165
  files:
166
- - README.mdown
166
+ - README.md
167
167
  - Rakefile
168
168
  - lib/data/cacert.pem
169
169
  - lib/intercom-rails.rb