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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 641a52181945b3e2009d75e78c746de62c5e422e5657bfcc5e7683dfe3dbeab0
4
- data.tar.gz: 3f21273c979f80c349eaa03a23dfb1c5a4d4bf2dccff13a9062947004effecb7
3
+ metadata.gz: 55222181bf59d05fe21a173d775ccf715b637ee044b78667431a135f67ef05a9
4
+ data.tar.gz: e6183a8c2f95727352befb5cb3fb23242d5a39188238b35c9a7ef9fc4d02b540
5
5
  SHA512:
6
- metadata.gz: 6c49d71a82d55b963a073fb53ba595b4cc6ad82003694e75a4fa3a7ea2e114be58e4ca8e4ab10affed1a4aa944ba0fdb712c6dc79ffac416ea240212cffe97b6
7
- data.tar.gz: ceb98966afaba3bb74088baecb28c9f8dda6826dc5444a8396bbca07d198c593df9e2a41a7d24f2e99373031c8874660d726801c9bea344c89da74651a248653
6
+ metadata.gz: 4f330a019cc36d89160b22998bf7a21ff9b73fd409a3edc2262045bc22a36f59bc77c4c84dde283c614c586ec8b6b4c495567c80612c6ff590d706dea8d388fd
7
+ data.tar.gz: 6a30b32650a7af7431a31ea045c9b28824a47a08787202e5c2f502acb1f49342a2921f42dd118293a1111560922674c02eb77571b264d5b4ea306e3b44ce3960
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- weatherb (0.1.2)
4
+ weatherb (0.1.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -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(error_message(response), 400)
14
+ raise Weatherb::BadRequest.new(error_body(response[:body]), 400)
15
15
  when 401
16
- raise Weatherb::Unauthorized.new(error_message(response), 401)
16
+ raise Weatherb::Unauthorized.new(error_body(response[:body]), 401)
17
17
  when 403
18
- raise Weatherb::Forbidden.new(error_message(response), 403)
18
+ raise Weatherb::Forbidden.new(error_body(response[:body]), 403)
19
19
  when 429
20
- raise Weatherb::TooManyRequests.new(error_message(response), 429)
20
+ raise Weatherb::TooManyRequests.new(error_body(response[:body]), 429)
21
21
  when 500
22
- raise Weatherb::InternalServerError.new(error_message(response), 500)
22
+ raise Weatherb::InternalServerError.new(error_body(response[:body]), 500)
23
23
  when CLIENT_ERROR_STATUSES
24
- raise Weatherb::ClientError.new(error_message(response), 400)
24
+ raise Weatherb::ClientError.new(error_body(response[:body]), 400)
25
25
  when SERVER_ERROR_STATUSES
26
- raise Weatherb::ServerError.new(error_message(response), 500)
26
+ raise Weatherb::ServerError.new(error_body(response[:body]), 500)
27
27
  when nil
28
- raise Weatherb::NilStatusError.new(error_message(response), 0)
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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Weatherb
4
- VERSION = '0.1.2'
4
+ VERSION = '0.1.3'
5
5
  end
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.2
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.2
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: