frenchy 0.0.5 → 0.0.6

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: 1bb700958327ccb49035e1f8d2f41f67ba4695fa
4
- data.tar.gz: 8e3c24ef49b796468820eda75a17c16f5f704418
3
+ metadata.gz: f1768f3f28fd292c1de91511b9d09e94a046a1ed
4
+ data.tar.gz: 3d4b3e33415b224e45ed8096d09f110c1fa7c8b2
5
5
  SHA512:
6
- metadata.gz: 37c1cd4486c8dfc647e4e1a0326a0a4864a09ae2605cf9b1bb8f894678edb900b04e9451c12a5ef6ff92f3403adc1749b0fc0f3cde7156b0106917e9cd032047
7
- data.tar.gz: 7f27293f2b2073fe20ceefe12a207b8d182e63c3e2daee00129ad422df60e92bc5a17fa719f9a96d27c49232c459abc1705308b038d900a456fbb3b1b7748333
6
+ metadata.gz: 0b6689a784c9d5c31679be44ffd0a38fc1998c943d83b3f095935340f855300469e0187b16bffba3e614222761dae8d836d2c53fc158653a262daaff813eaa53
7
+ data.tar.gz: b6dd11c48e61bae3ce1ecd9821863f1c56bf15246ea49b9b8bdb6738cfb80b86920ff4fe90228d4e1387e92ad0452032bf1a8070d3501e17b76414cfe5372e9f
@@ -40,23 +40,31 @@ module Frenchy
40
40
  def perform(method, path, params)
41
41
  url = "#{@host}#{path}"
42
42
 
43
+ request = {
44
+ method: method.to_s.upcase,
45
+ url: url,
46
+ params: params
47
+ }
48
+
43
49
  response = begin
44
50
  HTTP.accept(:json).send(method, url, params: params).response
45
- rescue
46
- raise Frenchy::ServerError
51
+ rescue => exception
52
+ raise Frenchy::ServerError, {request: request, error: exception}
47
53
  end
48
54
 
49
55
  case response.code
50
56
  when 200
51
57
  begin
52
58
  JSON.parse(response.body)
53
- rescue
54
- raise Frenchy::InvalidResponse
59
+ rescue => e
60
+ raise Frenchy::InvalidResponse, {request: request, error: exception, status: response.status, body: response.body}
55
61
  end
56
62
  when 404
57
- raise Frenchy::NotFound
63
+ body = JSON.parse(response.body) rescue response.body
64
+ raise Frenchy::NotFound, {request: request, status: response.status, body: body}
58
65
  else
59
- raise Frenchy::ServerError, response.inspect
66
+ body = JSON.parse(response.body) rescue response.body
67
+ raise Frenchy::ServerError, {request: request, status: response.status, body: body}
60
68
  end
61
69
  end
62
70
 
@@ -1,3 +1,3 @@
1
1
  module Frenchy
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: frenchy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Coene
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-24 00:00:00.000000000 Z
11
+ date: 2014-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel