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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 727e72af37a924f8b9920e277c27655c90f916a0
4
- data.tar.gz: f9bd615578c582c877e1675d9eda5a4cf9078073
3
+ metadata.gz: 92e19ae4f118e928256eebed48e69b465fa80a4d
4
+ data.tar.gz: 05c7f801c10adc54045b4a7a3dc0917ba7c5e744
5
5
  SHA512:
6
- metadata.gz: 5f9c2a425d1bbfc34ee3cbe250014d068afb3de78c535a9ae5990d40c688782b6f2d6eecb0aa80a604936c3d76d0a26d3187b5e185f958635774fcce19a2de30
7
- data.tar.gz: 2dd0f223755491dbde191aa97835e94d7d4329455d9d26da7abe2c5afccb50a8dbbc8abb408b3132004d0efc5e4c5d4c081465bec8bed5cff6aa4b8bba72db6c
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
- #### Messages
58
+ #### Message Threads
59
59
 
60
- Intercom::Message.create(:email => "bob@example.com", :body => "Example message from bob@example.com to your application on Intercom.")
61
- Intercom::Message.find(:email => "bob@example.com", :thread_id => 123)
62
- Intercom::Message.find_all(:email => "bob@example.com")
63
- Intercom::Message.mark_as_read(:email => "bob@example.com", :thread_id => 123)
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
 
@@ -1,3 +1,6 @@
1
+ 0.1.16
2
+ - Add BadGatewayError to properly report that sort of error.
3
+
1
4
  0.1.15
2
5
  - Fix location_data and social_profiles for ruby 2.0 change to #respond_to? method.
3
6
 
@@ -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
@@ -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
 
@@ -1,3 +1,3 @@
1
1
  module Intercom #:nodoc:
2
- VERSION = "0.1.15"
2
+ VERSION = "0.1.16"
3
3
  end
@@ -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.15
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-09-10 00:00:00.000000000 Z
15
+ date: 2013-10-15 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: minitest