intercom 2.1.1 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d9ed1775dc3cc5e1980a18e1419ce693ec689fb8
4
- data.tar.gz: 0dc43ebffc28d82a5ac234718d2f5825145b1285
3
+ metadata.gz: bfa7fdd97efe351ed92aaeb329120fa12544523c
4
+ data.tar.gz: 2fdd8a519b9f5f27cf25706467671dfd34c760ab
5
5
  SHA512:
6
- metadata.gz: 522dba42daac4713dddace9c320278f93c56e1e12998054bfbfe865d84e8832d8108edff50624f913a28362f8c7f4a9577e340cf9810c31c0f4987d30330af1f
7
- data.tar.gz: 0440645b457b10b1f59792ef6e742b8c96ca46a1a40b7b011ed910a27e777eb03324a0a8db99167f835d67e1f66e295568bb63d051f293048aca766c869ee729
6
+ metadata.gz: a7c1c1db29702c1b4dab017afbe3b80b4a67ab6cbb419e35e426b0d5ac3d73d72307b67f9dd171c45bde0365c6e4fae88d22d490643135cb2a61b179cbcf1dcf
7
+ data.tar.gz: c45e08a51fc9462b587ef2529e2752359b26edbe470d9d33d739c68bdbe975059d19ded0839ea928e099d0c28ac649876b1d187596f5708d6a3f3ec1f798a9ee
data/changes.txt CHANGED
@@ -1,3 +1,7 @@
1
+ 2.2.2
2
+ - Clean up some spec warnings
3
+ - Fix incrementing of custom data
4
+
1
5
  2.1.1
2
6
  - Added User Agent header
3
7
 
@@ -4,7 +4,6 @@ require 'intercom/traits/api_resource'
4
4
  module Intercom
5
5
  class Admin
6
6
  include ApiOperations::List
7
- include Traits::IncrementableAttributes
8
7
  include Traits::ApiResource
9
8
  end
10
9
  end
@@ -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 => ex
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
@@ -41,7 +41,7 @@ module Intercom
41
41
  end
42
42
 
43
43
  def tag_object_list(args)
44
- to_tag_object_list = args[1].map { |id| { :id => id } }
44
+ args[1].map { |id| { :id => id } }
45
45
  end
46
46
 
47
47
  def untag_object_list(args)
@@ -3,20 +3,9 @@ module Intercom
3
3
  module IncrementableAttributes
4
4
 
5
5
  def increment(key, value=1)
6
- mark_field_as_changed!(:increments)
7
- increments[key] ||= 0
8
- increments[key] += value
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
@@ -1,3 +1,3 @@
1
1
  module Intercom #:nodoc:
2
- VERSION = "2.1.1"
2
+ VERSION = "2.1.2"
3
3
  end
data/spec/spec_helper.rb CHANGED
@@ -108,7 +108,6 @@ def test_message
108
108
  end
109
109
 
110
110
  def page_of_users(include_next_link: false)
111
- all_user =
112
111
  {
113
112
  "type"=>"user.list",
114
113
  "pages"=>
@@ -18,7 +18,6 @@ describe Intercom::Traits::ApiResource do
18
18
  before(:each) { api_resource.from_response(object_json) }
19
19
 
20
20
  it "does not set type on parsing json" do
21
- assert_nil api_resource.instance_variable_get(:@type)
22
21
  api_resource.wont_respond_to :type
23
22
  end
24
23
 
@@ -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["increments"].must_equal "mad" => 1
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["increments"].must_equal "mad" => 4
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["increments"].must_equal "mad" => -1
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["increments"].must_equal "new_field" => 3
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["increments"].must_equal "mad" => 2
139
+ @user.to_hash["custom_attributes"]["mad"].must_equal 125
152
140
  end
153
141
  end
154
142
 
@@ -40,6 +40,7 @@ describe Intercom do
40
40
  after do
41
41
  Intercom.protocol = @protocol
42
42
  Intercom.hostname = @hostname
43
+ Intercom.endpoints = ["https://api.intercom.io"]
43
44
  end
44
45
 
45
46
  it "allows overriding of the endpoint and protocol" do
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.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-06-27 00:00:00.000000000 Z
18
+ date: 2014-07-01 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: minitest