intercom 3.5.22 → 3.5.23

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 351f478fa4497d87d46e4aca16fa39f35d03f5fe
4
- data.tar.gz: 714050f873df45bdd8d4f213cce69d212a5dc978
3
+ metadata.gz: 7e68aeb1127d2cf823cc5dd0ddd659dcd3c87b21
4
+ data.tar.gz: 47726ed9aaa657973655766fbde7562aa106f9bd
5
5
  SHA512:
6
- metadata.gz: 08df6d6c19a5cbfcb6c59407ba644dfdf7a6f0b09f1fee494d7f34567318b199b4f67c60c74fba0247dd412a5d1d2d008c239975188cd2fec3ac60571a0db3a2
7
- data.tar.gz: d1d86a6f4470a294e106d560eb31a58a31425a39756ae3ff48d5c68cac106d8a2af64e70e46ea21f38b55ba65a5e57e70636a93429b12dea212537de7f373f27
6
+ metadata.gz: 22c0957deab7de22f497ace8c4b5e2c51a36719cd12abae4dc83c89525b795b665c04fb62b1a85e537c4e9e9a5ee6a84beef9aad4920e8a3f281bcdd1300f189
7
+ data.tar.gz: 579157330addc830b0c64bf48f0721d94f956e30a1248d59380c6284ca32bd2ff43e7b49f6f67db94ac3e75e5074c3020eeb50d2c39741d8ef327c2002472d34
data/README.md CHANGED
@@ -22,7 +22,7 @@ This version of the gem is compatible with `Ruby 2.1` and above.
22
22
 
23
23
  Using bundler:
24
24
 
25
- gem 'intercom', '~> 3.5.22'
25
+ gem 'intercom', '~> 3.5.23'
26
26
 
27
27
  ## Basic Usage
28
28
 
data/changes.txt CHANGED
@@ -1,3 +1,6 @@
1
+ 3.5.23
2
+ - New type of error (ResourceNotUniqueError). Thrown when trying to create a resource that already exists in Intercom
3
+
1
4
  3.5.22
2
5
  - Return object type
3
6
 
@@ -42,6 +42,9 @@ module Intercom
42
42
  # Raised when requesting resources on behalf of a user that doesn't exist in your application on Intercom.
43
43
  class ResourceNotFound < IntercomError; end
44
44
 
45
+ # Raised when trying to create a resource that already exists in Intercom.
46
+ class ResourceNotUniqueError < IntercomError; end
47
+
45
48
  # Raised when the request has bad syntax
46
49
  class BadRequestError < IntercomError; end
47
50
 
@@ -55,13 +58,13 @@ module Intercom
55
58
  class MultipleMatchingUsersError < IntercomError; end
56
59
 
57
60
  # Raised when restoring a blocked user
58
- class BlockedUserError < IntercomError ; end
61
+ class BlockedUserError < IntercomError; end
59
62
 
60
63
  # Raised when you try to call a non-setter method that does not exist on an object
61
- class Intercom::AttributeNotSetError < IntercomError ; end
64
+ class Intercom::AttributeNotSetError < IntercomError; end
62
65
 
63
66
  # Raised when unexpected nil returned from server
64
- class Intercom::HttpError < IntercomError ; end
67
+ class Intercom::HttpError < IntercomError; end
65
68
 
66
69
  #
67
70
  # Non-public errors (internal to the gem)
@@ -163,6 +163,8 @@ module Intercom
163
163
  raise Intercom::ServiceUnavailableError.new(error_details['message'], error_context)
164
164
  when 'conflict', 'unique_user_constraint'
165
165
  raise Intercom::MultipleMatchingUsersError.new(error_details['message'], error_context)
166
+ when 'resource_conflict'
167
+ raise Intercom::ResourceNotUniqueError.new(error_details['message'], error_context)
166
168
  when nil, ''
167
169
  raise Intercom::UnexpectedError.new(message_for_unexpected_error_without_type(error_details, parsed_http_code), error_context)
168
170
  else
@@ -1,3 +1,3 @@
1
1
  module Intercom #:nodoc:
2
- VERSION = "3.5.22"
2
+ VERSION = "3.5.23"
3
3
  end
@@ -7,13 +7,13 @@ describe 'Intercom::Request' do
7
7
  it 'raises an error when a html error page rendered' do
8
8
  response = OpenStruct.new(:code => 500)
9
9
  req = Intercom::Request.new('path/', 'GET')
10
- proc {req.parse_body('<html>somethjing</html>', response)}.must_raise(Intercom::ServerError)
10
+ proc {req.parse_body('<html>something</html>', response)}.must_raise(Intercom::ServerError)
11
11
  end
12
12
 
13
13
  it 'raises a RateLimitExceeded error when the response code is 429' do
14
14
  response = OpenStruct.new(:code => 429)
15
15
  req = Intercom::Request.new('path/', 'GET')
16
- proc {req.parse_body('<html>somethjing</html>', response)}.must_raise(Intercom::RateLimitExceeded)
16
+ proc {req.parse_body('<html>something</html>', response)}.must_raise(Intercom::RateLimitExceeded)
17
17
  end
18
18
 
19
19
  it 'parse_body raises an error if the decoded_body is "null"' do
@@ -23,8 +23,8 @@ describe 'Intercom::Request' do
23
23
  end
24
24
 
25
25
  describe 'Intercom::Client' do
26
- let (:client) { Intercom::Client.new(token: 'foo', handle_rate_limit: true) }
27
- let (:uri) {"https://api.intercom.io/users"}
26
+ let(:client) { Intercom::Client.new(token: 'foo', handle_rate_limit: true) }
27
+ let(:uri) {"https://api.intercom.io/users"}
28
28
 
29
29
  it 'should have handle_rate_limit set' do
30
30
  client.handle_rate_limit.must_equal(true)
@@ -63,6 +63,18 @@ describe 'Intercom::Request' do
63
63
 
64
64
  end
65
65
 
66
+
67
+ describe "Application errors on failure" do
68
+ let(:uri) {"https://api.intercom.io/conversations/reply"}
69
+ it 'should raise ResourceNotUniqueError error on resource_conflict code' do
70
+ # Use webmock to mock the HTTP request
71
+ stub_request(:put, uri).\
72
+ to_return(status: [409, "Resource Already Exists"], headers: { 'X-RateLimit-Reset' => Time.now.utc + 10 }, body: {type: "error.list", errors: [ code: "resource_conflict" ]}.to_json)
73
+ req = Intercom::Request.put(uri, "")
74
+ expect { req.execute(target_base_url=uri, username: "ted", secret: "") }.must_raise(Intercom::ResourceNotUniqueError)
75
+ end
76
+ end
77
+
66
78
  it 'parse_body returns nil if decoded_body is nil' do
67
79
  response = OpenStruct.new(:code => 500)
68
80
  req = Intercom::Request.new('path/', 'GET')
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.5.22
4
+ version: 3.5.23
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: 2017-11-08 00:00:00.000000000 Z
18
+ date: 2017-12-04 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: minitest
@@ -244,30 +244,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
244
244
  version: '0'
245
245
  requirements: []
246
246
  rubyforge_project: intercom
247
- rubygems_version: 2.6.13
247
+ rubygems_version: 2.5.1
248
248
  signing_key:
249
249
  specification_version: 4
250
250
  summary: Ruby bindings for the Intercom API
251
- test_files:
252
- - spec/spec_helper.rb
253
- - spec/unit/intercom/admin_spec.rb
254
- - spec/unit/intercom/client_collection_proxy_spec.rb
255
- - spec/unit/intercom/client_spec.rb
256
- - spec/unit/intercom/company_spec.rb
257
- - spec/unit/intercom/contact_spec.rb
258
- - spec/unit/intercom/conversation_spec.rb
259
- - spec/unit/intercom/count_spec.rb
260
- - spec/unit/intercom/event_spec.rb
261
- - spec/unit/intercom/job_spec.rb
262
- - spec/unit/intercom/lib/flat_store_spec.rb
263
- - spec/unit/intercom/message_spec.rb
264
- - spec/unit/intercom/note_spec.rb
265
- - spec/unit/intercom/request_spec.rb
266
- - spec/unit/intercom/scroll_collection_proxy_spec.rb
267
- - spec/unit/intercom/segment_spec.rb
268
- - spec/unit/intercom/subscription_spec.rb
269
- - spec/unit/intercom/tag_spec.rb
270
- - spec/unit/intercom/traits/api_resource_spec.rb
271
- - spec/unit/intercom/user_spec.rb
272
- - spec/unit/intercom/visitors_spec.rb
273
- - spec/unit/intercom_spec.rb
251
+ test_files: []