ad_leads 0.1.2 → 0.1.3

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: 2ca5e0966af39aecdd5c29834dfcef08da19d37f
4
- data.tar.gz: 0a34abc322f7d6db6220d349e4eca701b766d5f0
3
+ metadata.gz: 9e53759fafe8fe534b5cd7a4a5a84d33cc8f8245
4
+ data.tar.gz: 123123d1d136c73f8498478d42249e589f60b0dc
5
5
  SHA512:
6
- metadata.gz: 826299ae9ad0040440699bc5192880bc2573fa61cc621bcd55949f1c9b2d98ad5d595fe928d7c366ccdffd3d56fe589f9150d87c16f9b0080ffa6f1ae9e1660d
7
- data.tar.gz: 1f59acc22d34c6eb258ee937d5720216f771f6f4772bc17f6f7db19707a4ffebe6b60e31464054649a497727df4ed05631514925e00df800a6c0b9202521e2b8
6
+ metadata.gz: 897589e8bcc66177af0d4044cdcc990f654cc8f75b8bc8a149d6e65cc6ad91e98fa6b81d2794285086571cf567f8a833174432764f61a7130616dc448f10fad2
7
+ data.tar.gz: 696d0731508ac10ad88fa45ba18a3779afcea7d808493911e56d4cc30f602941fdaa4d1253e0413f3ac711c490ee61dec0e8b2907af89cfa3c8c837e31177c65
@@ -58,6 +58,7 @@ module AdLeads
58
58
  faraday.authorization :Bearer, token
59
59
  faraday.adapter :httpclient
60
60
  faraday.request :url_encoded
61
+ # faraday.response :logger
61
62
  end
62
63
  end
63
64
 
@@ -74,33 +75,33 @@ module AdLeads
74
75
  request.body = params if method == :post
75
76
  end
76
77
 
77
- case response.status
78
- when 401
79
- raise AuthError.new(<<-ERROR)
80
- token: #{token},
81
- method: #{method},
82
- endpoint: #{endpoint},
83
- path: #{path}",
84
- body: #{response.body}
85
- ERROR
86
- when 500
87
- raise ApiError.new(<<-ERROR)
88
- endpoint: #{endpoint},
89
- method: #{method},
90
- path: #{path}",
91
- body: #{response.body}
92
- ERROR
78
+ # Logger.new(STDOUT).info [
79
+ # '====================',
80
+ # endpoint: endpoint,
81
+ # method: method,
82
+ # path: path,
83
+ # body: response.body
84
+ # ].join("\n")
93
85
 
86
+ case response.status
87
+ when 400 then raise ArgError.new response.body
88
+ when 401 then raise AuthError.new "token: #{token}" + response.body.to_s
89
+ when 500 then raise ApiError.new response.body
94
90
  else
95
91
  response
96
92
  end
97
-
98
93
  # rescue Faraday::Error::TimeoutError, Timeout::Error => error
99
94
  # rescue Faraday::Error::ClientError, JSON::ParserError => error
100
95
  end
96
+
101
97
  end
102
98
 
103
- class AuthError < StandardError; end
104
- class ApiError < StandardError; end
99
+ class Error < StandardError
100
+ def initialize(message)
101
+ super(message)
102
+ end
103
+ end
104
+ class AuthError < Error; end
105
+ class ApiError < Error; end
106
+ class ArgError < Error; end
105
107
  end
106
- 2
@@ -1,3 +1,3 @@
1
1
  module AdLeads
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ad_leads
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dinshaw
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-05 00:00:00.000000000 Z
11
+ date: 2014-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday