intercom 2.1.4 → 2.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -3
- data/changes.txt +6 -0
- data/lib/intercom/api_operations/find.rb +1 -1
- data/lib/intercom/api_operations/find_all.rb +1 -1
- data/lib/intercom/request.rb +3 -1
- data/lib/intercom/version.rb +1 -1
- data/spec/unit/intercom/traits/api_resource_spec.rb +3 -1
- metadata +16 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93b3088910bdf34dcb9dd1566e1d926a89050da0
|
4
|
+
data.tar.gz: db0ef2a2587d36903eec10f0fb436aa18552e4fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb04dbf382b3151d00a28381f1e4fd2580a6063a044c6999563cfeb28d594fd81fe101b2cae585c713a54390bc0e57dcb383537021e21b4083498584e6acfe1e
|
7
|
+
data.tar.gz: add597f18c97052f2d21196e0a70bd75f5267010b18bf37b33f48148c22c4f58e80f61d726465bfdad65dfb36b3ab2dcf5b08f492c0a0d3b8ee3553a3932adb1
|
data/Gemfile
CHANGED
data/changes.txt
CHANGED
@@ -3,7 +3,7 @@ module Intercom
|
|
3
3
|
module Find
|
4
4
|
module ClassMethods
|
5
5
|
def find(params)
|
6
|
-
raise BadRequestError, "#{self}#find takes a hash as
|
6
|
+
raise BadRequestError, "#{self}#find takes a hash as its parameter but you supplied #{params.inspect}" unless params.is_a? Hash
|
7
7
|
collection_name = Utils.resource_class_to_collection_name(self)
|
8
8
|
if params[:id]
|
9
9
|
response = Intercom.get("/#{collection_name}/#{params[:id]}", {})
|
@@ -5,7 +5,7 @@ module Intercom
|
|
5
5
|
module FindAll
|
6
6
|
module ClassMethods
|
7
7
|
def find_all(params)
|
8
|
-
raise BadRequestError, "#{self}#find takes a hash as
|
8
|
+
raise BadRequestError, "#{self}#find takes a hash as its parameter but you supplied #{params.inspect}" unless params.is_a? Hash
|
9
9
|
collection_name = Utils.resource_class_to_collection_name(self)
|
10
10
|
finder_details = {}
|
11
11
|
if params[:id] && !type_switched_finder?(params)
|
data/lib/intercom/request.rb
CHANGED
@@ -81,6 +81,8 @@ module Intercom
|
|
81
81
|
raise Intercom::ResourceNotFound.new('Resource Not Found')
|
82
82
|
elsif res.code.to_i.eql?(401)
|
83
83
|
raise Intercom::AuthenticationError.new('Unauthorized')
|
84
|
+
elsif res.code.to_i.eql?(403)
|
85
|
+
raise Intercom::AuthenticationError.new('Forbidden')
|
84
86
|
elsif res.code.to_i.eql?(500)
|
85
87
|
raise Intercom::ServerError.new('Server Error')
|
86
88
|
elsif res.code.to_i.eql?(502)
|
@@ -100,7 +102,7 @@ module Intercom
|
|
100
102
|
:application_error_code => error_code
|
101
103
|
}
|
102
104
|
case error_code
|
103
|
-
when 'unauthorized'
|
105
|
+
when 'unauthorized', 'forbidden'
|
104
106
|
raise Intercom::AuthenticationError.new(error_details['message'], error_context)
|
105
107
|
when "bad_request", "missing_parameter", 'parameter_invalid'
|
106
108
|
raise Intercom::BadRequestError.new(error_details['message'], error_context)
|
data/lib/intercom/version.rb
CHANGED
@@ -13,7 +13,7 @@ describe Intercom::Traits::ApiResource do
|
|
13
13
|
"user_count"=>1,
|
14
14
|
"custom_attributes"=>{}}
|
15
15
|
end
|
16
|
-
let(:api_resource) {
|
16
|
+
let(:api_resource) { DummyClass.new.extend(Intercom::Traits::ApiResource)}
|
17
17
|
|
18
18
|
before(:each) { api_resource.from_response(object_json) }
|
19
19
|
|
@@ -80,4 +80,6 @@ describe Intercom::Traits::ApiResource do
|
|
80
80
|
keys.each { |key| h.delete(key) }
|
81
81
|
h
|
82
82
|
end
|
83
|
+
|
84
|
+
class DummyClass; end
|
83
85
|
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: 2.1.
|
4
|
+
version: 2.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben McRedmond
|
@@ -15,76 +15,76 @@ authors:
|
|
15
15
|
autorequire:
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
|
-
date: 2014-08-
|
18
|
+
date: 2014-08-15 00:00:00.000000000 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: minitest
|
22
22
|
requirement: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
type: :development
|
28
28
|
prerelease: false
|
29
29
|
version_requirements: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: rake
|
36
36
|
requirement: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
type: :development
|
42
42
|
prerelease: false
|
43
43
|
version_requirements: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: mocha
|
50
50
|
requirement: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
57
|
version_requirements: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: fakeweb
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.3'
|
69
69
|
type: :development
|
70
70
|
prerelease: false
|
71
71
|
version_requirements: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ~>
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '1.3'
|
76
76
|
- !ruby/object:Gem::Dependency
|
77
77
|
name: json
|
78
78
|
requirement: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
type: :runtime
|
84
84
|
prerelease: false
|
85
85
|
version_requirements: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - '>='
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
description: 'Intercom (https://www.intercom.io) is a customer relationship management
|
@@ -103,8 +103,8 @@ executables: []
|
|
103
103
|
extensions: []
|
104
104
|
extra_rdoc_files: []
|
105
105
|
files:
|
106
|
-
-
|
107
|
-
-
|
106
|
+
- .gitignore
|
107
|
+
- .travis.yml
|
108
108
|
- Gemfile
|
109
109
|
- MIT-LICENSE
|
110
110
|
- README.md
|
@@ -171,12 +171,12 @@ require_paths:
|
|
171
171
|
- lib
|
172
172
|
required_ruby_version: !ruby/object:Gem::Requirement
|
173
173
|
requirements:
|
174
|
-
- -
|
174
|
+
- - ~>
|
175
175
|
- !ruby/object:Gem::Version
|
176
176
|
version: '2.0'
|
177
177
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
178
178
|
requirements:
|
179
|
-
- -
|
179
|
+
- - '>='
|
180
180
|
- !ruby/object:Gem::Version
|
181
181
|
version: '0'
|
182
182
|
requirements: []
|