setsuzoku 0.11.9 → 0.12.54

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.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +5 -13
  3. data/lib/setsuzoku.rb +1 -2
  4. data/lib/setsuzoku/api_strategy.rb +6 -4
  5. data/lib/setsuzoku/auth_strategy.rb +28 -14
  6. data/lib/setsuzoku/credential.rb +10 -0
  7. data/lib/setsuzoku/has_config_context.rb +27 -0
  8. data/lib/setsuzoku/pluggable.rb +6 -4
  9. data/lib/setsuzoku/plugin.rb +1 -1
  10. data/lib/setsuzoku/rspec/dynamic_spec_helper.rb +4 -3
  11. data/lib/setsuzoku/service.rb +1 -1
  12. data/lib/setsuzoku/service/web_service.rb +6 -2
  13. data/lib/setsuzoku/service/web_service/api_strategies/rest_strategy.rb +35 -16
  14. data/lib/setsuzoku/service/web_service/api_strategy.rb +13 -8
  15. data/lib/setsuzoku/service/web_service/auth_strategies/basic_auth_strategy.rb +6 -4
  16. data/lib/setsuzoku/service/web_service/auth_strategies/custom_auth_strategy.rb +66 -0
  17. data/lib/setsuzoku/service/web_service/auth_strategies/o_auth_strategy.rb +25 -88
  18. data/lib/setsuzoku/service/web_service/auth_strategies/strategy_can_use_tokens.rb +175 -0
  19. data/lib/setsuzoku/service/web_service/auth_strategy.rb +1 -14
  20. data/lib/setsuzoku/service/web_service/credentials/basic_auth_credential.rb +3 -3
  21. data/lib/setsuzoku/service/web_service/credentials/custom_auth_credential.rb +46 -0
  22. data/lib/setsuzoku/service/web_service/credentials/o_auth_credential.rb +41 -35
  23. data/lib/setsuzoku/service/web_service/credentials/uses_credential_token.rb +68 -0
  24. data/lib/setsuzoku/service/web_service/service.rb +2 -1
  25. data/lib/setsuzoku/version.rb +1 -1
  26. data/setsuzoku.gemspec +0 -1
  27. data/sorbet/rbi/gems/activesupport.rbi +4 -54
  28. data/sorbet/rbi/gems/i18n.rbi +2 -2
  29. data/sorbet/rbi/gems/rspec-core.rbi +3 -155
  30. data/sorbet/rbi/gems/rspec-expectations.rbi +2 -6
  31. data/sorbet/rbi/gems/rspec-mocks.rbi +1 -5
  32. data/sorbet/rbi/gems/rspec-support.rbi +63 -74
  33. data/sorbet/rbi/gems/rspec.rbi +1 -1
  34. data/sorbet/rbi/gems/webmock.rbi +1 -5
  35. data/sorbet/rbi/hidden-definitions/hidden.rbi +3651 -619
  36. data/sorbet/rbi/sorbet-typed/lib/activesupport/all/activesupport.rbi +17 -17
  37. data/sorbet/rbi/sorbet-typed/lib/faraday/all/faraday.rbi +685 -0
  38. data/sorbet/rbi/todo.rbi +1 -0
  39. metadata +8 -20
  40. data/lib/setsuzoku/utilities.rb +0 -7
  41. data/sorbet/rbi/sorbet-typed/lib/bundler/all/bundler.rbi +0 -8684
  42. data/sorbet/rbi/sorbet-typed/lib/ruby/all/open3.rbi +0 -111
  43. data/sorbet/rbi/sorbet-typed/lib/ruby/all/resolv.rbi +0 -543
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cd0ca4436f63ee80c7411553690acc0600a3556842acda30c580767de4d5fefe
4
- data.tar.gz: 9cdf81df738bc16aef812b6cc5f68cb7e26b5a3a1666dcbf214a79ac16e22f28
3
+ metadata.gz: 857309120b1ecb005579a95179f305d1417d77e182acc418728a64a919ba1f93
4
+ data.tar.gz: b7b1a9fba79dd2f32ac74bf983f162b3bd13bb1be4f9fc0643243b4ac56579d9
5
5
  SHA512:
6
- metadata.gz: 888f8ee20d1bc364d6a0b9ddd54ab2cdeb8c9e54078ea5bc36ef5193fac5d75ee7310492c55493fa4e6dae2975103b31e087ca6f23557bca2d52f22622d5a700
7
- data.tar.gz: a07a89413cae6b20f159eec21cd37f90e73e80d8ee8b1d0522f5186b71aa587483145c29deaff231337a805fb5291ba3c45e17a364cab37e0123890982ffd218
6
+ metadata.gz: 9c521ea84fa6d60a44b86122bdb0e73c877959f7d8bda535cf203225e15b87d38c84d81746b254237d7c808e5edf1deeb82dae1f6b98eca605bcdbf624bb8f75
7
+ data.tar.gz: 9029a6b9ffcbcc339bd9f98f483b22ecec5dfa13475222f59c497155da09d3ee4d78be006993958f0f8853ce7dc9fc704c9822e59d5c8263eaaba8d1ba621810
@@ -1,10 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- setsuzoku (0.11.9)
4
+ setsuzoku (0.12.54)
5
5
  activesupport (~> 5.0)
6
6
  faraday (~> 0.11)
7
- httparty (~> 0.16.4)
8
7
  nokogiri (~> 1.10)
9
8
  sorbet-runtime (~> 0.5)
10
9
 
@@ -18,26 +17,19 @@ GEM
18
17
  tzinfo (~> 1.1)
19
18
  addressable (2.7.0)
20
19
  public_suffix (>= 2.0.2, < 5.0)
21
- concurrent-ruby (1.1.6)
20
+ concurrent-ruby (1.1.7)
22
21
  crack (0.4.3)
23
22
  safe_yaml (~> 1.0.0)
24
23
  diff-lcs (1.4.2)
25
24
  faraday (0.17.3)
26
25
  multipart-post (>= 1.2, < 3)
27
26
  hashdiff (1.0.1)
28
- httparty (0.16.4)
29
- mime-types (~> 3.0)
30
- multi_xml (>= 0.5.2)
31
- i18n (1.8.3)
27
+ i18n (1.8.5)
32
28
  concurrent-ruby (~> 1.0)
33
- mime-types (3.3.1)
34
- mime-types-data (~> 3.2015)
35
- mime-types-data (3.2020.0512)
36
29
  mini_portile2 (2.4.0)
37
30
  minitest (5.14.1)
38
- multi_xml (0.6.0)
39
31
  multipart-post (2.1.1)
40
- nokogiri (1.10.9)
32
+ nokogiri (1.10.10)
41
33
  mini_portile2 (~> 2.4.0)
42
34
  public_suffix (4.0.5)
43
35
  rake (10.5.0)
@@ -57,7 +49,7 @@ GEM
57
49
  safe_yaml (1.0.5)
58
50
  sorbet (0.5.5675)
59
51
  sorbet-static (= 0.5.5675)
60
- sorbet-runtime (0.5.5878)
52
+ sorbet-runtime (0.5.5881)
61
53
  sorbet-static (0.5.5675-universal-darwin-14)
62
54
  thread_safe (0.3.6)
63
55
  tzinfo (1.2.7)
@@ -1,7 +1,6 @@
1
1
  # typed: true
2
2
 
3
3
  require 'faraday'
4
- require 'httparty'
5
4
  require 'nokogiri'
6
5
  require 'sorbet-runtime'
7
6
  require 'active_support'
@@ -10,6 +9,7 @@ require 'active_support'
10
9
  module Setsuzoku
11
10
 
12
11
  autoload :ApiResponse, 'setsuzoku/api_response'
12
+ autoload :HasConfigContext, 'setsuzoku/has_config_context'
13
13
  autoload :ApiStrategy, 'setsuzoku/api_strategy'
14
14
  autoload :AuthStrategy, 'setsuzoku/auth_strategy'
15
15
  autoload :Credential, 'setsuzoku/credential'
@@ -18,7 +18,6 @@ module Setsuzoku
18
18
  autoload :Pluggable, 'setsuzoku/pluggable'
19
19
  autoload :Service, 'setsuzoku/service' #needs to load before plugin
20
20
  autoload :Plugin, 'setsuzoku/plugin'
21
- autoload :Utilities, 'setsuzoku/utilities'
22
21
  autoload :VERSION, 'setsuzoku/version'
23
22
 
24
23
  @@external_api_handler = ExternalApiHandler
@@ -1,4 +1,4 @@
1
- # typed: false
1
+ # typed: ignore
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Setsuzoku
@@ -7,10 +7,12 @@ module Setsuzoku
7
7
  #
8
8
  # Defines all necessary methods for handling interfacing with an external API/Service for any authentication strategy.
9
9
  module ApiStrategy
10
-
11
10
  extend Forwardable
12
11
  extend T::Sig
13
12
  extend T::Helpers
13
+
14
+ include HasConfigContext
15
+
14
16
  abstract!
15
17
 
16
18
  attr_accessor :current_action
@@ -35,8 +37,8 @@ module Setsuzoku
35
37
  ))
36
38
  end
37
39
  def initialize(service:, **args)
38
- #TODO: here we need to assign credentials etc, I think.
39
40
  self.service = service
41
+ self.config_context = args
40
42
  self
41
43
  end
42
44
 
@@ -71,7 +73,7 @@ module Setsuzoku
71
73
  exception = T.let(nil, T.nilable(Setsuzoku::Exception))
72
74
  action_details = case strategy
73
75
  when :auth
74
- { actions: self.plugin.auth_actions, url: self.plugin.auth_base_url }
76
+ { actions: self.auth_strategy.credential.auth_actions, url: self.auth_strategy.credential.auth_base_url }
75
77
  when :webhook
76
78
  { actions: self.plugin.api_actions, url: self.plugin.webhook_base_url }
77
79
  else
@@ -1,4 +1,4 @@
1
- # typed: false
1
+ # typed: ignore
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Setsuzoku
@@ -7,21 +7,20 @@ module Setsuzoku
7
7
  #
8
8
  # Defines all necessary methods for handling authentication for any authentication strategy.
9
9
  module AuthStrategy
10
-
11
10
  extend Forwardable
12
11
  extend T::Sig
13
12
  extend T::Helpers
13
+
14
+ include HasConfigContext
15
+
14
16
  abstract!
15
17
 
16
18
  attr_accessor :service
17
19
  attr_accessor :credential
18
20
  def_delegators :@service, :plugin, :api_strategy, :external_api_handler
19
21
 
20
- # Initialize the auth_strategy and provide reference to service.
21
- #
22
- # @param service [Service] the new instance of service with its correct strategies.
23
22
  #
24
- # @return [AuthStrategy] the new instance of auth_strategy
23
+ # initialize
25
24
  sig(:final) do
26
25
  params(
27
26
  service: T.any(
@@ -31,19 +30,20 @@ module Setsuzoku
31
30
  args: T.untyped
32
31
  ).returns(T.any(
33
32
  Setsuzoku::Service::WebService::AuthStrategies::BasicAuthStrategy,
33
+ Setsuzoku::Service::WebService::AuthStrategies::CustomAuthStrategy,
34
34
  Setsuzoku::Service::WebService::AuthStrategies::OAuthStrategy,
35
35
  T.untyped
36
36
  ))
37
37
  end
38
-
38
+ # Initialize the auth_strategy and provide reference to service.
39
+ #
40
+ # @param service [Service] the new instance of service with its correct strategies.
41
+ #
42
+ # @return [AuthStrategy] the new instance of auth_strategy
39
43
  def initialize(service:, **args)
40
44
  self.service = service
41
- credential = args[:credential]
42
- self.credential = if self.plugin.registered_instance
43
- credential
44
- else
45
- self.class.credential_class.stub_credential
46
- end
45
+ self.set_credential!(self.class.credential_class.stub_credential) unless self.plugin.registered_instance
46
+ self.config_context = args
47
47
  self
48
48
  end
49
49
 
@@ -55,11 +55,25 @@ module Setsuzoku
55
55
  self.plugin.get_registered_instance_val(@credential)
56
56
  end
57
57
 
58
+ #
59
+ # set_credential!
60
+ sig { params(credential: T.untyped).void }
61
+ #
62
+ # Assign the credential to the auth_strategy.
63
+ #
64
+ # @return [void]
65
+ def set_credential!(credential)
66
+ if credential
67
+ self.credential = credential
68
+ credential.auth_strategy = self
69
+ end
70
+ end
71
+
58
72
  # Check if a credential is valid.
59
73
  # Additionally it should revalidate if invalid.
60
74
  #
61
75
  # @return [Boolean] true if the credential is valid.
62
- sig { abstract.returns(T::Boolean) }
76
+ sig { returns(T::Boolean) }
63
77
  def auth_credential_valid?; end
64
78
 
65
79
  # Authorize a credential for a specific auth_strategy.
@@ -6,8 +6,18 @@ module Setsuzoku
6
6
  module Credential
7
7
  extend T::Sig
8
8
  extend T::Helpers
9
+ extend Forwardable
9
10
  interface!
10
11
 
12
+ attr_accessor :auth_strategy
13
+ def_delegators :@auth_strategy, :plugin
14
+
15
+ # All auth actions that are implemented.
16
+ #
17
+ # @return [Hash] all auth endpoint definitions for the API.
18
+ sig { abstract.returns(T::Hash[T.untyped, T.untyped]) }
19
+ def auth_actions; end
20
+
11
21
  # Create a stub implementation of the credential for testing purposes
12
22
  #
13
23
  # @return [Struct] a struct that implements stubbed version of a credential's required methods.
@@ -0,0 +1,27 @@
1
+ # typed: false
2
+ # frozen_string_literal: true
3
+
4
+ module Setsuzoku
5
+ # Set of methods/functionality for managing a classes config_context
6
+ module HasConfigContext
7
+ extend T::Sig
8
+ extend T::Helpers
9
+
10
+ attr_accessor :config_context
11
+
12
+ #
13
+ # get_from_context
14
+ sig { params(method: Symbol).returns(T.untyped) }
15
+ #
16
+ # Retrieve a value from config_context or call the default method implementation for the class.
17
+ #
18
+ # @return [Any] the value of the key in config_context, or return value of the method.
19
+ def get_from_context(method)
20
+ if self.config_context.key?(method)
21
+ self.get_registered_instance_val(method)
22
+ else
23
+ self.send(method) if self.respond_to?(method)
24
+ end
25
+ end
26
+ end
27
+ end
@@ -64,10 +64,12 @@ module Setsuzoku
64
64
  sig(:final) { params(options: T.untyped).void }
65
65
  def register_plugin(**options)
66
66
  options[:plugin_class].config_context[:required_instance_methods].each do |req_method|
67
-
68
- unless options[:required_instance_methods].key?(req_method)
69
- raise Setsuzoku::Exception::UndefinedRequiredMethod.new(registering_instance: self, plugin_class: options[:plugin_class], method_name: req_method)
70
- end
67
+ next if options[:required_instance_methods].key?(req_method)
68
+ raise Setsuzoku::Exception::UndefinedRequiredMethod.new(
69
+ registering_instance: self,
70
+ plugin_class: options[:plugin_class],
71
+ method_name: req_method
72
+ )
71
73
  end
72
74
 
73
75
  self.plugin_context = self.default_options.merge(options)
@@ -18,7 +18,7 @@ module Setsuzoku
18
18
  attr_accessor :registered_instance
19
19
  attr_accessor :service
20
20
  attr_accessor :config_context
21
- def_delegators :@service, :auth_strategy, :api_strategy, :exception_handler, :call_external_api, :request_class, :new_credential!
21
+ def_delegators :@service, :auth_strategy, :api_strategy, :exception_handler, :call_external_api, :request_class, :new_credential!, :set_credential!
22
22
 
23
23
  alias :plugin_service :service
24
24
  alias :plugin_request_class :request_class
@@ -1,4 +1,4 @@
1
- # typed: false
1
+ # typed: ignore
2
2
 
3
3
  require 'active_support/core_ext/class/subclasses'
4
4
  require 'active_support/inflector/methods'
@@ -153,11 +153,12 @@ module Setsuzoku
153
153
  props.each do |propz|
154
154
  plugin.api_strategy.current_action = action_name
155
155
  default_headers = plugin.api_strategy.request_options(propz[:request_format])[:headers] || { 'Content-Type' => "application/#{propz[:request_format]}" }
156
+ auth_headers = plugin.auth_strategy.auth_headers || {}
156
157
  if plugin.auth_strategy.is_a?(Setsuzoku::Service::WebService::AuthStrategies::BasicAuthStrategy)
157
- basic_auth = plugin.api_strategy.request_options(propz[:request_format])[:basic_auth]
158
+ basic_auth = auth_headers[:authorization][:basic_auth]
158
159
  auth_header = { 'Authorization' => "Basic #{Base64.encode64("#{basic_auth[:username]}:#{basic_auth[:password]}").gsub("\n", '')}" }
159
160
  elsif plugin.auth_strategy.is_a?(Setsuzoku::Service::WebService::AuthStrategies::OAuthStrategy)
160
- auth_header = { 'Authorization' => "Bearer #{plugin.api_strategy.request_options(propz[:request_format])[:token]}" }
161
+ auth_header = { 'Authorization' => "Bearer #{auth_headers[:authorization][:token]}" }
161
162
  end
162
163
  default_headers.merge!(auth_header) if auth_header
163
164
  headers = propz[:headers] ? [propz[:headers]] : [default_headers]
@@ -17,7 +17,7 @@ module Setsuzoku
17
17
  attr_accessor :auth_strategy
18
18
  attr_accessor :api_strategy
19
19
  attr_accessor :external_api_handler
20
- def_delegators :@auth_strategy, :new_credential!
20
+ def_delegators :@auth_strategy, :new_credential!, :set_credential!
21
21
  def_delegators :@api_strategy, :call_external_api, :request_class
22
22
 
23
23
  def self.included(klass)
@@ -6,10 +6,14 @@ require 'setsuzoku/service/web_service/auth_strategy'
6
6
  require 'setsuzoku/service/web_service/service'
7
7
  require 'setsuzoku/service/web_service/api_strategies/rest_strategy'
8
8
  require 'setsuzoku/service/web_service/api_strategies/rest_api_request'
9
- require 'setsuzoku/service/web_service/auth_strategies/o_auth_strategy'
9
+ require 'setsuzoku/service/web_service/auth_strategies/strategy_can_use_tokens'
10
10
  require 'setsuzoku/service/web_service/auth_strategies/basic_auth_strategy'
11
- require 'setsuzoku/service/web_service/credentials/o_auth_credential'
11
+ require 'setsuzoku/service/web_service/auth_strategies/custom_auth_strategy'
12
+ require 'setsuzoku/service/web_service/auth_strategies/o_auth_strategy'
13
+ require 'setsuzoku/service/web_service/credentials/uses_credential_token'
12
14
  require 'setsuzoku/service/web_service/credentials/basic_auth_credential'
15
+ require 'setsuzoku/service/web_service/credentials/custom_auth_credential'
16
+ require 'setsuzoku/service/web_service/credentials/o_auth_credential'
13
17
 
14
18
  module Setsuzoku
15
19
  module Service
@@ -1,4 +1,4 @@
1
- # typed: false
1
+ # typed: ignore
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require 'active_support/json'
@@ -31,35 +31,46 @@ module Setsuzoku
31
31
  # @param options [Any] additional options needed to pass to correctly perform the request.
32
32
  # options are:
33
33
  # media_type - 'json'
34
+ # attachment_url_key - 'Symbol' the form field to post the attachment in the form.
35
+ # attachment_urls - 'Array<String>' List of attachment urls to be attached as form files.
34
36
  #
35
37
  # @return [Hash] the parsed response object.
36
38
  sig { override.params(request: RestAPIRequest, action_details: T::Hash[T.untyped, T.untyped], options: T.untyped).returns(Faraday::Response) }
37
39
  def perform_external_call(request:, action_details:, **options)
38
40
  request_properties = self.get_request_properties(action_name: request.action, action_details: action_details, req_params: request.body)
39
41
  request_options = self.request_options(request_properties[:request_format], action_details[:actions][request.action])
40
-
42
+ authorization = request_options.delete(:authorization)
41
43
  full_request = self.formulate_request(request_properties, request_options)
42
44
 
43
45
  @faraday = Faraday.new(url: request_properties[:formatted_full_url], request: { params_encoder: Faraday::FlatParamsEncoder }) do |faraday|
44
- faraday.request(:multipart) if options[:attachments].present?
46
+ faraday.request(:multipart) if options[:attachment_urls].present?
45
47
  faraday.request(:url_encoded)
46
48
  #TODO: change these to faraday = self.auth_strategy.set_authorization!(request: faraday)
47
49
  unless request.without_headers
48
- if request_options[:token]
49
- faraday.authorization(:Bearer, request_options[:token])
50
- elsif request_options[:basic_auth]
51
- faraday.request(:basic_auth, request_options[:basic_auth][:username], request_options[:basic_auth][:password])
50
+ if authorization
51
+ if authorization.key?(:token)
52
+ faraday.authorization(:Bearer, authorization[:token])
53
+ elsif authorization.key?(:basic_auth)
54
+ faraday.request(:basic_auth, authorization[:basic_auth][:username], authorization[:basic_auth][:password])
55
+ end
52
56
  end
53
57
  end
54
58
  faraday.adapter Faraday.default_adapter
55
59
  end
56
60
 
57
- if options[:attachments].present?
61
+ if options[:attachment_urls].present?
58
62
  resp = @faraday.post do |req|
59
- io = StringIO.new(full_request)
60
63
  payload = {}
61
- payload[:json] = Faraday::UploadIO.new(io, 'application/json')
62
- payload[:attachment] = options[:attachments].map{ |file| Faraday::UploadIO.new(file[0], file[1], file[2]) }
64
+ attachments = options[:attachment_urls].map do |url|
65
+ image = open(url, 'rb')
66
+ Faraday::UploadIO.new(image, T.must(image).content_type, File.basename(url))
67
+ end
68
+ payload[options[:attachment_url_key]] = attachments
69
+ if request_properties[:request_format] == :json
70
+ payload[:json] = Faraday::UploadIO.new(StringIO.new(full_request), 'application/json')
71
+ else
72
+ payload.merge!(full_request)
73
+ end
63
74
  req.body = payload
64
75
  end
65
76
  else
@@ -110,26 +121,34 @@ module Setsuzoku
110
121
  # @return full_request [Hash/String] returns the request body in the format required
111
122
  def formulate_request(request_properties = {}, request_options = {})
112
123
  request_format = request_properties.dig(:request_format).to_s
124
+ params = request_properties[:req_params].merge(request_options.except(:headers))
113
125
 
114
126
  if request_properties[:request_method] == :get || request_properties[:req_params].empty?
115
- request_properties[:req_params]
127
+ params
116
128
  else
117
129
  # if the header or request format include urlencoded return the body as a hash
118
130
  if request_format.include?('urlencoded')
119
- request_properties[:req_params]
131
+ params
120
132
  else
121
133
  # return either xml or json
122
134
  if request_properties[:request_format] == :xml
123
- convert_hash_to_xml(request_properties[:req_params])
135
+ convert_hash_to_xml(params)
124
136
  else
125
- request_properties[:req_params].to_json
137
+ params.to_json
126
138
  end
127
139
  end
128
140
  end
129
141
  end
130
142
 
131
143
  def request_options(request_format = nil, action_details = {})
132
- request_options = self.auth_strategy.auth_headers.merge(self.plugin.api_headers).merge(action_details[:request_options] || {})
144
+ request_options = {}
145
+ (request_options = {})[:headers] = {}
146
+ request_options[:headers]
147
+ .merge!(self.auth_strategy.get_from_context(:auth_headers).except(:authorization))
148
+ .merge!(self.get_from_context(:api_headers))
149
+ .merge!(action_details[:request_options] || {})
150
+ request_options[:authorization] = self.auth_strategy.get_from_context(:auth_headers)[:authorization]
151
+
133
152
  content_type = case request_format
134
153
  when :json
135
154
  'application/json'
@@ -1,4 +1,4 @@
1
- # typed: true
1
+ # typed: ignore
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Setsuzoku
@@ -35,12 +35,6 @@ module Setsuzoku
35
35
  sig { abstract.returns(T::Hash[T.untyped, T.untyped]) }
36
36
  def api_actions; end
37
37
 
38
- # Any api request headers that this service needs to set.
39
- #
40
- # @return [Hash]
41
- sig { abstract.returns(T::Hash[Symbol, T.untyped]) }
42
- def api_headers; end
43
-
44
38
  # All dynamic url parameters provided by the plugin.
45
39
  #
46
40
  # @return [Hash(String)] all parameters that need to be replaced dynamically for url requests.
@@ -48,6 +42,17 @@ module Setsuzoku
48
42
  def dynamic_url_params; end
49
43
  end
50
44
 
45
+ #
46
+ # api_headers
47
+ sig { overridable.returns(T::Hash[Symbol, T.untyped]) }
48
+ #
49
+ # Specific API headers an API strategy must have when making requests.
50
+ #
51
+ # @return [Hash] the additional required headers for a request.
52
+ def api_headers
53
+ {}
54
+ end
55
+
51
56
  # Perform the external call for the external API.
52
57
  # Each WebService::ApiStrategy must define how this works.
53
58
  #
@@ -68,7 +73,7 @@ module Setsuzoku
68
73
  # Parse the response from the API for the given request.
69
74
  # This should just convert JSON strings/XML/SQL rows to a formatted response Hash.
70
75
  #
71
- # @param response [HTTParty::Response] the response from the HTTP request.
76
+ # @param response [Faraday::Response] the response from the HTTP request.
72
77
  # @param options [Hash] the parsing options. Generally the response_type. e.g. :xml, :json
73
78
  #
74
79
  # @return [Hash] the parsed hash of the response object.