intercom 0.1.15 → 0.1.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -5
- data/changes.txt +3 -0
- data/lib/intercom.rb +4 -0
- data/lib/intercom/request.rb +4 -2
- data/lib/intercom/version.rb +1 -1
- data/spec/integration/intercom_api_integration_spec.rb +9 -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: 92e19ae4f118e928256eebed48e69b465fa80a4d
|
4
|
+
data.tar.gz: 05c7f801c10adc54045b4a7a3dc0917ba7c5e744
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03316db456aeaf630a3e76421b790f9e23bfcabceb98a4a2050bf7b9491e77f77e44c4b11cde17431d2244e5a373f71f988882a1eca31feadd9064e8e9ac41a5
|
7
|
+
data.tar.gz: ae55431310b1bd92fa3fb5a01d1fe7b15b36d6261baf6f410e4b7daa0567f8e736519dedfacc7cdeaab327412c27655dbbe26a56e3652b91ca2c61b87f7a0c44
|
data/README.md
CHANGED
@@ -55,12 +55,12 @@ You can also pass custom data within a company:
|
|
55
55
|
|
56
56
|
user.company = {:id => 6, :name => "Intercom", :referral_source => "Google"}
|
57
57
|
|
58
|
-
####
|
58
|
+
#### Message Threads
|
59
59
|
|
60
|
-
Intercom::
|
61
|
-
Intercom::
|
62
|
-
Intercom::
|
63
|
-
Intercom::
|
60
|
+
Intercom::MessageThread.create(:email => "bob@example.com", :body => "Example message from bob@example.com to your application on Intercom.")
|
61
|
+
Intercom::MessageThread.find(:email => "bob@example.com", :thread_id => 123)
|
62
|
+
Intercom::MessageThread.find_all(:email => "bob@example.com")
|
63
|
+
Intercom::MessageThread.mark_as_read(:email => "bob@example.com", :thread_id => 123)
|
64
64
|
|
65
65
|
#### Impressions
|
66
66
|
|
data/changes.txt
CHANGED
data/lib/intercom.rb
CHANGED
@@ -152,6 +152,10 @@ module Intercom
|
|
152
152
|
class ServerError < StandardError;
|
153
153
|
end
|
154
154
|
|
155
|
+
# Raised when we have bad gateway errors.
|
156
|
+
class BadGatewayError < StandardError;
|
157
|
+
end
|
158
|
+
|
155
159
|
# Raised when we reach socket connect timeout
|
156
160
|
class ServiceUnavailableError < StandardError;
|
157
161
|
end
|
data/lib/intercom/request.rb
CHANGED
@@ -78,10 +78,12 @@ module Intercom
|
|
78
78
|
raise Intercom::ResourceNotFound
|
79
79
|
elsif res.code.to_i.eql?(401)
|
80
80
|
raise Intercom::AuthenticationError
|
81
|
-
elsif res.code.to_i.eql?(503)
|
82
|
-
raise Intercom::ServiceUnavailableError
|
83
81
|
elsif res.code.to_i.eql?(500)
|
84
82
|
raise Intercom::ServerError
|
83
|
+
elsif res.code.to_i.eql?(502)
|
84
|
+
raise Intercom::BadGatewayError
|
85
|
+
elsif res.code.to_i.eql?(503)
|
86
|
+
raise Intercom::ServiceUnavailableError
|
85
87
|
end
|
86
88
|
end
|
87
89
|
|
data/lib/intercom/version.rb
CHANGED
@@ -68,4 +68,13 @@ describe "api.intercom.io dummy data requests" do
|
|
68
68
|
Intercom.endpoints = ["http://example.com", "http://api.example.com"]
|
69
69
|
proc { Intercom::User.find(:email => "somebody@example.com")}.must_raise Intercom::ServiceUnavailableError
|
70
70
|
end
|
71
|
+
|
72
|
+
it "should raise gateway error when the request returns a 502" do
|
73
|
+
FakeWeb.register_uri(:get, %r|example\.com/|, :status => ["502", "Bad Gateway"])
|
74
|
+
Intercom.endpoints = ["http://example.com"]
|
75
|
+
proc { Intercom::User.find(:email => "somebody@example.com")}.must_raise Intercom::BadGatewayError
|
76
|
+
Intercom.endpoints = ["http://example.com", "http://api.example.com"]
|
77
|
+
proc { Intercom::User.find(:email => "somebody@example.com")}.must_raise Intercom::BadGatewayError
|
78
|
+
|
79
|
+
end
|
71
80
|
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: 0.1.
|
4
|
+
version: 0.1.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben McRedmond
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2013-
|
15
|
+
date: 2013-10-15 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: minitest
|