weatherb 0.1.2 → 0.1.3
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/faraday_middleware/raise_error.rb +8 -12
- data/lib/weatherb/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 55222181bf59d05fe21a173d775ccf715b637ee044b78667431a135f67ef05a9
|
|
4
|
+
data.tar.gz: e6183a8c2f95727352befb5cb3fb23242d5a39188238b35c9a7ef9fc4d02b540
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4f330a019cc36d89160b22998bf7a21ff9b73fd409a3edc2262045bc22a36f59bc77c4c84dde283c614c586ec8b6b4c495567c80612c6ff590d706dea8d388fd
|
|
7
|
+
data.tar.gz: 6a30b32650a7af7431a31ea045c9b28824a47a08787202e5c2f502acb1f49342a2921f42dd118293a1111560922674c02eb77571b264d5b4ea306e3b44ce3960
|
data/Gemfile.lock
CHANGED
|
@@ -11,31 +11,27 @@ module FaradayMiddleware
|
|
|
11
11
|
@app.call(env).on_complete do |response|
|
|
12
12
|
case response[:status].to_i
|
|
13
13
|
when 400
|
|
14
|
-
raise Weatherb::BadRequest.new(
|
|
14
|
+
raise Weatherb::BadRequest.new(error_body(response[:body]), 400)
|
|
15
15
|
when 401
|
|
16
|
-
raise Weatherb::Unauthorized.new(
|
|
16
|
+
raise Weatherb::Unauthorized.new(error_body(response[:body]), 401)
|
|
17
17
|
when 403
|
|
18
|
-
raise Weatherb::Forbidden.new(
|
|
18
|
+
raise Weatherb::Forbidden.new(error_body(response[:body]), 403)
|
|
19
19
|
when 429
|
|
20
|
-
raise Weatherb::TooManyRequests.new(
|
|
20
|
+
raise Weatherb::TooManyRequests.new(error_body(response[:body]), 429)
|
|
21
21
|
when 500
|
|
22
|
-
raise Weatherb::InternalServerError.new(
|
|
22
|
+
raise Weatherb::InternalServerError.new(error_body(response[:body]), 500)
|
|
23
23
|
when CLIENT_ERROR_STATUSES
|
|
24
|
-
raise Weatherb::ClientError.new(
|
|
24
|
+
raise Weatherb::ClientError.new(error_body(response[:body]), 400)
|
|
25
25
|
when SERVER_ERROR_STATUSES
|
|
26
|
-
raise Weatherb::ServerError.new(
|
|
26
|
+
raise Weatherb::ServerError.new(error_body(response[:body]), 500)
|
|
27
27
|
when nil
|
|
28
|
-
raise Weatherb::NilStatusError.new(
|
|
28
|
+
raise Weatherb::NilStatusError.new(error_body(response[:body]), 0)
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
private
|
|
34
34
|
|
|
35
|
-
def error_message(response)
|
|
36
|
-
"status: #{response[:status]}, message: #{error_body(response[:body])}"
|
|
37
|
-
end
|
|
38
|
-
|
|
39
35
|
def error_body(body)
|
|
40
36
|
body = ::JSON.parse(body) if !body.nil? && !body.empty? && body.is_a?(String)
|
|
41
37
|
|
data/lib/weatherb/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: weatherb
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Zackky Muhammad
|
|
@@ -44,7 +44,7 @@ licenses:
|
|
|
44
44
|
metadata:
|
|
45
45
|
homepage_uri: https://github.com/zackijack/weatherb
|
|
46
46
|
source_code_uri: https://github.com/zackijack/weatherb
|
|
47
|
-
changelog_uri: https://github.com/zackijack/weatherb/releases/tag/v0.1.
|
|
47
|
+
changelog_uri: https://github.com/zackijack/weatherb/releases/tag/v0.1.3
|
|
48
48
|
post_install_message:
|
|
49
49
|
rdoc_options: []
|
|
50
50
|
require_paths:
|