setsuzoku 0.14.3 → 0.14.7

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: 0c0b8c050fa9e109346e671c24de8e74926cebfeb633287d1ace06887f6f51c4
4
- data.tar.gz: f848f52cfea63adb526db081c46e61988a17766d3965651de20f41eddaf55478
3
+ metadata.gz: 94e8464b496fff97456f77bb72035b9b1f2c1558a6a4c92302c220207ed14021
4
+ data.tar.gz: 4c20493a750c35ea9cbf6acf329fc690ae1e04a0a5a64900ded4901e1ba0bc13
5
5
  SHA512:
6
- metadata.gz: b0ec90c69f2c0b534fc2b9f8c41f8b16307b91c5a6c29dfa04f3f19b491d49ad976ebd1c1bd7d9080705d9840745255aa7311b73f156b174aa51d5121eb5d443
7
- data.tar.gz: c751c9cc1d177c1aeefce1944751e361a01a5a2749c36abbfee713a2aaa564099b03092a38842839f6f5ab790515b9b88f786c123bac2dc1c3fdb4f671139d81
6
+ metadata.gz: 269c26f65fc71ab2e1222e46f9be9f980247036f273e4d8993fc0566298ed9ff38d6b6864f82ab4b6df676450d134857a08f08a7b9dfcb48565a490ed26a1f3d
7
+ data.tar.gz: 5280e3569f586980bfa2eacbfafb8b9ca15c612805279e3a4c8e6591d5f3d8afc2f0b0f5c484aee3ff05906f9d5d74f308c1967a4ec439e4ffb08fcb8c96491c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- setsuzoku (0.14.3)
4
+ setsuzoku (0.14.7)
5
5
  activesupport (>= 5.0, < 7)
6
6
  faraday (~> 0.11)
7
7
  nokogiri (~> 1.10)
@@ -10,7 +10,7 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- activesupport (6.1.4)
13
+ activesupport (6.1.4.1)
14
14
  concurrent-ruby (~> 1.0, >= 1.0.2)
15
15
  i18n (>= 1.6, < 2)
16
16
  minitest (>= 5.1)
@@ -27,11 +27,11 @@ GEM
27
27
  hashdiff (1.0.1)
28
28
  i18n (1.8.10)
29
29
  concurrent-ruby (~> 1.0)
30
- mini_portile2 (2.5.3)
30
+ mini_portile2 (2.6.1)
31
31
  minitest (5.14.4)
32
32
  multipart-post (2.1.1)
33
- nokogiri (1.11.7)
34
- mini_portile2 (~> 2.5.0)
33
+ nokogiri (1.12.5)
34
+ mini_portile2 (~> 2.6.1)
35
35
  racc (~> 1.4)
36
36
  public_suffix (4.0.5)
37
37
  racc (1.5.2)
@@ -52,7 +52,7 @@ GEM
52
52
  safe_yaml (1.0.5)
53
53
  sorbet (0.5.5675)
54
54
  sorbet-static (= 0.5.5675)
55
- sorbet-runtime (0.5.6480)
55
+ sorbet-runtime (0.5.9189)
56
56
  sorbet-static (0.5.5675-universal-darwin-14)
57
57
  tzinfo (2.0.4)
58
58
  concurrent-ruby (~> 1.0)
@@ -122,9 +122,15 @@ module Setsuzoku
122
122
  def formulate_request(request_properties = {}, request_options = {})
123
123
  request_format = request_properties.dig(:request_format).to_s
124
124
  params = request_properties[:req_params].merge(request_options.except(:headers))
125
-
126
- if request_properties[:request_method] == :get || request_properties[:req_params].empty?
125
+ if request_properties[:request_method] == :get
126
+ # Faraday expects get requests params to be a hash
127
127
  params
128
+ elsif request_properties[:req_params].empty?
129
+ if %i[put patch post].include?(request_properties[:request_method])
130
+ params.to_json # Faraday doesn't support an empty hash for PUT/PATCH/POST requests
131
+ else
132
+ params # Faraday supports empty hashes for other request types...
133
+ end
128
134
  else
129
135
  # if the header or request format include urlencoded return the body as a hash
130
136
  if request_format.include?('urlencoded')
@@ -81,7 +81,8 @@ module Setsuzoku
81
81
  def parse_response(response:, **options)
82
82
  case options[:response_type]
83
83
  when :json
84
- JSON.parse(response.body).deep_symbolize_keys
84
+ resp = JSON.parse(response.body)
85
+ resp.is_a?(Hash) ? resp.deep_symbolize_keys : resp
85
86
  when :xml
86
87
  convert_xml_to_hash(response.body)
87
88
  when :html
@@ -97,7 +98,8 @@ module Setsuzoku
97
98
  # t.rewind
98
99
  # t
99
100
  else
100
- JSON.parse(response.body).deep_symbolize_keys
101
+ resp = JSON.parse(response.body)
102
+ resp.is_a?(Hash) ? resp.deep_symbolize_keys : resp
101
103
  end
102
104
  end
103
105
 
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Setsuzoku
5
- VERSION = '0.14.3'
5
+ VERSION = '0.14.7'
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: setsuzoku
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.3
4
+ version: 0.14.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luke Stadtler
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-30 00:00:00.000000000 Z
11
+ date: 2021-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler