intercom 2.1.1 → 2.1.2
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 +4 -0
- data/lib/intercom/admin.rb +0 -1
- data/lib/intercom/generic_handlers/count.rb +1 -1
- data/lib/intercom/generic_handlers/tag.rb +1 -1
- data/lib/intercom/traits/incrementable_attributes.rb +3 -14
- data/lib/intercom/version.rb +1 -1
- data/spec/spec_helper.rb +0 -1
- data/spec/unit/intercom/traits/api_resource_spec.rb +0 -1
- data/spec/unit/intercom/user_spec.rb +5 -17
- data/spec/unit/intercom_spec.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfa7fdd97efe351ed92aaeb329120fa12544523c
|
4
|
+
data.tar.gz: 2fdd8a519b9f5f27cf25706467671dfd34c760ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7c1c1db29702c1b4dab017afbe3b80b4a67ab6cbb419e35e426b0d5ac3d73d72307b67f9dd171c45bde0365c6e4fae88d22d490643135cb2a61b179cbcf1dcf
|
7
|
+
data.tar.gz: c45e08a51fc9462b587ef2529e2752359b26edbe470d9d33d739c68bdbe975059d19ded0839ea928e099d0c28ac649876b1d187596f5708d6a3f3ec1f798a9ee
|
data/changes.txt
CHANGED
data/lib/intercom/admin.rb
CHANGED
@@ -22,7 +22,7 @@ module Intercom
|
|
22
22
|
|
23
23
|
def do_count
|
24
24
|
entity.fetch_for_app.send(appwide_entity_to_count)['count']
|
25
|
-
rescue Intercom::AttributeNotSetError
|
25
|
+
rescue Intercom::AttributeNotSetError
|
26
26
|
# Indicates this this kind of counting is not supported
|
27
27
|
raise_no_method_missing_handler
|
28
28
|
end
|
@@ -3,20 +3,9 @@ module Intercom
|
|
3
3
|
module IncrementableAttributes
|
4
4
|
|
5
5
|
def increment(key, value=1)
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
end
|
10
|
-
|
11
|
-
private
|
12
|
-
|
13
|
-
def increments
|
14
|
-
@increments ||= {}
|
15
|
-
end
|
16
|
-
|
17
|
-
def increments=(hash)
|
18
|
-
mark_field_as_changed!(:increments)
|
19
|
-
@increments = hash
|
6
|
+
existing_value = self.custom_attributes[key]
|
7
|
+
existing_value ||= 0
|
8
|
+
self.custom_attributes[key] = existing_value + value
|
20
9
|
end
|
21
10
|
end
|
22
11
|
end
|
data/lib/intercom/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -115,40 +115,28 @@ describe "Intercom::User" do
|
|
115
115
|
|
116
116
|
it "increments up by 1 with no args" do
|
117
117
|
@user.increment("mad")
|
118
|
-
@user.to_hash["
|
118
|
+
@user.to_hash["custom_attributes"]["mad"].must_equal 124
|
119
119
|
end
|
120
120
|
|
121
121
|
it "increments up by given value" do
|
122
122
|
@user.increment("mad", 4)
|
123
|
-
@user.to_hash["
|
123
|
+
@user.to_hash["custom_attributes"]["mad"].must_equal 127
|
124
124
|
end
|
125
125
|
|
126
126
|
it "increments down by given value" do
|
127
127
|
@user.increment("mad", -1)
|
128
|
-
@user.to_hash["
|
129
|
-
end
|
130
|
-
|
131
|
-
it "doesn't allow direct access to increments hash" do
|
132
|
-
proc { @user.increments["mad"] = 1 }.must_raise Intercom::AttributeNotSetError
|
133
|
-
proc { @user.increments }.must_raise Intercom::AttributeNotSetError
|
134
|
-
end
|
135
|
-
|
136
|
-
it "can update the increments hash without losing previous changes" do
|
137
|
-
@user.increment("mad")
|
138
|
-
@user.to_hash["increments"].must_equal "mad" => 1
|
139
|
-
@user.increment("another", -2)
|
140
|
-
@user.to_hash["increments"].must_equal "mad" => 1, "another" => -2
|
128
|
+
@user.to_hash["custom_attributes"]["mad"].must_equal 122
|
141
129
|
end
|
142
130
|
|
143
131
|
it "can increment new custom data fields" do
|
144
132
|
@user.increment("new_field", 3)
|
145
|
-
@user.to_hash["
|
133
|
+
@user.to_hash["custom_attributes"]["new_field"].must_equal 3
|
146
134
|
end
|
147
135
|
|
148
136
|
it "can call increment on the same key twice and increment by 2" do
|
149
137
|
@user.increment("mad")
|
150
138
|
@user.increment("mad")
|
151
|
-
@user.to_hash["
|
139
|
+
@user.to_hash["custom_attributes"]["mad"].must_equal 125
|
152
140
|
end
|
153
141
|
end
|
154
142
|
|
data/spec/unit/intercom_spec.rb
CHANGED
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: 2.1.
|
4
|
+
version: 2.1.2
|
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: 2014-
|
18
|
+
date: 2014-07-01 00:00:00.000000000 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: minitest
|