intercom 3.8.1 → 3.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -1
- data/changes.txt +3 -0
- data/lib/intercom.rb +2 -0
- data/lib/intercom/client.rb +4 -0
- data/lib/intercom/service/team.rb +17 -0
- data/lib/intercom/team.rb +7 -0
- data/lib/intercom/version.rb +1 -1
- data/spec/spec_helper.rb +29 -0
- data/spec/unit/intercom/team_spec.rb +21 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b9cbc7fa1ebcd80a2cab246e89dbab5f86b0f1ec94995b1d2ebdda342dc9dce
|
4
|
+
data.tar.gz: c926b260d154dea87dc2f666d27cfd6e5c61c986071969f0c22c5f7389da3f14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a14065260cca33928e257df6970c3dcfe0c9fc73478d6a4f0f0f5c0f03f20bb82f9662bc8ba59a7531308090072f69f9b4ab6d78be7534898430479ac65a1c2d
|
7
|
+
data.tar.gz: fb99bfcc7e38da3119efff1f1ff8e905f9204e785cac8600f0f1dadbc98dbaf0d62efc66559936212ee045c34915a5b37931778fe4c4c5ad6bceccae312d3d35
|
data/README.md
CHANGED
@@ -18,11 +18,12 @@ This version of the gem is compatible with `Ruby 2.1` and above.
|
|
18
18
|
|
19
19
|
## Installation
|
20
20
|
|
21
|
+
|
21
22
|
gem install intercom
|
22
23
|
|
23
24
|
Using bundler:
|
24
25
|
|
25
|
-
gem 'intercom', '~> 3.8.
|
26
|
+
gem 'intercom', '~> 3.8.1'
|
26
27
|
|
27
28
|
## Basic Usage
|
28
29
|
|
@@ -48,6 +49,7 @@ You can also use the [omniauth-intercom lib](https://github.com/intercom/omniaut
|
|
48
49
|
Resources this API supports:
|
49
50
|
|
50
51
|
https://api.intercom.io/users
|
52
|
+
https://api.intercom.io/teams
|
51
53
|
https://api.intercom.io/contacts
|
52
54
|
https://api.intercom.io/companies
|
53
55
|
https://api.intercom.io/counts
|
@@ -128,6 +130,14 @@ intercom.admins.find(id: admin_id)
|
|
128
130
|
intercom.admins.all.each {|admin| puts admin.email }
|
129
131
|
```
|
130
132
|
|
133
|
+
#### Teams
|
134
|
+
```ruby
|
135
|
+
# Find a team by id
|
136
|
+
intercom.teams.find(id: team_id)
|
137
|
+
# Iterate over all teams
|
138
|
+
intercom.teams.all.each {|team| puts team.name }
|
139
|
+
```
|
140
|
+
|
131
141
|
#### Companies
|
132
142
|
```ruby
|
133
143
|
# Add a user to one or more companies
|
data/changes.txt
CHANGED
data/lib/intercom.rb
CHANGED
@@ -12,6 +12,7 @@ require 'intercom/service/job'
|
|
12
12
|
require 'intercom/service/subscription'
|
13
13
|
require 'intercom/service/segment'
|
14
14
|
require 'intercom/service/tag'
|
15
|
+
require 'intercom/service/team'
|
15
16
|
require 'intercom/service/user'
|
16
17
|
require 'intercom/service/visitor'
|
17
18
|
require 'intercom/options'
|
@@ -31,6 +32,7 @@ require "intercom/message"
|
|
31
32
|
require "intercom/admin"
|
32
33
|
require "intercom/request"
|
33
34
|
require "intercom/subscription"
|
35
|
+
require "intercom/team"
|
34
36
|
require "intercom/errors"
|
35
37
|
require "intercom/visitor"
|
36
38
|
require "json"
|
data/lib/intercom/client.rb
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'intercom/service/base_service'
|
2
|
+
require 'intercom/api_operations/list'
|
3
|
+
require 'intercom/api_operations/find'
|
4
|
+
|
5
|
+
module Intercom
|
6
|
+
module Service
|
7
|
+
class Team < BaseService
|
8
|
+
include ApiOperations::List
|
9
|
+
include ApiOperations::Find
|
10
|
+
|
11
|
+
def collection_class
|
12
|
+
Intercom::Team
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/intercom/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -145,6 +145,35 @@ def test_admin
|
|
145
145
|
}
|
146
146
|
end
|
147
147
|
|
148
|
+
def test_team_list
|
149
|
+
{
|
150
|
+
"type"=> "team.list",
|
151
|
+
"teams" => [
|
152
|
+
{
|
153
|
+
"type"=> "team",
|
154
|
+
"id"=> "2744328",
|
155
|
+
"name"=> "the_a_team",
|
156
|
+
"admin_ids"=> [646303, 814860],
|
157
|
+
},
|
158
|
+
{
|
159
|
+
"type"=> "team",
|
160
|
+
"id"=> "814865",
|
161
|
+
"name"=> "BA_App",
|
162
|
+
"admin_ids" => [492881, 1195856]
|
163
|
+
},
|
164
|
+
]
|
165
|
+
}
|
166
|
+
end
|
167
|
+
|
168
|
+
def test_team
|
169
|
+
{
|
170
|
+
"type" => "team",
|
171
|
+
"id" => "2744328",
|
172
|
+
"name" => "the_a_team",
|
173
|
+
"admin_ids" => [646303, 814860]
|
174
|
+
}
|
175
|
+
end
|
176
|
+
|
148
177
|
def test_company
|
149
178
|
{
|
150
179
|
"type" => "company",
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "Intercom::Team" do
|
4
|
+
let (:client) { Intercom::Client.new(token: 'token') }
|
5
|
+
|
6
|
+
it "returns a CollectionProxy for all without making any requests" do
|
7
|
+
client.expects(:execute_request).never
|
8
|
+
all = client.teams.all
|
9
|
+
all.must_be_instance_of(Intercom::ClientCollectionProxy)
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'gets an team list' do
|
13
|
+
client.expects(:get).with("/teams", {}).returns(test_team_list)
|
14
|
+
client.teams.all.each { |t| }
|
15
|
+
end
|
16
|
+
|
17
|
+
it "gets an team" do
|
18
|
+
client.expects(:get).with("/teams/1234", {}).returns(test_team)
|
19
|
+
client.teams.find(:id => "1234")
|
20
|
+
end
|
21
|
+
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: 3.
|
4
|
+
version: 3.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben McRedmond
|
@@ -15,7 +15,7 @@ authors:
|
|
15
15
|
autorequire:
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
|
-
date: 2019-10-
|
18
|
+
date: 2019-10-09 00:00:00.000000000 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: minitest
|
@@ -181,10 +181,12 @@ files:
|
|
181
181
|
- lib/intercom/service/segment.rb
|
182
182
|
- lib/intercom/service/subscription.rb
|
183
183
|
- lib/intercom/service/tag.rb
|
184
|
+
- lib/intercom/service/team.rb
|
184
185
|
- lib/intercom/service/user.rb
|
185
186
|
- lib/intercom/service/visitor.rb
|
186
187
|
- lib/intercom/subscription.rb
|
187
188
|
- lib/intercom/tag.rb
|
189
|
+
- lib/intercom/team.rb
|
188
190
|
- lib/intercom/traits/api_resource.rb
|
189
191
|
- lib/intercom/traits/dirty_tracking.rb
|
190
192
|
- lib/intercom/traits/incrementable_attributes.rb
|
@@ -211,6 +213,7 @@ files:
|
|
211
213
|
- spec/unit/intercom/segment_spec.rb
|
212
214
|
- spec/unit/intercom/subscription_spec.rb
|
213
215
|
- spec/unit/intercom/tag_spec.rb
|
216
|
+
- spec/unit/intercom/team_spec.rb
|
214
217
|
- spec/unit/intercom/traits/api_resource_spec.rb
|
215
218
|
- spec/unit/intercom/user_spec.rb
|
216
219
|
- spec/unit/intercom/visitors_spec.rb
|
@@ -259,6 +262,7 @@ test_files:
|
|
259
262
|
- spec/unit/intercom/segment_spec.rb
|
260
263
|
- spec/unit/intercom/subscription_spec.rb
|
261
264
|
- spec/unit/intercom/tag_spec.rb
|
265
|
+
- spec/unit/intercom/team_spec.rb
|
262
266
|
- spec/unit/intercom/traits/api_resource_spec.rb
|
263
267
|
- spec/unit/intercom/user_spec.rb
|
264
268
|
- spec/unit/intercom/visitors_spec.rb
|