intercom 3.5.10 → 4.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.circleci/config.yml +35 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +5 -0
- data/Gemfile +1 -4
- data/README.md +418 -216
- data/RELEASING.md +9 -0
- data/Rakefile +1 -1
- data/changes.txt +141 -0
- data/intercom.gemspec +1 -2
- data/lib/intercom.rb +34 -19
- data/lib/intercom/api_operations/archive.rb +16 -0
- data/lib/intercom/api_operations/delete.rb +4 -1
- data/lib/intercom/api_operations/find.rb +5 -2
- data/lib/intercom/api_operations/find_all.rb +4 -3
- data/lib/intercom/api_operations/list.rb +4 -1
- data/lib/intercom/api_operations/load.rb +4 -2
- data/lib/intercom/api_operations/nested_resource.rb +70 -0
- data/lib/intercom/api_operations/request_hard_delete.rb +12 -0
- data/lib/intercom/api_operations/save.rb +6 -4
- data/lib/intercom/api_operations/scroll.rb +4 -5
- data/lib/intercom/api_operations/search.rb +18 -0
- data/lib/intercom/article.rb +7 -0
- data/lib/intercom/base_collection_proxy.rb +72 -0
- data/lib/intercom/client.rb +66 -18
- data/lib/intercom/client_collection_proxy.rb +17 -39
- data/lib/intercom/collection.rb +7 -0
- data/lib/intercom/company.rb +8 -0
- data/lib/intercom/contact.rb +22 -3
- data/lib/intercom/conversation.rb +5 -0
- data/lib/intercom/data_attribute.rb +7 -0
- data/lib/intercom/deprecated_leads_collection_proxy.rb +22 -0
- data/lib/intercom/deprecated_resources.rb +13 -0
- data/lib/intercom/errors.rb +44 -4
- data/lib/intercom/extended_api_operations/segments.rb +3 -1
- data/lib/intercom/extended_api_operations/tags.rb +3 -1
- data/lib/intercom/lead.rb +21 -0
- data/lib/intercom/lib/typed_json_deserializer.rb +42 -37
- data/lib/intercom/note.rb +4 -0
- data/lib/intercom/request.rb +162 -95
- data/lib/intercom/scroll_collection_proxy.rb +38 -42
- data/lib/intercom/search_collection_proxy.rb +47 -0
- data/lib/intercom/section.rb +23 -0
- data/lib/intercom/segment.rb +4 -0
- data/lib/intercom/service/article.rb +20 -0
- data/lib/intercom/service/base_service.rb +13 -0
- data/lib/intercom/service/collection.rb +24 -0
- data/lib/intercom/service/company.rb +4 -2
- data/lib/intercom/service/contact.rb +29 -6
- data/lib/intercom/service/conversation.rb +23 -2
- data/lib/intercom/service/data_attribute.rb +20 -0
- data/lib/intercom/service/event.rb +12 -0
- data/lib/intercom/service/lead.rb +41 -0
- data/lib/intercom/service/note.rb +4 -8
- data/lib/intercom/service/section.rb +7 -0
- data/lib/intercom/service/tag.rb +8 -8
- data/lib/intercom/service/team.rb +17 -0
- data/lib/intercom/service/user.rb +4 -2
- data/lib/intercom/service/visitor.rb +15 -6
- data/lib/intercom/tag.rb +4 -0
- data/lib/intercom/team.rb +7 -0
- data/lib/intercom/traits/api_resource.rb +48 -27
- data/lib/intercom/traits/dirty_tracking.rb +8 -1
- data/lib/intercom/user.rb +12 -3
- data/lib/intercom/utils.rb +13 -2
- data/lib/intercom/version.rb +1 -1
- data/lib/intercom/visitor.rb +0 -2
- data/spec/spec_helper.rb +881 -436
- data/spec/unit/intercom/admin_spec.rb +2 -2
- data/spec/unit/intercom/article_spec.rb +40 -0
- data/spec/unit/intercom/base_collection_proxy_spec.rb +30 -0
- data/spec/unit/intercom/client_collection_proxy_spec.rb +41 -41
- data/spec/unit/intercom/client_spec.rb +76 -9
- data/spec/unit/intercom/collection_spec.rb +32 -0
- data/spec/unit/intercom/company_spec.rb +29 -21
- data/spec/unit/intercom/contact_spec.rb +365 -29
- data/spec/unit/intercom/conversation_spec.rb +70 -7
- data/spec/unit/intercom/count_spec.rb +4 -4
- data/spec/unit/intercom/data_attribute_spec.rb +40 -0
- data/spec/unit/intercom/deprecated_leads_collection_proxy_spec.rb +17 -0
- data/spec/unit/intercom/event_spec.rb +25 -8
- data/spec/unit/intercom/job_spec.rb +24 -24
- data/spec/unit/intercom/lead_spec.rb +57 -0
- data/spec/unit/intercom/lib/flat_store_spec.rb +22 -20
- data/spec/unit/intercom/message_spec.rb +1 -1
- data/spec/unit/intercom/note_spec.rb +4 -10
- data/spec/unit/intercom/request_spec.rb +150 -9
- data/spec/unit/intercom/scroll_collection_proxy_spec.rb +40 -39
- data/spec/unit/intercom/search_collection_proxy_spec.rb +60 -0
- data/spec/unit/intercom/section_spec.rb +32 -0
- data/spec/unit/intercom/segment_spec.rb +2 -2
- data/spec/unit/intercom/subscription_spec.rb +5 -6
- data/spec/unit/intercom/tag_spec.rb +22 -14
- data/spec/unit/intercom/team_spec.rb +21 -0
- data/spec/unit/intercom/traits/api_resource_spec.rb +129 -47
- data/spec/unit/intercom/user_spec.rb +227 -217
- data/spec/unit/intercom/visitor_spec.rb +49 -0
- data/spec/unit/intercom_spec.rb +5 -3
- metadata +63 -26
- data/.travis.yml +0 -6
- data/lib/intercom/extended_api_operations/users.rb +0 -16
- data/spec/unit/intercom/visitors_spec.rb +0 -61
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Intercom::Visitor' do
|
4
|
+
let (:client) { Intercom::Client.new(token: 'token') }
|
5
|
+
|
6
|
+
it 'can update a visitor with an id' do
|
7
|
+
visitor = Intercom::Visitor.new(:id => 'de45ae78gae1289cb')
|
8
|
+
client.expects(:put).with('/visitors/de45ae78gae1289cb', 'custom_attributes' => {})
|
9
|
+
client.visitors.save(visitor)
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'can get a visitor' do
|
13
|
+
visitor = Intercom::Visitor.new(:id => 'de45ae78gae1289cb')
|
14
|
+
client.expects(:get).with('/visitors/de45ae78gae1289cb', {}).returns(test_visitor)
|
15
|
+
client.visitors.find(id: visitor.id)
|
16
|
+
end
|
17
|
+
|
18
|
+
describe 'converting' do
|
19
|
+
let(:visitor) { Intercom::Visitor.from_api(user_id: 'visitor_id') }
|
20
|
+
let(:user) { Intercom::Contact.from_api(id: 'user_id', role: 'user') }
|
21
|
+
|
22
|
+
it 'visitor to user' do
|
23
|
+
client.expects(:post).with(
|
24
|
+
'/visitors/convert',
|
25
|
+
visitor: { user_id: visitor.user_id },
|
26
|
+
user: { 'id' => user.id },
|
27
|
+
type: 'user'
|
28
|
+
).returns(test_contact)
|
29
|
+
|
30
|
+
client.visitors.convert(visitor, user)
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'visitor to lead' do
|
34
|
+
client.expects(:post).with(
|
35
|
+
'/visitors/convert',
|
36
|
+
visitor: { user_id: visitor.user_id },
|
37
|
+
type: 'lead'
|
38
|
+
).returns(test_contact(role: 'lead'))
|
39
|
+
|
40
|
+
client.visitors.convert(visitor)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'deletes a visitor' do
|
45
|
+
visitor = Intercom::Visitor.new('id' => '1')
|
46
|
+
client.expects(:delete).with('/visitors/1', {}).returns(visitor)
|
47
|
+
client.visitors.delete(visitor)
|
48
|
+
end
|
49
|
+
end
|
data/spec/unit/intercom_spec.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
2
4
|
|
3
5
|
describe Intercom do
|
4
|
-
it
|
5
|
-
Intercom::VERSION.must_match(/\d+\.\d+\.\d+/)
|
6
|
+
it 'has a version number' do
|
7
|
+
_(Intercom::VERSION).must_match(/\d+\.\d+\.\d+/)
|
6
8
|
end
|
7
9
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: intercom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben McRedmond
|
@@ -12,10 +12,10 @@ authors:
|
|
12
12
|
- Declan McGrath
|
13
13
|
- Jamie Osler
|
14
14
|
- Bob Long
|
15
|
-
autorequire:
|
15
|
+
autorequire:
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
|
-
date:
|
18
|
+
date: 2020-10-30 00:00:00.000000000 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: minitest
|
@@ -31,6 +31,20 @@ dependencies:
|
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '5.4'
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: m
|
36
|
+
requirement: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.5.0
|
41
|
+
type: :development
|
42
|
+
prerelease: false
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.5.0
|
34
48
|
- !ruby/object:Gem::Dependency
|
35
49
|
name: rake
|
36
50
|
requirement: !ruby/object:Gem::Requirement
|
@@ -87,20 +101,6 @@ dependencies:
|
|
87
101
|
- - ">="
|
88
102
|
- !ruby/object:Gem::Version
|
89
103
|
version: '0'
|
90
|
-
- !ruby/object:Gem::Dependency
|
91
|
-
name: json
|
92
|
-
requirement: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '1.8'
|
97
|
-
type: :runtime
|
98
|
-
prerelease: false
|
99
|
-
version_requirements: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '1.8'
|
104
104
|
- !ruby/object:Gem::Dependency
|
105
105
|
name: gem-release
|
106
106
|
requirement: !ruby/object:Gem::Requirement
|
@@ -131,12 +131,14 @@ executables: []
|
|
131
131
|
extensions: []
|
132
132
|
extra_rdoc_files: []
|
133
133
|
files:
|
134
|
+
- ".circleci/config.yml"
|
134
135
|
- ".github/ISSUE_TEMPLATE.md"
|
136
|
+
- ".github/PULL_REQUEST_TEMPLATE.md"
|
135
137
|
- ".gitignore"
|
136
|
-
- ".travis.yml"
|
137
138
|
- Gemfile
|
138
139
|
- MIT-LICENSE
|
139
140
|
- README.md
|
141
|
+
- RELEASING.md
|
140
142
|
- Rakefile
|
141
143
|
- changes.txt
|
142
144
|
- intercom.gemspec
|
@@ -144,6 +146,7 @@ files:
|
|
144
146
|
- lib/ext/sliceable_hash.rb
|
145
147
|
- lib/intercom.rb
|
146
148
|
- lib/intercom/admin.rb
|
149
|
+
- lib/intercom/api_operations/archive.rb
|
147
150
|
- lib/intercom/api_operations/bulk/load_error_feed.rb
|
148
151
|
- lib/intercom/api_operations/bulk/submit.rb
|
149
152
|
- lib/intercom/api_operations/convert.rb
|
@@ -152,20 +155,29 @@ files:
|
|
152
155
|
- lib/intercom/api_operations/find_all.rb
|
153
156
|
- lib/intercom/api_operations/list.rb
|
154
157
|
- lib/intercom/api_operations/load.rb
|
158
|
+
- lib/intercom/api_operations/nested_resource.rb
|
159
|
+
- lib/intercom/api_operations/request_hard_delete.rb
|
155
160
|
- lib/intercom/api_operations/save.rb
|
156
161
|
- lib/intercom/api_operations/scroll.rb
|
162
|
+
- lib/intercom/api_operations/search.rb
|
163
|
+
- lib/intercom/article.rb
|
164
|
+
- lib/intercom/base_collection_proxy.rb
|
157
165
|
- lib/intercom/client.rb
|
158
166
|
- lib/intercom/client_collection_proxy.rb
|
167
|
+
- lib/intercom/collection.rb
|
159
168
|
- lib/intercom/company.rb
|
160
169
|
- lib/intercom/contact.rb
|
161
170
|
- lib/intercom/conversation.rb
|
162
171
|
- lib/intercom/count.rb
|
172
|
+
- lib/intercom/data_attribute.rb
|
173
|
+
- lib/intercom/deprecated_leads_collection_proxy.rb
|
174
|
+
- lib/intercom/deprecated_resources.rb
|
163
175
|
- lib/intercom/errors.rb
|
164
176
|
- lib/intercom/event.rb
|
165
177
|
- lib/intercom/extended_api_operations/segments.rb
|
166
178
|
- lib/intercom/extended_api_operations/tags.rb
|
167
|
-
- lib/intercom/extended_api_operations/users.rb
|
168
179
|
- lib/intercom/job.rb
|
180
|
+
- lib/intercom/lead.rb
|
169
181
|
- lib/intercom/lib/dynamic_accessors.rb
|
170
182
|
- lib/intercom/lib/dynamic_accessors_on_method_missing.rb
|
171
183
|
- lib/intercom/lib/flat_store.rb
|
@@ -175,24 +187,33 @@ files:
|
|
175
187
|
- lib/intercom/options.rb
|
176
188
|
- lib/intercom/request.rb
|
177
189
|
- lib/intercom/scroll_collection_proxy.rb
|
190
|
+
- lib/intercom/search_collection_proxy.rb
|
191
|
+
- lib/intercom/section.rb
|
178
192
|
- lib/intercom/segment.rb
|
179
193
|
- lib/intercom/service/admin.rb
|
194
|
+
- lib/intercom/service/article.rb
|
180
195
|
- lib/intercom/service/base_service.rb
|
196
|
+
- lib/intercom/service/collection.rb
|
181
197
|
- lib/intercom/service/company.rb
|
182
198
|
- lib/intercom/service/contact.rb
|
183
199
|
- lib/intercom/service/conversation.rb
|
184
200
|
- lib/intercom/service/count.rb
|
201
|
+
- lib/intercom/service/data_attribute.rb
|
185
202
|
- lib/intercom/service/event.rb
|
186
203
|
- lib/intercom/service/job.rb
|
204
|
+
- lib/intercom/service/lead.rb
|
187
205
|
- lib/intercom/service/message.rb
|
188
206
|
- lib/intercom/service/note.rb
|
207
|
+
- lib/intercom/service/section.rb
|
189
208
|
- lib/intercom/service/segment.rb
|
190
209
|
- lib/intercom/service/subscription.rb
|
191
210
|
- lib/intercom/service/tag.rb
|
211
|
+
- lib/intercom/service/team.rb
|
192
212
|
- lib/intercom/service/user.rb
|
193
213
|
- lib/intercom/service/visitor.rb
|
194
214
|
- lib/intercom/subscription.rb
|
195
215
|
- lib/intercom/tag.rb
|
216
|
+
- lib/intercom/team.rb
|
196
217
|
- lib/intercom/traits/api_resource.rb
|
197
218
|
- lib/intercom/traits/dirty_tracking.rb
|
198
219
|
- lib/intercom/traits/incrementable_attributes.rb
|
@@ -202,31 +223,40 @@ files:
|
|
202
223
|
- lib/intercom/visitor.rb
|
203
224
|
- spec/spec_helper.rb
|
204
225
|
- spec/unit/intercom/admin_spec.rb
|
226
|
+
- spec/unit/intercom/article_spec.rb
|
227
|
+
- spec/unit/intercom/base_collection_proxy_spec.rb
|
205
228
|
- spec/unit/intercom/client_collection_proxy_spec.rb
|
206
229
|
- spec/unit/intercom/client_spec.rb
|
230
|
+
- spec/unit/intercom/collection_spec.rb
|
207
231
|
- spec/unit/intercom/company_spec.rb
|
208
232
|
- spec/unit/intercom/contact_spec.rb
|
209
233
|
- spec/unit/intercom/conversation_spec.rb
|
210
234
|
- spec/unit/intercom/count_spec.rb
|
235
|
+
- spec/unit/intercom/data_attribute_spec.rb
|
236
|
+
- spec/unit/intercom/deprecated_leads_collection_proxy_spec.rb
|
211
237
|
- spec/unit/intercom/event_spec.rb
|
212
238
|
- spec/unit/intercom/job_spec.rb
|
239
|
+
- spec/unit/intercom/lead_spec.rb
|
213
240
|
- spec/unit/intercom/lib/flat_store_spec.rb
|
214
241
|
- spec/unit/intercom/message_spec.rb
|
215
242
|
- spec/unit/intercom/note_spec.rb
|
216
243
|
- spec/unit/intercom/request_spec.rb
|
217
244
|
- spec/unit/intercom/scroll_collection_proxy_spec.rb
|
245
|
+
- spec/unit/intercom/search_collection_proxy_spec.rb
|
246
|
+
- spec/unit/intercom/section_spec.rb
|
218
247
|
- spec/unit/intercom/segment_spec.rb
|
219
248
|
- spec/unit/intercom/subscription_spec.rb
|
220
249
|
- spec/unit/intercom/tag_spec.rb
|
250
|
+
- spec/unit/intercom/team_spec.rb
|
221
251
|
- spec/unit/intercom/traits/api_resource_spec.rb
|
222
252
|
- spec/unit/intercom/user_spec.rb
|
223
|
-
- spec/unit/intercom/
|
253
|
+
- spec/unit/intercom/visitor_spec.rb
|
224
254
|
- spec/unit/intercom_spec.rb
|
225
255
|
homepage: https://www.intercom.io
|
226
256
|
licenses:
|
227
257
|
- MIT
|
228
258
|
metadata: {}
|
229
|
-
post_install_message:
|
259
|
+
post_install_message:
|
230
260
|
rdoc_options: []
|
231
261
|
require_paths:
|
232
262
|
- lib
|
@@ -241,32 +271,39 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
241
271
|
- !ruby/object:Gem::Version
|
242
272
|
version: '0'
|
243
273
|
requirements: []
|
244
|
-
|
245
|
-
|
246
|
-
signing_key:
|
274
|
+
rubygems_version: 3.0.3
|
275
|
+
signing_key:
|
247
276
|
specification_version: 4
|
248
277
|
summary: Ruby bindings for the Intercom API
|
249
278
|
test_files:
|
250
279
|
- spec/spec_helper.rb
|
251
280
|
- spec/unit/intercom/admin_spec.rb
|
281
|
+
- spec/unit/intercom/article_spec.rb
|
282
|
+
- spec/unit/intercom/base_collection_proxy_spec.rb
|
252
283
|
- spec/unit/intercom/client_collection_proxy_spec.rb
|
253
284
|
- spec/unit/intercom/client_spec.rb
|
285
|
+
- spec/unit/intercom/collection_spec.rb
|
254
286
|
- spec/unit/intercom/company_spec.rb
|
255
287
|
- spec/unit/intercom/contact_spec.rb
|
256
288
|
- spec/unit/intercom/conversation_spec.rb
|
257
289
|
- spec/unit/intercom/count_spec.rb
|
290
|
+
- spec/unit/intercom/data_attribute_spec.rb
|
291
|
+
- spec/unit/intercom/deprecated_leads_collection_proxy_spec.rb
|
258
292
|
- spec/unit/intercom/event_spec.rb
|
259
293
|
- spec/unit/intercom/job_spec.rb
|
294
|
+
- spec/unit/intercom/lead_spec.rb
|
260
295
|
- spec/unit/intercom/lib/flat_store_spec.rb
|
261
296
|
- spec/unit/intercom/message_spec.rb
|
262
297
|
- spec/unit/intercom/note_spec.rb
|
263
298
|
- spec/unit/intercom/request_spec.rb
|
264
299
|
- spec/unit/intercom/scroll_collection_proxy_spec.rb
|
300
|
+
- spec/unit/intercom/search_collection_proxy_spec.rb
|
301
|
+
- spec/unit/intercom/section_spec.rb
|
265
302
|
- spec/unit/intercom/segment_spec.rb
|
266
303
|
- spec/unit/intercom/subscription_spec.rb
|
267
304
|
- spec/unit/intercom/tag_spec.rb
|
305
|
+
- spec/unit/intercom/team_spec.rb
|
268
306
|
- spec/unit/intercom/traits/api_resource_spec.rb
|
269
307
|
- spec/unit/intercom/user_spec.rb
|
270
|
-
- spec/unit/intercom/
|
308
|
+
- spec/unit/intercom/visitor_spec.rb
|
271
309
|
- spec/unit/intercom_spec.rb
|
272
|
-
has_rdoc:
|
data/.travis.yml
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'intercom/client_collection_proxy'
|
2
|
-
require 'intercom/utils'
|
3
|
-
|
4
|
-
module Intercom
|
5
|
-
module ExtendedApiOperations
|
6
|
-
module Users
|
7
|
-
def users(id)
|
8
|
-
collection_name = Utils.resource_class_to_collection_name(collection_class)
|
9
|
-
finder_details = {}
|
10
|
-
finder_details[:url] = "/#{collection_name}/#{id}/users"
|
11
|
-
finder_details[:params] = {}
|
12
|
-
ClientCollectionProxy.new("users", finder_details: finder_details, client: @client)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,61 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe "Intercom::Visitors" do
|
4
|
-
let (:client) { Intercom::Client.new(app_id: 'app_id', api_key: 'api_key') }
|
5
|
-
|
6
|
-
it 'should be listable' do
|
7
|
-
proxy = client.visitors.all
|
8
|
-
proxy.resource_name.must_equal 'visitors'
|
9
|
-
proxy.finder_url.must_equal '/visitors'
|
10
|
-
proxy.resource_class.must_equal Intercom::Visitor
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'can update a visitor with an id' do
|
14
|
-
visitor = Intercom::Visitor.new(:id => "de45ae78gae1289cb")
|
15
|
-
client.expects(:put).with("/visitors/de45ae78gae1289cb", {'custom_attributes' => {}})
|
16
|
-
client.visitors.save(visitor)
|
17
|
-
end
|
18
|
-
|
19
|
-
describe 'converting' do
|
20
|
-
let(:visitor) { Intercom::Visitor.from_api(user_id: 'visitor_id') }
|
21
|
-
let(:user) { Intercom::User.from_api(id: 'user_id') }
|
22
|
-
|
23
|
-
it 'visitor to user' do
|
24
|
-
client.expects(:post).with(
|
25
|
-
"/visitors/convert",
|
26
|
-
{
|
27
|
-
visitor: { user_id: visitor.user_id },
|
28
|
-
user: { 'id' => user.id },
|
29
|
-
type:'user'
|
30
|
-
}
|
31
|
-
).returns(test_user)
|
32
|
-
|
33
|
-
client.visitors.convert(visitor, user)
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'visitor to lead' do
|
37
|
-
client.expects(:post).with(
|
38
|
-
"/visitors/convert",
|
39
|
-
{
|
40
|
-
visitor: { user_id: visitor.user_id },
|
41
|
-
type:'lead'
|
42
|
-
}
|
43
|
-
).returns(test_user)
|
44
|
-
|
45
|
-
client.visitors.convert(visitor)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
it "returns a ClientCollectionProxy for all without making any requests" do
|
50
|
-
client.expects(:execute_request).never
|
51
|
-
all = client.visitors.all
|
52
|
-
all.must_be_instance_of(Intercom::ClientCollectionProxy)
|
53
|
-
end
|
54
|
-
|
55
|
-
it "deletes a visitor" do
|
56
|
-
visitor = Intercom::Visitor.new("id" => "1")
|
57
|
-
client.expects(:delete).with("/visitors/1", {}).returns(visitor)
|
58
|
-
client.visitors.delete(visitor)
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|