lib/setsuzoku/service/web_service/api_strategy.rb in setsuzoku-0.11.9 vs lib/setsuzoku/service/web_service/api_strategy.rb in setsuzoku-0.12.54

- old
+ new

@@ -1,6 +1,6 @@ -# typed: true +# typed: ignore # frozen_string_literal: true module Setsuzoku module Service # Defines all common methods for handling interfacing with a Web Service API. @@ -33,23 +33,28 @@ # # @return [Hash] all endpoint definitions for the API. sig { abstract.returns(T::Hash[T.untyped, T.untyped]) } def api_actions; end - # Any api request headers that this service needs to set. - # - # @return [Hash] - sig { abstract.returns(T::Hash[Symbol, T.untyped]) } - def api_headers; end - # All dynamic url parameters provided by the plugin. # # @return [Hash(String)] all parameters that need to be replaced dynamically for url requests. sig { abstract.returns(T::Hash[Symbol, T.nilable(String)]) } def dynamic_url_params; end end + # + # api_headers + sig { overridable.returns(T::Hash[Symbol, T.untyped]) } + # + # Specific API headers an API strategy must have when making requests. + # + # @return [Hash] the additional required headers for a request. + def api_headers + {} + end + # Perform the external call for the external API. # Each WebService::ApiStrategy must define how this works. # # It should: # 1. Make the external request @@ -66,10 +71,10 @@ def perform_external_call(request:, action_details:, **options); end # Parse the response from the API for the given request. # This should just convert JSON strings/XML/SQL rows to a formatted response Hash. # - # @param response [HTTParty::Response] the response from the HTTP request. + # @param response [Faraday::Response] the response from the HTTP request. # @param options [Hash] the parsing options. Generally the response_type. e.g. :xml, :json # # @return [Hash] the parsed hash of the response object. sig { override.params(response: Faraday::Response, options: T.untyped).returns(T.untyped) } def parse_response(response:, **options) \ No newline at end of file