setsuzoku 0.10.5 → 0.10.10

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
  SHA256:
3
- metadata.gz: ebb07133f2399524199b1c5a2f1cd500ae8317656ea91539bf99868eaa3a0b4d
4
- data.tar.gz: 56c9a198f24fc19be3f510c062f8e5e6c13d6249c33932c7aba4715edca11c89
3
+ metadata.gz: 224d8d5fd6ed22ff68d738482797161907131f18134517cb7a78ce9f27ba822b
4
+ data.tar.gz: 108a049185faf8f49bbfa75474e84e4281b5294ef0393109aa0d625eee7d5999
5
5
  SHA512:
6
- metadata.gz: c479986f2b169b6b6bfa503e10d6826d463ad08521aeb8bbbe9357840c964e8ca6b61e077876004fa3a7fd96a82fbf2f9fa3cce4dbb3792905ca9c7ee0b0ea6b
7
- data.tar.gz: 2a73541b422fc3e802f293c5e6991b3e6aabc17b709531db19d2f33d0ecef712af530ac2eec33efc1de82ccdd130b24144d5c95eacb7cdfd4de4829cce83ac29
6
+ metadata.gz: 930280914e8cec4d2fb5605e48c4465dcca78b05dd72fbee5599240e2eaf9c8cf7122e46f5515479270c8945e97f9927f7fe4ab78a7e86e7a32bc1c7aa2c6db2
7
+ data.tar.gz: b2864f186ce5b56412149a7fc7bfb25ba4e5dd6b402a6bf5c976bcc4d9627feb5d238dceacbed3a6dab3a4bcb1565452b928c6982301ab08f5758b18098fafbc
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- setsuzoku (0.10.5)
4
+ setsuzoku (0.10.10)
5
5
  activesupport (~> 5.0)
6
6
  faraday (~> 0.11)
7
7
  httparty (~> 0.16.4)
@@ -28,7 +28,7 @@ GEM
28
28
  httparty (0.16.4)
29
29
  mime-types (~> 3.0)
30
30
  multi_xml (>= 0.5.2)
31
- i18n (1.8.3)
31
+ i18n (1.8.5)
32
32
  concurrent-ruby (~> 1.0)
33
33
  mime-types (3.3.1)
34
34
  mime-types-data (~> 3.2015)
@@ -37,7 +37,7 @@ GEM
37
37
  minitest (5.14.1)
38
38
  multi_xml (0.6.0)
39
39
  multipart-post (2.1.1)
40
- nokogiri (1.10.9)
40
+ nokogiri (1.10.10)
41
41
  mini_portile2 (~> 2.4.0)
42
42
  public_suffix (4.0.5)
43
43
  rake (10.5.0)
@@ -57,7 +57,7 @@ GEM
57
57
  safe_yaml (1.0.5)
58
58
  sorbet (0.5.5675)
59
59
  sorbet-static (= 0.5.5675)
60
- sorbet-runtime (0.5.5786)
60
+ sorbet-runtime (0.5.5862)
61
61
  sorbet-static (0.5.5675-universal-darwin-14)
62
62
  thread_safe (0.3.6)
63
63
  tzinfo (1.2.7)
@@ -231,13 +231,9 @@ module Setsuzoku
231
231
  def get_url_and_body(plugin, propz, stub_directory, action_name, url_params = nil)
232
232
  body = nil
233
233
  url = propz[:url]
234
- format = propz[:request_format].to_s.include?('x-www-form') ? :json : propz[:request_format]
234
+ format = propz[:request_format].to_s.include?('x-www-form') || propz[:request_format] == :file ? :json : propz[:request_format]
235
235
  begin
236
- body = if propz[:request_format] == :binary
237
- JSON.parse(ERB.new(File.read("#{Dir.pwd}/spec/support/setsuzoku/#{stub_directory}/#{action_name}_request.json.erb")))
238
- else
239
- File.read("#{Dir.pwd}/spec/support/setsuzoku/#{stub_directory}/#{action_name}_request.#{format}")
240
- end
236
+ body = File.read("#{Dir.pwd}/spec/support/setsuzoku/#{stub_directory}/#{action_name}_request.#{format}")
241
237
  body.squish!
242
238
  case format
243
239
  when :xml
@@ -251,8 +247,6 @@ module Setsuzoku
251
247
  end
252
248
 
253
249
  # We will convert these to url params when making requests. need to replicate that.
254
-
255
-
256
250
  req_params = case format
257
251
  when :json
258
252
  temp_body = JSON.parse(body)
@@ -274,6 +268,7 @@ module Setsuzoku
274
268
  case format
275
269
  when :json
276
270
  #faraday sorts hash keys for some reason
271
+ body = body.to_json if body.is_a?(Hash)
277
272
  body = JSON.parse(body).sort.to_h
278
273
  end
279
274
  [url, body]
@@ -40,7 +40,7 @@ module Setsuzoku
40
40
 
41
41
  full_request = self.formulate_request(request_properties, request_options)
42
42
 
43
- @faraday = Faraday.new(url: request_properties[:formatted_full_url]) do |faraday|
43
+ @faraday = Faraday.new(url: request_properties[:formatted_full_url], request: { params_encoder: Faraday::FlatParamsEncoder }) do |faraday|
44
44
  faraday.request(:multipart) if options[:attachments].present?
45
45
  faraday.request(:url_encoded)
46
46
  # faraday.basic_auth(request_options[:basic_auth][:username], request_options[:basic_auth][:password]) if request_options[:basic_auth]
@@ -105,13 +105,12 @@ module Setsuzoku
105
105
  # @return full_request [Hash/String] returns the request body in the format required
106
106
  def formulate_request(request_properties = {}, request_options = {})
107
107
  request_format = request_properties.dig(:request_format).to_s
108
- content_type = request_options.dig(:headers, :'Content-Type').to_s
109
108
 
110
109
  if request_properties[:request_method] == :get || request_properties[:req_params].empty?
111
110
  request_properties[:req_params]
112
111
  else
113
- # if the header or request format and request format include urlencoded return the body as a hash
114
- if request_format.include?('urlencoded') && content_type.include?('urlencoded')
112
+ # if the header or request format include urlencoded return the body as a hash
113
+ if request_format.include?('urlencoded')
115
114
  request_properties[:req_params]
116
115
  else
117
116
  # return either xml or json
@@ -122,7 +121,7 @@ module Setsuzoku
122
121
  end
123
122
  end
124
123
  end
125
- end
124
+ end
126
125
 
127
126
  def request_options(request_format = nil, action_details = {})
128
127
  request_options = self.auth_strategy.auth_headers.merge(self.plugin.api_headers).merge(action_details[:request_options] || {})
@@ -131,10 +130,12 @@ module Setsuzoku
131
130
  'application/json'
132
131
  when :xml
133
132
  'application/xml'
134
- when :text
133
+ when :text, :file
135
134
  'text/plain'
136
135
  when :pdf
137
136
  'application/pdf'
137
+ when :'x-www-form-urlencoded;charset=UTF-8'
138
+ 'application/x-www-form-urlencoded;charset=UTF-8'
138
139
  else
139
140
  'application/json'
140
141
  end
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Setsuzoku
5
- VERSION = '0.10.5'
5
+ VERSION = '0.10.10'
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.10.5
4
+ version: 0.10.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luke Stadtler
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-27 00:00:00.000000000 Z
11
+ date: 2020-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler