setsuzoku 0.10.1 → 0.10.3

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: aef3c39e156bb15569d8bf6de134794150fa92d13d09c90ebd2353db146abe5a
4
- data.tar.gz: 0e583bdf0d58ef9e51ff614ccb604a8ac936c0e57f6c1d310bba7ec856539ffa
3
+ metadata.gz: be6b4f73f228cd56bcafd263862f5a84c6d7ef27bf37dcbbacb08e9d9924f28a
4
+ data.tar.gz: 735fd334007864a9a40647edff5d3441c3baad7b8b637bfde5414a5d1f20adc7
5
5
  SHA512:
6
- metadata.gz: 8f4a10541b26ac6e634aa9f615d636961016667c85a80d371f67df0391c8267ef7c0123bd9e2bdbd9894b0e1d0a1bfdc8573f0d7df5afa53c5e269007e7ce8df
7
- data.tar.gz: 21fe9ec50e376486befa73d5228a953e772db4f02372bd17da83984ecad29448679fbc9cc73c02c141afbf727c4fef6a34d55827a233a75be97e84a16168effc
6
+ metadata.gz: b3bf581fad087d683aa66a7c80d18b31317cae6401953b5f67f6e04e574d1507fafbe3dea6d0a3f8d2fa17ef8852f3a2f35633eb0e68328f87625d6ccfff1c77
7
+ data.tar.gz: 31bf1b3ab7eee17f8e00a3ba51471c5340f4ffecad8812e96daaafe7d1181b8365b1d20a5152ef7398758d5b4649af93033e9d2349ea5b8abf14afefc5b38214
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- setsuzoku (0.10.1)
4
+ setsuzoku (0.10.3)
5
5
  activesupport (~> 5.0)
6
6
  faraday (~> 0.11)
7
7
  httparty (~> 0.16.4)
@@ -233,7 +233,11 @@ module Setsuzoku
233
233
  url = propz[:url]
234
234
  format = propz[:request_format].to_s.include?('x-www-form') ? :json : propz[:request_format]
235
235
  begin
236
- body = File.read("#{Dir.pwd}/spec/support/setsuzoku/#{stub_directory}/#{action_name}_request.#{format}")
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
237
241
  body.squish!
238
242
  case format
239
243
  when :xml
@@ -74,16 +74,16 @@ module Setsuzoku
74
74
  action_details: T::Hash[Symbol, T.untyped]
75
75
  ).returns(T::Hash[Symbol, T.untyped])
76
76
  end
77
-
78
77
  def get_request_properties(action_name:, for_stub: false, req_params: {}, action_details: { actions: self.plugin.api_actions, url: self.plugin.api_base_url })
79
78
  action = action_details[:actions][action_name]
79
+ url = action.has_key?(:request_url) ? action[:request_url] : action_details[:url]
80
80
  request_method, endpoint = action.first
81
81
  request_method = request_method.downcase.to_sym
82
82
  request_format = action[:request_type]
83
83
  response_format = action[:response_type]
84
84
  token = action[:token]
85
85
  stub_data = action[:stub_data] if for_stub
86
- full_url = action_details[:url] + endpoint
86
+ full_url = url + endpoint
87
87
  formatted_full_url, req_params = self.replace_dynamic_vars(full_url: full_url, req_params: req_params)
88
88
  {
89
89
  request_method: request_method,
@@ -126,7 +126,19 @@ module Setsuzoku
126
126
 
127
127
  def request_options(request_format = nil, action_details = {})
128
128
  request_options = self.auth_strategy.auth_headers.merge(self.plugin.api_headers).merge(action_details[:request_options] || {})
129
- (request_options[:headers] ||= {})[:'Content-Type'] = "application/#{request_format || :json}"
129
+ content_type = case request_format
130
+ when :json
131
+ 'application/json'
132
+ when :xml
133
+ 'application/xml'
134
+ when :text
135
+ 'text/plain'
136
+ when :pdf
137
+ 'application/pdf'
138
+ else
139
+ 'application/json'
140
+ end
141
+ (request_options[:headers] ||= {})[:'Content-Type'] = content_type
130
142
  request_options
131
143
  end
132
144
 
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Setsuzoku
5
- VERSION = '0.10.1'
5
+ VERSION = '0.10.3'
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: setsuzoku
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: 0.10.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luke Stadtler
@@ -248,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
248
248
  - !ruby/object:Gem::Version
249
249
  version: '0'
250
250
  requirements: []
251
- rubygems_version: 3.0.3
251
+ rubygems_version: 3.0.1
252
252
  signing_key:
253
253
  specification_version: 4
254
254
  summary: Extensible 3rd-party interface and functionality plugins