tddium_client 0.0.12 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/tddium_client.rb CHANGED
@@ -51,6 +51,7 @@ module TddiumClient
51
51
  def initialize(http_response)
52
52
  super
53
53
  raise TddiumClient::Error::Server.new(http_response) unless tddium_response.include?("status")
54
+ raise TddiumClient::Error::UpgradeRequired.new(http_response) if http_response.code == 426
54
55
  raise TddiumClient::Error::API.new(http_response) unless tddium_response["status"] == 0
55
56
  end
56
57
  end
@@ -90,6 +91,16 @@ module TddiumClient
90
91
  tddium_response["status"]
91
92
  end
92
93
  end
94
+
95
+ class UpgradeRequired < API
96
+ def initialize(http_response)
97
+ super
98
+ end
99
+
100
+ def message
101
+ "API Error: #{explanation}"
102
+ end
103
+ end
93
104
  end
94
105
 
95
106
  class InternalClient
@@ -3,5 +3,5 @@ Copyright (c) 2011 Solano Labs All Rights Reserved
3
3
  =end
4
4
 
5
5
  module TddiumClient
6
- VERSION = "0.0.12"
6
+ VERSION = "0.1.0"
7
7
  end
@@ -194,6 +194,19 @@ describe "TddiumClient" do
194
194
 
195
195
  end
196
196
  end
197
+
198
+ describe "UpgradeRequired" do
199
+ before do
200
+ stub_http_code(426) # Upgrade required
201
+ stub_sample_api_response(:success => false, :explanation => "You need to upgrade")
202
+ end
203
+
204
+ let (:upgrade_required) { TddiumClient::Error::UpgradeRequired.new(http_response) }
205
+
206
+ it "should print the explanation" do
207
+ upgrade_required.message.should == "API Error: You need to upgrade"
208
+ end
209
+ end
197
210
  end
198
211
 
199
212
  describe "InternalClient" do
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: tddium_client
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.12
5
+ version: 0.1.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jay Moorthi