iron_core 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ef4c1ff60a4d5967fd984e4d190d8365cd5fb476
4
- data.tar.gz: 84e1dc9a0bd28ad52344ee10cf001639be6add1e
3
+ metadata.gz: 5013c7153f659b47e120f34b68dc772db996b259
4
+ data.tar.gz: f79577ac76028736ec4ee6ef3f56522d7641a217
5
5
  SHA512:
6
- metadata.gz: b2da4c873889ba23192cd1a3e8fe3c4c3227aa59066107f74d689ee12496901aec00262a9881a20d2bbd3ebbdf81028732d6057fdfb93c976ac225358661d20e
7
- data.tar.gz: 427cdbc565bc0162ccff282458571f290cef9a0edbcef2cb3a2c8561488a89bd3c7fd659f128cf96c8fa8b3f654f5b0cca4be2a0bec13d277d693586867d8686
6
+ metadata.gz: ae92612105c3a54592aba72fb2e75d8bda8f72d1045220d40a38215afb60d2b1e373c2f0f4eeddee748c0e0e939efc9955c5121d0d6ed40737ad403225f8bd2b
7
+ data.tar.gz: 84e1367359268bbb5d1e41a6044110f7d8b49eeca5403d560617283a74f549c7b05926cd1d4e6d242797ac3fb4b775197c9324c9d4e3a14a9a4ca3e643f85120
data/iron_core.gemspec CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |gem|
16
16
 
17
17
  gem.required_rubygems_version = ">= 1.3.6"
18
18
  gem.required_ruby_version = Gem::Requirement.new(">= 1.8")
19
- gem.add_runtime_dependency "rest", ">= 2.2.0"
19
+ gem.add_runtime_dependency "rest", ">= 2.6.4"
20
20
 
21
21
  gem.add_development_dependency "test-unit"
22
22
  gem.add_development_dependency "minitest"
@@ -47,7 +47,7 @@ module IronCore
47
47
  suffixes << "-#{@env}"
48
48
  suffixes << "_#{@env}"
49
49
  end
50
-
50
+
51
51
  suffixes << ''
52
52
 
53
53
  suffixes.each do |suffix|
@@ -179,7 +179,26 @@ module IronCore
179
179
 
180
180
  IronCore::Logger.debug 'IronCore', "GET #{url(method)} with params='#{request_hash.to_s}'"
181
181
 
182
- @rest.get(url(method), request_hash)
182
+ begin
183
+ @rest.get(url(method), request_hash)
184
+ rescue Rest::HttpError => ex
185
+ extract_error_msg(ex)
186
+ end
187
+ end
188
+
189
+ def extract_error_msg(ex)
190
+ if ex.response && ex.response.body
191
+ begin
192
+ bodyparsed = JSON.parse(ex.response.body)
193
+ msg = bodyparsed["msg"]
194
+ if msg
195
+ ex.msg = msg
196
+ end
197
+ rescue => ex
198
+ # ignore
199
+ end
200
+ end
201
+ raise ex
183
202
  end
184
203
 
185
204
  def post(method, params = {})
@@ -189,7 +208,11 @@ module IronCore
189
208
 
190
209
  IronCore::Logger.debug 'IronCore', "POST #{base_url + method} with params='#{request_hash.to_s}'"
191
210
 
211
+ begin
192
212
  @rest.post(base_url + method, request_hash)
213
+ rescue Rest::HttpError => ex
214
+ extract_error_msg(ex)
215
+ end
193
216
  end
194
217
 
195
218
  def put(method, params={})
@@ -199,7 +222,11 @@ module IronCore
199
222
 
200
223
  IronCore::Logger.debug 'IronCore', "PUT #{base_url + method} with params='#{request_hash.to_s}'"
201
224
 
225
+ begin
202
226
  @rest.put(base_url + method, request_hash)
227
+ rescue Rest::HttpError => ex
228
+ extract_error_msg(ex)
229
+ end
203
230
  end
204
231
 
205
232
  def delete(method, params = {}, headers2={})
@@ -212,7 +239,11 @@ module IronCore
212
239
 
213
240
  IronCore::Logger.debug 'IronCore', "DELETE #{base_url + method} with params='#{request_hash.to_s}'"
214
241
 
242
+ begin
215
243
  @rest.delete(base_url + method, request_hash)
244
+ rescue Rest::HttpError => ex
245
+ extract_error_msg(ex)
246
+ end
216
247
  end
217
248
 
218
249
  def post_file(method, file_field, file, params_field, params = {})
@@ -222,7 +253,11 @@ module IronCore
222
253
 
223
254
  IronCore::Logger.debug 'IronCore', "POST #{base_url + method} with params='#{request_hash.to_s}'"
224
255
 
256
+ begin
225
257
  @rest.post_file(base_url + method, request_hash)
258
+ rescue Rest::HttpError => ex
259
+ extract_error_msg(ex)
260
+ end
226
261
  end
227
262
 
228
263
  def stream_get(method, params = {})
@@ -1,4 +1,8 @@
1
1
  module IronCore
2
2
  class Error < StandardError
3
3
  end
4
+
5
+ class HttpError < Rest::HttpError
6
+
7
+ end
4
8
  end
@@ -1,5 +1,5 @@
1
1
  module IronCore
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
 
4
4
  def self.version
5
5
  VERSION
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iron_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kirilenko
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-28 00:00:00.000000000 Z
12
+ date: 2013-12-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - '>='
19
19
  - !ruby/object:Gem::Version
20
- version: 2.2.0
20
+ version: 2.6.4
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - '>='
26
26
  - !ruby/object:Gem::Version
27
- version: 2.2.0
27
+ version: 2.6.4
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: test-unit
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -111,4 +111,3 @@ signing_key:
111
111
  specification_version: 4
112
112
  summary: Core library for Iron products
113
113
  test_files: []
114
- has_rdoc: