intercom-rails 0.2.23 → 0.2.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.mdown +11 -0
- data/lib/intercom-rails/auto_include_filter.rb +1 -1
- data/lib/intercom-rails/config.rb +1 -1
- data/lib/intercom-rails/import.rb +1 -1
- data/lib/intercom-rails/script_tag.rb +0 -2
- data/lib/intercom-rails/version.rb +1 -1
- data/lib/rails/generators/intercom/config/intercom.rb.erb +4 -11
- data/test/intercom-rails/script_tag_test.rb +0 -8
- metadata +17 -35
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b590998d555ff3f90815bb4f77ecfc22ce23df2b
|
4
|
+
data.tar.gz: 84410edefae02996de6b3489d42612058fcd5bce
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f3024c9b8a4890848f1cfbc832175b4908657cb4d226d4d5f25bf25b00ae16e59ab569da735c8892943aeee742ed37b310bb6c9b0ff67cf1ba5a8f638351c99e
|
7
|
+
data.tar.gz: b6e0e97a06c7264f6f4889a999c668659767cce50cd158ea7d157b734be4261282a34df0a51f32cdb5f6333ec7bdffd73c5e703818b2d6dce911deb3c6ff4458
|
data/README.mdown
CHANGED
@@ -89,6 +89,9 @@ class AppsController < ActionController::Base
|
|
89
89
|
end
|
90
90
|
```
|
91
91
|
|
92
|
+
Attributes must be accessible in order to sync with intercom. Additionally, attriutes ending in "_at" will be parsed as times.
|
93
|
+
|
94
|
+
|
92
95
|
### Inbox
|
93
96
|
Intercom includes an inbox which allows a user to read their past conversations with your app, and start new conversations. It's hidden by default, you can include a link to open it by adding a line to `config/initializers/intercom.rb`:
|
94
97
|
|
@@ -112,6 +115,14 @@ This option attaches the inbox open event to the click event of an element with
|
|
112
115
|
|
113
116
|
You can read more about configuring the Inbox within Intercom (Config menu -> Inbox Link).
|
114
117
|
|
118
|
+
### Environments
|
119
|
+
|
120
|
+
By default Intercom will be automatically inserted in all Rails environments. If you would like to specify the environments in which Intercom should be inserted, you can do so as follows:
|
121
|
+
|
122
|
+
```ruby
|
123
|
+
config.enabled_environments = ["production"]
|
124
|
+
```
|
125
|
+
|
115
126
|
### Manually Inserting the Intercom Javascript
|
116
127
|
|
117
128
|
Some situations may require manually inserting the Intercom script tag. If you simply wish to place the Intercom javascript in a different place within the page or, on a page without a closing `</body>` tag:
|
@@ -60,7 +60,7 @@ module IntercomRails
|
|
60
60
|
def enabled_for_environment?
|
61
61
|
enabled_environments = IntercomRails.config.enabled_environments
|
62
62
|
return true if enabled_environments.nil?
|
63
|
-
enabled_environments.include?(Rails.env)
|
63
|
+
enabled_environments.map(&:to_s).include?(Rails.env)
|
64
64
|
end
|
65
65
|
|
66
66
|
end
|
@@ -100,7 +100,7 @@ module IntercomRails
|
|
100
100
|
end
|
101
101
|
|
102
102
|
config_group :inbox do
|
103
|
-
config_accessor :counter
|
103
|
+
config_accessor :counter # Keep this for backwards compatibility
|
104
104
|
config_accessor :style do |value|
|
105
105
|
raise ArgumentError, "inbox.style must be one of :default or :custom" unless [:default, :custom].include?(value)
|
106
106
|
end
|
@@ -48,7 +48,7 @@ module IntercomRails
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def assert_runnable
|
51
|
-
raise ImportError, "You can only import your users from your production environment" unless Rails.env.production?
|
51
|
+
raise ImportError, "You can only import your users from your production environment" unless (Rails.env.production? || Rails.env.staging?)
|
52
52
|
raise ImportError, "We couldn't find your user class, please set one in config/initializers/intercom_rails.rb" unless user_klass.present?
|
53
53
|
info "Found user class: #{user_klass}"
|
54
54
|
raise ImportError, "Only ActiveRecord and Mongoid models are supported" unless supported_orm?(user_klass)
|
@@ -24,11 +24,11 @@ IntercomRails.config do |config|
|
|
24
24
|
<%- end -%>
|
25
25
|
|
26
26
|
# == Enabled Environments
|
27
|
-
# Which
|
27
|
+
# Which environments is auto inclusion of the Javascript enabled for
|
28
28
|
#
|
29
29
|
config.enabled_environments = ["development", "production"]
|
30
30
|
|
31
|
-
# ==
|
31
|
+
# == Current user method/variable
|
32
32
|
# The method/variable that contains the logged in user in your controllers.
|
33
33
|
# If it is `current_user` or `@user`, then you can ignore this
|
34
34
|
#
|
@@ -60,12 +60,12 @@ IntercomRails.config do |config|
|
|
60
60
|
# config.user.company_association = Proc.new { |user| user.companies.to_a }
|
61
61
|
# config.user.company_association = Proc.new { |user| [user.company] }
|
62
62
|
|
63
|
-
# == Current company
|
63
|
+
# == Current company method/variable
|
64
64
|
# The method/variable that contains the current company for the current user,
|
65
65
|
# in your controllers. 'Companies' are generic groupings of users, so this
|
66
66
|
# could be a company, app or group.
|
67
67
|
#
|
68
|
-
# config.company.current = Proc.new {
|
68
|
+
# config.company.current = Proc.new { current_company }
|
69
69
|
|
70
70
|
# == Company Custom Data
|
71
71
|
# A hash of additional data you wish to send about a company.
|
@@ -99,11 +99,4 @@ IntercomRails.config do |config|
|
|
99
99
|
#
|
100
100
|
# config.inbox.style = :default
|
101
101
|
# config.inbox.style = :custom
|
102
|
-
|
103
|
-
# == Inbox Counter
|
104
|
-
# If you're using the custom inbox style, you can request that Intercom
|
105
|
-
# insert an `em` element into your anchor with the count of unread messages
|
106
|
-
#
|
107
|
-
# config.inbox.counter = true
|
108
|
-
|
109
102
|
end
|
@@ -88,14 +88,6 @@ class ScriptTagTest < MiniTest::Unit::TestCase
|
|
88
88
|
assert_equal expected_widget_settings, script_tag.intercom_settings['widget']
|
89
89
|
end
|
90
90
|
|
91
|
-
def test_inbox_custom_style_with_counter
|
92
|
-
IntercomRails.config.inbox.style = :custom
|
93
|
-
IntercomRails.config.inbox.counter = true
|
94
|
-
script_tag = ScriptTag.new
|
95
|
-
expected_widget_settings = {'activator' => '#Intercom', 'use_counter' => true}
|
96
|
-
assert_equal expected_widget_settings, script_tag.intercom_settings['widget']
|
97
|
-
end
|
98
|
-
|
99
91
|
def test_company_discovery_and_inclusion
|
100
92
|
IntercomRails.config.company.current = Proc.new { @app }
|
101
93
|
object_with_app_instance_variable = Object.new
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: intercom-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
5
|
-
prerelease:
|
4
|
+
version: 0.2.24
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Ben McRedmond
|
@@ -11,60 +10,53 @@ authors:
|
|
11
10
|
autorequire:
|
12
11
|
bindir: bin
|
13
12
|
cert_chain: []
|
14
|
-
date: 2013-
|
13
|
+
date: 2013-09-13 00:00:00.000000000 Z
|
15
14
|
dependencies:
|
16
15
|
- !ruby/object:Gem::Dependency
|
17
16
|
name: activesupport
|
18
17
|
requirement: !ruby/object:Gem::Requirement
|
19
|
-
none: false
|
20
18
|
requirements:
|
21
|
-
- -
|
19
|
+
- - '>'
|
22
20
|
- !ruby/object:Gem::Version
|
23
21
|
version: '3.0'
|
24
22
|
type: :runtime
|
25
23
|
prerelease: false
|
26
24
|
version_requirements: !ruby/object:Gem::Requirement
|
27
|
-
none: false
|
28
25
|
requirements:
|
29
|
-
- -
|
26
|
+
- - '>'
|
30
27
|
- !ruby/object:Gem::Version
|
31
28
|
version: '3.0'
|
32
29
|
- !ruby/object:Gem::Dependency
|
33
30
|
name: rake
|
34
31
|
requirement: !ruby/object:Gem::Requirement
|
35
|
-
none: false
|
36
32
|
requirements:
|
37
|
-
- -
|
33
|
+
- - '>='
|
38
34
|
- !ruby/object:Gem::Version
|
39
35
|
version: '0'
|
40
36
|
type: :development
|
41
37
|
prerelease: false
|
42
38
|
version_requirements: !ruby/object:Gem::Requirement
|
43
|
-
none: false
|
44
39
|
requirements:
|
45
|
-
- -
|
40
|
+
- - '>='
|
46
41
|
- !ruby/object:Gem::Version
|
47
42
|
version: '0'
|
48
43
|
- !ruby/object:Gem::Dependency
|
49
44
|
name: actionpack
|
50
45
|
requirement: !ruby/object:Gem::Requirement
|
51
|
-
none: false
|
52
46
|
requirements:
|
53
|
-
- -
|
47
|
+
- - '>'
|
54
48
|
- !ruby/object:Gem::Version
|
55
49
|
version: 3.2.12
|
56
50
|
type: :development
|
57
51
|
prerelease: false
|
58
52
|
version_requirements: !ruby/object:Gem::Requirement
|
59
|
-
none: false
|
60
53
|
requirements:
|
61
|
-
- -
|
54
|
+
- - '>'
|
62
55
|
- !ruby/object:Gem::Version
|
63
56
|
version: 3.2.12
|
64
57
|
- !ruby/object:Gem::Dependency
|
65
58
|
name: rspec-mocks
|
66
59
|
requirement: !ruby/object:Gem::Requirement
|
67
|
-
none: false
|
68
60
|
requirements:
|
69
61
|
- - ~>
|
70
62
|
- !ruby/object:Gem::Version
|
@@ -72,7 +64,6 @@ dependencies:
|
|
72
64
|
type: :development
|
73
65
|
prerelease: false
|
74
66
|
version_requirements: !ruby/object:Gem::Requirement
|
75
|
-
none: false
|
76
67
|
requirements:
|
77
68
|
- - ~>
|
78
69
|
- !ruby/object:Gem::Version
|
@@ -80,23 +71,20 @@ dependencies:
|
|
80
71
|
- !ruby/object:Gem::Dependency
|
81
72
|
name: pry
|
82
73
|
requirement: !ruby/object:Gem::Requirement
|
83
|
-
none: false
|
84
74
|
requirements:
|
85
|
-
- -
|
75
|
+
- - '>='
|
86
76
|
- !ruby/object:Gem::Version
|
87
77
|
version: '0'
|
88
78
|
type: :development
|
89
79
|
prerelease: false
|
90
80
|
version_requirements: !ruby/object:Gem::Requirement
|
91
|
-
none: false
|
92
81
|
requirements:
|
93
|
-
- -
|
82
|
+
- - '>='
|
94
83
|
- !ruby/object:Gem::Version
|
95
84
|
version: '0'
|
96
85
|
- !ruby/object:Gem::Dependency
|
97
86
|
name: sinatra
|
98
87
|
requirement: !ruby/object:Gem::Requirement
|
99
|
-
none: false
|
100
88
|
requirements:
|
101
89
|
- - ~>
|
102
90
|
- !ruby/object:Gem::Version
|
@@ -104,7 +92,6 @@ dependencies:
|
|
104
92
|
type: :development
|
105
93
|
prerelease: false
|
106
94
|
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
none: false
|
108
95
|
requirements:
|
109
96
|
- - ~>
|
110
97
|
- !ruby/object:Gem::Version
|
@@ -112,7 +99,6 @@ dependencies:
|
|
112
99
|
- !ruby/object:Gem::Dependency
|
113
100
|
name: thin
|
114
101
|
requirement: !ruby/object:Gem::Requirement
|
115
|
-
none: false
|
116
102
|
requirements:
|
117
103
|
- - ~>
|
118
104
|
- !ruby/object:Gem::Version
|
@@ -120,7 +106,6 @@ dependencies:
|
|
120
106
|
type: :development
|
121
107
|
prerelease: false
|
122
108
|
version_requirements: !ruby/object:Gem::Requirement
|
123
|
-
none: false
|
124
109
|
requirements:
|
125
110
|
- - ~>
|
126
111
|
- !ruby/object:Gem::Version
|
@@ -128,17 +113,15 @@ dependencies:
|
|
128
113
|
- !ruby/object:Gem::Dependency
|
129
114
|
name: tzinfo
|
130
115
|
requirement: !ruby/object:Gem::Requirement
|
131
|
-
none: false
|
132
116
|
requirements:
|
133
|
-
- -
|
117
|
+
- - '>='
|
134
118
|
- !ruby/object:Gem::Version
|
135
119
|
version: '0'
|
136
120
|
type: :development
|
137
121
|
prerelease: false
|
138
122
|
version_requirements: !ruby/object:Gem::Requirement
|
139
|
-
none: false
|
140
123
|
requirements:
|
141
|
-
- -
|
124
|
+
- - '>='
|
142
125
|
- !ruby/object:Gem::Version
|
143
126
|
version: '0'
|
144
127
|
description: Intercom (https://www.intercom.io) is a customer relationship management
|
@@ -185,27 +168,26 @@ files:
|
|
185
168
|
- test/test_setup.rb
|
186
169
|
homepage: http://www.intercom.io
|
187
170
|
licenses: []
|
171
|
+
metadata: {}
|
188
172
|
post_install_message:
|
189
173
|
rdoc_options: []
|
190
174
|
require_paths:
|
191
175
|
- lib
|
192
176
|
required_ruby_version: !ruby/object:Gem::Requirement
|
193
|
-
none: false
|
194
177
|
requirements:
|
195
|
-
- -
|
178
|
+
- - '>='
|
196
179
|
- !ruby/object:Gem::Version
|
197
180
|
version: '0'
|
198
181
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
199
|
-
none: false
|
200
182
|
requirements:
|
201
|
-
- -
|
183
|
+
- - '>='
|
202
184
|
- !ruby/object:Gem::Version
|
203
185
|
version: '0'
|
204
186
|
requirements: []
|
205
187
|
rubyforge_project: intercom-rails
|
206
|
-
rubygems_version:
|
188
|
+
rubygems_version: 2.0.3
|
207
189
|
signing_key:
|
208
|
-
specification_version:
|
190
|
+
specification_version: 4
|
209
191
|
summary: Rails helper for emitting javascript script tags for Intercom
|
210
192
|
test_files:
|
211
193
|
- test/action_controller_test_setup.rb
|