setsuzoku 0.10.3 → 0.10.8

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: be6b4f73f228cd56bcafd263862f5a84c6d7ef27bf37dcbbacb08e9d9924f28a
4
- data.tar.gz: 735fd334007864a9a40647edff5d3441c3baad7b8b637bfde5414a5d1f20adc7
3
+ metadata.gz: 726efb395552a5927e31afa4acd12813f6e7f918dda1e7bfc0228649f6908178
4
+ data.tar.gz: 93984b66449f1cbec2986569660e45e4a1ab3c3287774ff8faf915cfffe4686f
5
5
  SHA512:
6
- metadata.gz: b3bf581fad087d683aa66a7c80d18b31317cae6401953b5f67f6e04e574d1507fafbe3dea6d0a3f8d2fa17ef8852f3a2f35633eb0e68328f87625d6ccfff1c77
7
- data.tar.gz: 31bf1b3ab7eee17f8e00a3ba51471c5340f4ffecad8812e96daaafe7d1181b8365b1d20a5152ef7398758d5b4649af93033e9d2349ea5b8abf14afefc5b38214
6
+ metadata.gz: 8b5e47d6549a27ecb3688ddae78c77ae5284da2398eb2939e0749a936d1491430c8321adf0426bfbfb3f145ebfac2221d388d5be6be8754abb411c005342b672
7
+ data.tar.gz: 3c033c68a032c683014a77387da6643bda95311c1f7e58c2590cfccb3d38b395ee758d6fb171263888c7ed041fc4a2cc25234cbca38605a2d17b6303457336f1
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- setsuzoku (0.10.3)
4
+ setsuzoku (0.10.7)
5
5
  activesupport (~> 5.0)
6
6
  faraday (~> 0.11)
7
7
  httparty (~> 0.16.4)
@@ -21,7 +21,7 @@ GEM
21
21
  concurrent-ruby (1.1.6)
22
22
  crack (0.4.3)
23
23
  safe_yaml (~> 1.0.0)
24
- diff-lcs (1.3)
24
+ diff-lcs (1.4.2)
25
25
  faraday (0.17.3)
26
26
  multipart-post (>= 1.2, < 3)
27
27
  hashdiff (1.0.1)
@@ -41,28 +41,28 @@ GEM
41
41
  mini_portile2 (~> 2.4.0)
42
42
  public_suffix (4.0.5)
43
43
  rake (10.5.0)
44
- rspec (3.9.0)
45
- rspec-core (~> 3.9.0)
46
- rspec-expectations (~> 3.9.0)
47
- rspec-mocks (~> 3.9.0)
48
- rspec-core (3.9.2)
49
- rspec-support (~> 3.9.3)
50
- rspec-expectations (3.9.2)
44
+ rspec (3.8.0)
45
+ rspec-core (~> 3.8.0)
46
+ rspec-expectations (~> 3.8.0)
47
+ rspec-mocks (~> 3.8.0)
48
+ rspec-core (3.8.2)
49
+ rspec-support (~> 3.8.0)
50
+ rspec-expectations (3.8.6)
51
51
  diff-lcs (>= 1.2.0, < 2.0)
52
- rspec-support (~> 3.9.0)
53
- rspec-mocks (3.9.1)
52
+ rspec-support (~> 3.8.0)
53
+ rspec-mocks (3.8.2)
54
54
  diff-lcs (>= 1.2.0, < 2.0)
55
- rspec-support (~> 3.9.0)
56
- rspec-support (3.9.3)
55
+ rspec-support (~> 3.8.0)
56
+ rspec-support (3.8.3)
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.5794)
61
61
  sorbet-static (0.5.5675-universal-darwin-14)
62
62
  thread_safe (0.3.6)
63
63
  tzinfo (1.2.7)
64
64
  thread_safe (~> 0.1)
65
- webmock (3.8.3)
65
+ webmock (3.8.0)
66
66
  addressable (>= 2.3.6)
67
67
  crack (>= 0.3.2)
68
68
  hashdiff (>= 0.4.0, < 2.0.0)
@@ -73,10 +73,10 @@ PLATFORMS
73
73
  DEPENDENCIES
74
74
  bundler (~> 1.17)
75
75
  rake (~> 10.0)
76
- rspec (~> 3.0)
76
+ rspec (= 3.8)
77
77
  setsuzoku!
78
78
  sorbet (~> 0.5)
79
- webmock (~> 3.8)
79
+ webmock (= 3.8)
80
80
 
81
81
  BUNDLED WITH
82
82
  1.17.2
@@ -67,12 +67,12 @@ module Setsuzoku
67
67
  def stub_plugin_methods_for_spec(registering_class = self.described_class)
68
68
  plugin_class = registering_class.plugin_context[:plugin_class]
69
69
  plugin_class.spec_definitions.each do |action_name, spec|
70
- allow_any_instance_of(plugin_class).to receive(action_name).and_return(spec[:stub][:response])
70
+ plugin_class.any_instance.stub(action_name).and_return(spec[:stub][:response])
71
71
  # a plugin spec might have some dynamic data, e.g. certain methods are called with plugin specific args.
72
72
  if spec[:stub][:dynamic_methods]
73
73
  spec[:stub][:dynamic_methods].each do |meth, resp|
74
74
  #how can we ignore the call count instead of just putting a high limit?
75
- allow_any_instance_of(plugin_class).to receive(meth).and_return(resp)
75
+ plugin_class.any_instance.stub(meth).and_return(resp)
76
76
  end
77
77
  end
78
78
  end
@@ -208,12 +208,12 @@ module Setsuzoku
208
208
  define_method stub_plugin_method_name do
209
209
  #TODO: let this use the appropriate rspec instance stub method
210
210
  #TODO: Does it make sense to have the stub with the method? or should it be in a json file we parse?
211
- plugin_class.any_instance.should_receive(action_name).and_return(spec[:stub][:response])
211
+ plugin_class.any_instance.stub(action_name).and_return(spec[:stub][:response])
212
212
  # a plugin spec might have some dynamic data, e.g. certain methods are called with plugin specific args.
213
213
  if spec[:stub][:dynamic_methods]
214
214
  spec[:stub][:dynamic_methods].each do |meth, resp|
215
215
  #how can we ignore the call count instead of just putting a high limit?
216
- plugin_class.any_instance.should_receive(meth).and_return(resp)
216
+ plugin_class.any_instance.stub(meth).and_return(resp)
217
217
  end
218
218
  end
219
219
  end
@@ -231,10 +231,15 @@ 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")))
236
+ body = if propz[:request_format] == :file
237
+ request_with_files = JSON.parse(ERB.new(File.read("#{Dir.pwd}/spec/support/setsuzoku/#{stub_directory}/#{action_name}_request.json.erb")).result)
238
+ request_with_files['files'].each do |k, path|
239
+ request_with_files[k] = File.new(path)
240
+ end
241
+ request_with_files.delete('files')
242
+ request_with_files
238
243
  else
239
244
  File.read("#{Dir.pwd}/spec/support/setsuzoku/#{stub_directory}/#{action_name}_request.#{format}")
240
245
  end
@@ -251,8 +256,6 @@ module Setsuzoku
251
256
  end
252
257
 
253
258
  # We will convert these to url params when making requests. need to replicate that.
254
-
255
-
256
259
  req_params = case format
257
260
  when :json
258
261
  temp_body = JSON.parse(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.3'
5
+ VERSION = '0.10.8'
6
6
  end
@@ -38,8 +38,8 @@ Gem::Specification.new do |spec|
38
38
 
39
39
  spec.add_development_dependency "bundler", "~> 1.17"
40
40
  spec.add_development_dependency "rake", "~> 10.0"
41
- spec.add_development_dependency "rspec", "~> 3.0"
42
- spec.add_development_dependency "webmock", "~> 3.8"
41
+ spec.add_development_dependency "rspec", "3.8"
42
+ spec.add_development_dependency "webmock", "3.8"
43
43
  spec.add_runtime_dependency "activesupport", "~> 5.0"
44
44
  spec.add_development_dependency "sorbet", "~> 0.5"
45
45
  spec.add_runtime_dependency "sorbet-runtime", "~> 0.5"
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.3
4
+ version: 0.10.8
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-26 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
@@ -42,28 +42,28 @@ dependencies:
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: '3.0'
47
+ version: '3.8'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: '3.0'
54
+ version: '3.8'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: webmock
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - '='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '3.8'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - '='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3.8'
69
69
  - !ruby/object:Gem::Dependency