intercom 0.1.13 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/changes.txt +3 -0
- data/lib/intercom/tag.rb +4 -6
- data/lib/intercom/version.rb +1 -1
- data/spec/spec_helper.rb +0 -11
- data/spec/unit/intercom/tag_spec.rb +2 -21
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5528d941fb5fce815fc80d08e159e78ed46dc720
|
4
|
+
data.tar.gz: af751fee8c6ed9d95b676b7ee081fb83ad351a28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecce591469b2667290265c3e36e57173a3a3c690f35264bd29d12bc0fba178cd4b914c2fa9fbcad0daed62c0a023a09a001873007e427dd4aab34bb9bfacc320
|
7
|
+
data.tar.gz: f9fdf74c543f538c1191ef7b67b68a0feaf0c8ec7f015302828347361459c5c64d08c4c5548e9fdf81daca72e2604f522b46fe1e1931016316986d72ef806fdf
|
data/changes.txt
CHANGED
data/lib/intercom/tag.rb
CHANGED
@@ -6,24 +6,22 @@ module Intercom
|
|
6
6
|
##
|
7
7
|
# Represents a tag
|
8
8
|
#
|
9
|
-
# A tag consists of a name, and (optionally)
|
9
|
+
# A tag consists of a name, and (optionally) users that you would like to tag. Returns details about the tag and a count of the number of users currently tagged.
|
10
10
|
#
|
11
11
|
# == Examples
|
12
12
|
#
|
13
|
-
# tag = Intercom::Tag.create(:name => "Super Tag", :
|
14
|
-
# tag = Intercom::Tag.create(:name => "Super Tag", :
|
13
|
+
# tag = Intercom::Tag.create(:name => "Super Tag", :user_ids => ['abc123', 'def456'])
|
14
|
+
# tag = Intercom::Tag.create(:name => "Super Tag", :emails => ['bob@example.com', 'joe@example.com'])
|
15
15
|
#
|
16
16
|
# You can also create a tag and save it like this:
|
17
17
|
# tag = Intercom::Tag.new
|
18
18
|
# tag.name = "Super Tag"
|
19
|
-
# tag.color = "red"
|
20
19
|
# tag.user_ids = ['abc123', 'def456']
|
21
20
|
# tag.tag_or_untag = "tag"
|
22
21
|
# tag.save
|
23
22
|
#
|
24
23
|
# Or update a tag and save it like this:
|
25
24
|
# tag = Intercom::Tag.find_by_name "Super Tag"
|
26
|
-
# tag.color = "green"
|
27
25
|
# tag.user_ids = ['abc123']
|
28
26
|
# tag.tag_or_untag = "untag"
|
29
27
|
# tag.save
|
@@ -32,7 +30,7 @@ module Intercom
|
|
32
30
|
extend RequiresParameters
|
33
31
|
include HashableObject
|
34
32
|
|
35
|
-
attr_accessor :name
|
33
|
+
attr_accessor :name
|
36
34
|
attr_reader :segment, :tagged_user_count, :id
|
37
35
|
attr_writer :user_ids, :emails, :tag_or_untag
|
38
36
|
|
data/lib/intercom/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -96,17 +96,6 @@ def test_tag
|
|
96
96
|
{
|
97
97
|
"id" => "4f73428b5e4dfc000b000112",
|
98
98
|
"name" => "Test Tag",
|
99
|
-
"color" => "red",
|
100
|
-
"segment" => false,
|
101
|
-
"tagged_user_count" => 2
|
102
|
-
}
|
103
|
-
end
|
104
|
-
|
105
|
-
def updated_test_tag
|
106
|
-
{
|
107
|
-
"id" => "4f73428b5e4dfc000b000112",
|
108
|
-
"name" => "Test Tag",
|
109
|
-
"color" => "green",
|
110
99
|
"segment" => false,
|
111
100
|
"tagged_user_count" => 2
|
112
101
|
}
|
@@ -5,38 +5,19 @@ describe "Intercom::Tag" do
|
|
5
5
|
Intercom.expects(:get).with("/v1/tags", {:name => "Test Tag"}).returns(test_tag)
|
6
6
|
tag = Intercom::Tag.find(:name => "Test Tag")
|
7
7
|
tag.name.must_equal "Test Tag"
|
8
|
-
tag.color.must_equal "red"
|
9
|
-
end
|
10
|
-
|
11
|
-
it "gets a tag by name" do
|
12
|
-
Intercom.expects(:get).with("/v1/tags", {:name => "Test Tag"}).returns(test_tag)
|
13
|
-
tag = Intercom::Tag.find_by_name "Test Tag"
|
14
|
-
tag.name.must_equal "Test Tag"
|
15
|
-
tag.color.must_equal "red"
|
16
8
|
end
|
17
9
|
|
18
10
|
it "creates a tag" do
|
19
11
|
Intercom.expects(:post).with("/v1/tags", {:name => "Test Tag"}).returns(test_tag)
|
20
12
|
tag = Intercom::Tag.create(:name => "Test Tag")
|
21
13
|
tag.name.must_equal "Test Tag"
|
22
|
-
tag.color.must_equal "red"
|
23
14
|
end
|
24
15
|
|
25
16
|
it "tags users" do
|
26
|
-
Intercom.expects(:post).with("/v1/tags", {:name => "Test Tag", :
|
27
|
-
tag = Intercom::Tag.create(:name => "Test Tag", :
|
17
|
+
Intercom.expects(:post).with("/v1/tags", {:name => "Test Tag", :user_ids => ["abc123", "def456"], :tag_or_untag => "tag"}).returns(test_tag)
|
18
|
+
tag = Intercom::Tag.create(:name => "Test Tag", :user_ids => ["abc123", "def456"], :tag_or_untag => "tag")
|
28
19
|
tag.name.must_equal "Test Tag"
|
29
|
-
tag.color.must_equal "red"
|
30
20
|
tag.tagged_user_count.must_equal 2
|
31
21
|
end
|
32
22
|
|
33
|
-
it "updates tags" do
|
34
|
-
Intercom.expects(:get).with("/v1/tags", {:name => "Test Tag"}).returns(test_tag)
|
35
|
-
tag = Intercom::Tag.find_by_name "Test Tag"
|
36
|
-
tag.color.must_equal "red"
|
37
|
-
tag.color = "green"
|
38
|
-
Intercom.expects(:post).with("/v1/tags", {:name => "Test Tag", :color => "green"}).returns(updated_test_tag)
|
39
|
-
tag.save
|
40
|
-
end
|
41
|
-
|
42
23
|
end
|