click_and_send 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,7 @@
|
|
1
1
|
module ClickAndSend::Errors
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
APIError = Class.new(StandardError)
|
3
|
+
InvalidConfiguration = Class.new(StandardError)
|
4
|
+
InvalidInput = Class.new(StandardError)
|
5
|
+
NotImplemented = Class.new(StandardError)
|
6
|
+
UnhandledResponse = Class.new(StandardError)
|
6
7
|
end
|
@@ -98,8 +98,17 @@ module ClickAndSend
|
|
98
98
|
raw = request.to_hash[key(:response)][key(:response)]
|
99
99
|
result = Nori.parse(raw)
|
100
100
|
result.fetch(key(:answer))
|
101
|
-
rescue
|
102
|
-
|
101
|
+
rescue StandardError => e
|
102
|
+
message = <<-EOS.strip.gsub(/\n +/, "\n")
|
103
|
+
#{e.class} #{e.message}
|
104
|
+
|
105
|
+
raw response:
|
106
|
+
#{raw}
|
107
|
+
|
108
|
+
result:
|
109
|
+
#{result}
|
110
|
+
EOS
|
111
|
+
raise(ClickAndSend::Errors::UnhandledResponse, message)
|
103
112
|
end
|
104
113
|
end
|
105
114
|
|
@@ -82,14 +82,17 @@ describe ClickAndSend::Request do
|
|
82
82
|
|
83
83
|
context "keys undefined" do
|
84
84
|
it "raises NotImplemented" do
|
85
|
-
expect { subject }.to raise_error
|
85
|
+
expect { subject }.to raise_error { |e| # warning: do..end block gives false positive
|
86
|
+
e.should be_a(ClickAndSend::Errors::UnhandledResponse)
|
87
|
+
e.message.should include('ClickAndSend::Errors::NotImplemented')
|
88
|
+
}
|
86
89
|
end
|
87
90
|
end
|
88
91
|
|
89
92
|
context "missing key" do
|
90
93
|
before { klass.send(:define_method, :keys) { {} } }
|
91
94
|
it "raises KeyError" do
|
92
|
-
expect { subject }.to raise_error
|
95
|
+
expect { subject }.to raise_error(ClickAndSend::Errors::UnhandledResponse)
|
93
96
|
end
|
94
97
|
end
|
95
98
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: click_and_send
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -178,7 +178,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
178
178
|
version: '0'
|
179
179
|
segments:
|
180
180
|
- 0
|
181
|
-
hash:
|
181
|
+
hash: 3744272376626061336
|
182
182
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
183
183
|
none: false
|
184
184
|
requirements:
|
@@ -187,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
187
187
|
version: '0'
|
188
188
|
segments:
|
189
189
|
- 0
|
190
|
-
hash:
|
190
|
+
hash: 3744272376626061336
|
191
191
|
requirements: []
|
192
192
|
rubyforge_project:
|
193
193
|
rubygems_version: 1.8.24
|