weatherb 0.1.1 → 0.1.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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/faraday_middleware/raise_error.rb +8 -8
- data/lib/weatherb/error.rb +11 -1
- data/lib/weatherb/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 641a52181945b3e2009d75e78c746de62c5e422e5657bfcc5e7683dfe3dbeab0
|
|
4
|
+
data.tar.gz: 3f21273c979f80c349eaa03a23dfb1c5a4d4bf2dccff13a9062947004effecb7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6c49d71a82d55b963a073fb53ba595b4cc6ad82003694e75a4fa3a7ea2e114be58e4ca8e4ab10affed1a4aa944ba0fdb712c6dc79ffac416ea240212cffe97b6
|
|
7
|
+
data.tar.gz: ceb98966afaba3bb74088baecb28c9f8dda6826dc5444a8396bbca07d198c593df9e2a41a7d24f2e99373031c8874660d726801c9bea344c89da74651a248653
|
data/Gemfile.lock
CHANGED
|
@@ -11,21 +11,21 @@ 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
|
|
14
|
+
raise Weatherb::BadRequest.new(error_message(response), 400)
|
|
15
15
|
when 401
|
|
16
|
-
raise Weatherb::Unauthorized
|
|
16
|
+
raise Weatherb::Unauthorized.new(error_message(response), 401)
|
|
17
17
|
when 403
|
|
18
|
-
raise Weatherb::Forbidden
|
|
18
|
+
raise Weatherb::Forbidden.new(error_message(response), 403)
|
|
19
19
|
when 429
|
|
20
|
-
raise Weatherb::TooManyRequests
|
|
20
|
+
raise Weatherb::TooManyRequests.new(error_message(response), 429)
|
|
21
21
|
when 500
|
|
22
|
-
raise Weatherb::InternalServerError
|
|
22
|
+
raise Weatherb::InternalServerError.new(error_message(response), 500)
|
|
23
23
|
when CLIENT_ERROR_STATUSES
|
|
24
|
-
raise Weatherb::ClientError
|
|
24
|
+
raise Weatherb::ClientError.new(error_message(response), 400)
|
|
25
25
|
when SERVER_ERROR_STATUSES
|
|
26
|
-
raise Weatherb::ServerError
|
|
26
|
+
raise Weatherb::ServerError.new(error_message(response), 500)
|
|
27
27
|
when nil
|
|
28
|
-
raise Weatherb::NilStatusError
|
|
28
|
+
raise Weatherb::NilStatusError.new(error_message(response), 0)
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
31
|
end
|
data/lib/weatherb/error.rb
CHANGED
|
@@ -2,7 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
module Weatherb
|
|
4
4
|
# Custom error class for rescuing from all Weatherb errors
|
|
5
|
-
class Error < StandardError
|
|
5
|
+
class Error < StandardError
|
|
6
|
+
attr_reader :status_code
|
|
7
|
+
|
|
8
|
+
def initialize(message, status_code)
|
|
9
|
+
# Call the parent's constructor to set the message
|
|
10
|
+
super(message)
|
|
11
|
+
|
|
12
|
+
# Store the status_code in an instance variable
|
|
13
|
+
@status_code = status_code
|
|
14
|
+
end
|
|
15
|
+
end
|
|
6
16
|
|
|
7
17
|
# Raised when ClimaCell returns the HTTP status code 400
|
|
8
18
|
class BadRequest < Error; end
|
data/lib/weatherb/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
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.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Zackky Muhammad
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-06-
|
|
11
|
+
date: 2020-06-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Weatherb comes from weather + rb (ruby file extension). It's basically
|
|
14
14
|
a Ruby gem for retrieving data about weather using the ClimaCell API in a simple
|
|
@@ -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.2
|
|
48
48
|
post_install_message:
|
|
49
49
|
rdoc_options: []
|
|
50
50
|
require_paths:
|