scorpio 0.6.0 → 0.6.2
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 +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +1 -1
- data/lib/scorpio/google_api_document.rb +4 -4
- data/lib/scorpio/openapi/operation.rb +6 -5
- data/lib/scorpio/openapi.rb +30 -23
- data/lib/scorpio/request.rb +34 -9
- data/lib/scorpio/resource_base.rb +7 -11
- data/lib/scorpio/version.rb +1 -1
- data/scorpio.gemspec +2 -2
- metadata +7 -7
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: c63ccc2d793787385be12175b68b1aca1b68372ee72bae4cb78e434d931aa941
         | 
| 4 | 
            +
              data.tar.gz: 3e9bec23f6ca7ad6905ca1fcd33ce185f1dd5741ad3a1097d0cbc82fea09fef1
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: c7f265f3e6f68c340a2720a1f09238cd0f95d4a1dcfa8fb225ad4afa6e211fbe715c337d37faf7d8037ab0267b142af523182cf1d7eecca4e4cd80af16956a54
         | 
| 7 | 
            +
              data.tar.gz: 0a3601a2380269a73fde895e1a2d9c80617a2643ead58420866baa04f5d4a2bad5ce06c54b43f155283f53286b2c1bca09b527b2f7d494d9b766e9a188ae31b6
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,3 +1,13 @@ | |
| 1 | 
            +
            # v0.6.2
         | 
| 2 | 
            +
            - replace deprecated calls to JSI
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            # v0.6.1
         | 
| 5 | 
            +
            - compatibility
         | 
| 6 | 
            +
              - JSI 0.7
         | 
| 7 | 
            +
              - Faraday 2
         | 
| 8 | 
            +
              - Ruby 3
         | 
| 9 | 
            +
              - JRuby
         | 
| 10 | 
            +
             | 
| 1 11 | 
             
            # v0.6.0
         | 
| 2 12 | 
             
            - ResourceBase resources in responses may be contained anywhere in the response object contained in ResourceBase::Container
         | 
| 3 13 | 
             
            - ResourceBase defines class methods for operations whose request or response schemas are represented by the resource
         | 
    
        data/README.md
    CHANGED
    
    | @@ -269,7 +269,7 @@ The detailed, machine-interpretable description of an API provided by a properly | |
| 269 269 |  | 
| 270 270 | 
             
            ## License
         | 
| 271 271 |  | 
| 272 | 
            -
            [<img align="right" src="https:// | 
| 272 | 
            +
            [<img align="right" src="https://www.gnu.org/graphics/agplv3-155x51.png">](https://www.gnu.org/licenses/agpl-3.0.html)
         | 
| 273 273 |  | 
| 274 274 | 
             
            Scorpio is licensed under the terms of the [GNU Affero General Public License version 3](https://www.gnu.org/licenses/agpl-3.0.html).
         | 
| 275 275 |  | 
| @@ -7,7 +7,7 @@ module Scorpio | |
| 7 7 | 
             
                  discovery_rest_description_doc,
         | 
| 8 8 | 
             
                  metaschema_root_ptr: JSI::Ptr['schemas']['JsonSchema'],
         | 
| 9 9 | 
             
                  root_schema_ptr: JSI::Ptr['schemas']['RestDescription'],
         | 
| 10 | 
            -
                   | 
| 10 | 
            +
                  schema_implementation_modules: [JSI::Schema::Draft04],
         | 
| 11 11 | 
             
                )
         | 
| 12 12 |  | 
| 13 13 | 
             
                # naming these is not strictly necessary, but is nice to have.
         | 
| @@ -29,7 +29,7 @@ module Scorpio | |
| 29 29 | 
             
                # google does a weird thing where it defines a schema with a $ref property where a json-schema is to be used in the document (method request and response fields), instead of just setting the schema to be the json-schema schema. we'll share a module across those schema classes that really represent schemas. is this confusingly meta enough?
         | 
| 30 30 | 
             
                module SchemaLike
         | 
| 31 31 | 
             
                  def to_openapi
         | 
| 32 | 
            -
                    dup_doc = JSI:: | 
| 32 | 
            +
                    dup_doc = JSI::Util.as_json(self)
         | 
| 33 33 | 
             
                    # openapi does not want an id field on schemas
         | 
| 34 34 | 
             
                    dup_doc.delete('id')
         | 
| 35 35 | 
             
                    if dup_doc['properties'].is_a?(Hash)
         | 
| @@ -56,7 +56,7 @@ module Scorpio | |
| 56 56 |  | 
| 57 57 | 
             
                  def to_openapi_hash(options = {})
         | 
| 58 58 | 
             
                    # we will be modifying the api document (RestDescription). clone self and modify that one.
         | 
| 59 | 
            -
                    ad = self.class.new(JSI:: | 
| 59 | 
            +
                    ad = self.class.new(JSI::Util.as_json(self))
         | 
| 60 60 | 
             
                    ad_methods = []
         | 
| 61 61 | 
             
                    if ad['methods']
         | 
| 62 62 | 
             
                      ad_methods += ad['methods'].map do |mn, m|
         | 
| @@ -212,7 +212,7 @@ module Scorpio | |
| 212 212 | 
             
                        end.call(openapi)
         | 
| 213 213 | 
             
                      end
         | 
| 214 214 | 
             
                    end
         | 
| 215 | 
            -
                    JSI:: | 
| 215 | 
            +
                    JSI::Util.as_json(openapi)
         | 
| 216 216 | 
             
                  end
         | 
| 217 217 | 
             
                end
         | 
| 218 218 | 
             
              end
         | 
| @@ -224,11 +224,12 @@ module Scorpio | |
| 224 224 | 
             
                    # @return [JSI::Schema]
         | 
| 225 225 | 
             
                    def request_schema(media_type: self.request_media_type)
         | 
| 226 226 | 
             
                      # TODO typechecking on requestBody & children
         | 
| 227 | 
            -
                       | 
| 228 | 
            -
             | 
| 229 | 
            -
             | 
| 230 | 
            -
             | 
| 231 | 
            -
                       | 
| 227 | 
            +
                      request_content = requestBody && requestBody['content']
         | 
| 228 | 
            +
                      return nil unless request_content
         | 
| 229 | 
            +
                      raise(ArgumentError, "please specify media_type for request_schema") unless media_type
         | 
| 230 | 
            +
                      schema = request_content[media_type] && request_content[media_type]['schema']
         | 
| 231 | 
            +
                      return nil unless schema
         | 
| 232 | 
            +
                      JSI::Schema.ensure_schema(schema)
         | 
| 232 233 | 
             
                    end
         | 
| 233 234 |  | 
| 234 235 | 
             
                    # @return [JSI::SchemaSet]
         | 
    
        data/lib/scorpio/openapi.rb
    CHANGED
    
    | @@ -25,8 +25,8 @@ module Scorpio | |
| 25 25 | 
             
                    'documents/github.com/OAI/OpenAPI-Specification/blob/oas3-schema/schemas/v3.0/schema.yaml'
         | 
| 26 26 | 
             
                  )))
         | 
| 27 27 |  | 
| 28 | 
            -
                  # the schema represented by Scorpio::OpenAPI::V3::Schema will describe schemas itself | 
| 29 | 
            -
                  #  | 
| 28 | 
            +
                  # the schema represented by Scorpio::OpenAPI::V3::Schema will describe schemas itself.
         | 
| 29 | 
            +
                  # JSI::Schema#describes_schema! enables this to implement the functionality of schemas.
         | 
| 30 30 | 
             
                  describe_schema = [
         | 
| 31 31 | 
             
                    openapi_document_schema.definitions['Schema'],
         | 
| 32 32 | 
             
                    openapi_document_schema.definitions['SchemaReference'],
         | 
| @@ -40,12 +40,12 @@ module Scorpio | |
| 40 40 | 
             
                    # a problem, and this way also applies when none of the anyOf match due to schema errors.)
         | 
| 41 41 | 
             
                    openapi_document_schema.definitions['Schema'].properties['additionalProperties'],
         | 
| 42 42 | 
             
                  ]
         | 
| 43 | 
            -
                  describe_schema.each { |s| s. | 
| 43 | 
            +
                  describe_schema.each { |s| s.describes_schema!([JSI::Schema::Draft04]) }
         | 
| 44 44 |  | 
| 45 45 | 
             
                  Document = openapi_document_schema.jsi_schema_module
         | 
| 46 46 |  | 
| 47 47 | 
             
                  # naming these is not strictly necessary, but is nice to have.
         | 
| 48 | 
            -
                  # generated: `puts Scorpio::OpenAPI::V3::Document.schema.definitions. | 
| 48 | 
            +
                  # generated: `puts Scorpio::OpenAPI::V3::Document.schema.definitions.keys.map { |k| "#{k[0].upcase}#{k[1..-1]} = Document.definitions['#{k}']" }`
         | 
| 49 49 |  | 
| 50 50 |  | 
| 51 51 | 
             
                  Reference      = Document.definitions['Reference']
         | 
| @@ -118,19 +118,19 @@ module Scorpio | |
| 118 118 | 
             
                    'documents/swagger.io/v2/schema.json'
         | 
| 119 119 | 
             
                  ).read))
         | 
| 120 120 |  | 
| 121 | 
            -
                  # the schema represented by Scorpio::OpenAPI::V2::Schema will describe schemas itself | 
| 122 | 
            -
                  #  | 
| 121 | 
            +
                  # the schema represented by Scorpio::OpenAPI::V2::Schema will describe schemas itself.
         | 
| 122 | 
            +
                  # JSI::Schema#describes_schema! enables this to implement the functionality of schemas.
         | 
| 123 123 | 
             
                  describe_schema = [
         | 
| 124 124 | 
             
                    openapi_document_schema.definitions['schema'],
         | 
| 125 125 | 
             
                    # comments above on v3's definitions['Schema'].properties['additionalProperties'] apply here too
         | 
| 126 126 | 
             
                    openapi_document_schema.definitions['schema'].properties['additionalProperties'],
         | 
| 127 127 | 
             
                  ]
         | 
| 128 | 
            -
                  describe_schema.each { |s| s. | 
| 128 | 
            +
                  describe_schema.each { |s| s.describes_schema!([JSI::Schema::Draft04]) }
         | 
| 129 129 |  | 
| 130 130 | 
             
                  Document = openapi_document_schema.jsi_schema_module
         | 
| 131 131 |  | 
| 132 132 | 
             
                  # naming these is not strictly necessary, but is nice to have.
         | 
| 133 | 
            -
                  # generated: `puts Scorpio::OpenAPI::V2::Document.schema.definitions. | 
| 133 | 
            +
                  # generated: `puts Scorpio::OpenAPI::V2::Document.schema.definitions.keys.map { |k| "#{k[0].upcase}#{k[1..-1]} = Document.definitions['#{k}']" }`
         | 
| 134 134 |  | 
| 135 135 |  | 
| 136 136 | 
             
                  Info            = Document.definitions['info']
         | 
| @@ -142,7 +142,8 @@ module Scorpio | |
| 142 142 | 
             
                  ResponseDefinitions = Document.definitions['responseDefinitions']
         | 
| 143 143 | 
             
                  ExternalDocs       = Document.definitions['externalDocs']
         | 
| 144 144 | 
             
                  Examples          = Document.definitions['examples']
         | 
| 145 | 
            -
                   | 
| 145 | 
            +
                  MimeType         = Document.definitions['mimeType']
         | 
| 146 | 
            +
                  Operation       = Document.definitions['operation']
         | 
| 146 147 | 
             
                  PathItem         = Document.definitions['pathItem']
         | 
| 147 148 | 
             
                  Responses         = Document.definitions['responses']
         | 
| 148 149 | 
             
                  ResponseValue      = Document.definitions['responseValue']
         | 
| @@ -159,7 +160,8 @@ module Scorpio | |
| 159 160 | 
             
                  Parameter               = Document.definitions['parameter']
         | 
| 160 161 | 
             
                  Schema                 = Document.definitions['schema']
         | 
| 161 162 | 
             
                  FileSchema            = Document.definitions['fileSchema']
         | 
| 162 | 
            -
                  PrimitivesItems | 
| 163 | 
            +
                  PrimitivesItems       = Document.definitions['primitivesItems']
         | 
| 164 | 
            +
                  Security               = Document.definitions['security']
         | 
| 163 165 | 
             
                  SecurityRequirement     = Document.definitions['securityRequirement']
         | 
| 164 166 | 
             
                  Xml                      = Document.definitions['xml']
         | 
| 165 167 | 
             
                  Tag                       = Document.definitions['tag']
         | 
| @@ -171,19 +173,24 @@ module Scorpio | |
| 171 173 | 
             
                  Oauth2ApplicationSecurity = Document.definitions['oauth2ApplicationSecurity']
         | 
| 172 174 | 
             
                  Oauth2AccessCodeSecurity = Document.definitions['oauth2AccessCodeSecurity']
         | 
| 173 175 | 
             
                  Oauth2Scopes            = Document.definitions['oauth2Scopes']
         | 
| 174 | 
            -
                   | 
| 175 | 
            -
                   | 
| 176 | 
            -
                   | 
| 177 | 
            -
                   | 
| 178 | 
            -
                   | 
| 179 | 
            -
                   | 
| 180 | 
            -
                   | 
| 181 | 
            -
                   | 
| 182 | 
            -
                   | 
| 183 | 
            -
                   | 
| 184 | 
            -
                   | 
| 185 | 
            -
                   | 
| 186 | 
            -
                   | 
| 176 | 
            +
                  MediaTypeList          = Document.definitions['mediaTypeList']
         | 
| 177 | 
            +
                  ParametersList         = Document.definitions['parametersList']
         | 
| 178 | 
            +
                  SchemesList             = Document.definitions['schemesList']
         | 
| 179 | 
            +
                  CollectionFormat         = Document.definitions['collectionFormat']
         | 
| 180 | 
            +
                  CollectionFormatWithMulti = Document.definitions['collectionFormatWithMulti']
         | 
| 181 | 
            +
                  Title                    = Document.definitions['title']
         | 
| 182 | 
            +
                  Description             = Document.definitions['description']
         | 
| 183 | 
            +
                  Default                = Document.definitions['default']
         | 
| 184 | 
            +
                  MultipleOf            = Document.definitions['multipleOf']
         | 
| 185 | 
            +
                  Maximum              = Document.definitions['maximum']
         | 
| 186 | 
            +
                  ExclusiveMaximum    = Document.definitions['exclusiveMaximum']
         | 
| 187 | 
            +
                  Minimum            = Document.definitions['minimum']
         | 
| 188 | 
            +
                  ExclusiveMinimum  = Document.definitions['exclusiveMinimum']
         | 
| 189 | 
            +
                  MaxLength        = Document.definitions['maxLength']
         | 
| 190 | 
            +
                  MinLength       = Document.definitions['minLength']
         | 
| 191 | 
            +
                  Pattern        = Document.definitions['pattern']
         | 
| 192 | 
            +
                  MaxItems      = Document.definitions['maxItems']
         | 
| 193 | 
            +
                  MinItems     = Document.definitions['minItems']
         | 
| 187 194 | 
             
                  UniqueItems = Document.definitions['uniqueItems']
         | 
| 188 195 | 
             
                  Enum         = Document.definitions['enum']
         | 
| 189 196 | 
             
                  JsonReference = Document.definitions['jsonReference']
         | 
    
        data/lib/scorpio/request.rb
    CHANGED
    
    | @@ -2,9 +2,18 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            module Scorpio
         | 
| 4 4 | 
             
              class Request
         | 
| 5 | 
            -
                 | 
| 5 | 
            +
                # media types for which Scorpio has implemented generating / parsing between body
         | 
| 6 | 
            +
                # and body_object (see {Request#body} and {Response#body_object})
         | 
| 7 | 
            +
                SUPPORTED_REQUEST_MEDIA_TYPES = %w(
         | 
| 8 | 
            +
                  application/json
         | 
| 9 | 
            +
                  application/x-www-form-urlencoded
         | 
| 10 | 
            +
                ).map(&:freeze).freeze
         | 
| 11 | 
            +
             | 
| 6 12 | 
             
                FALLBACK_CONTENT_TYPE = 'application/x-www-form-urlencoded'.freeze
         | 
| 7 13 |  | 
| 14 | 
            +
                # see also Faraday::Env::MethodsWithBodies
         | 
| 15 | 
            +
                METHODS_WITH_BODIES = %w(post put patch options).map(&:freeze).freeze
         | 
| 16 | 
            +
             | 
| 8 17 | 
             
                def self.best_media_type(media_types)
         | 
| 9 18 | 
             
                  if media_types.size == 1
         | 
| 10 19 | 
             
                    media_types.first
         | 
| @@ -13,6 +22,13 @@ module Scorpio | |
| 13 22 | 
             
                  end
         | 
| 14 23 | 
             
                end
         | 
| 15 24 |  | 
| 25 | 
            +
                # @param http_method [String]
         | 
| 26 | 
            +
                # @return [Boolean]
         | 
| 27 | 
            +
                def self.method_with_body?(http_method)
         | 
| 28 | 
            +
                  raise(ArgumentError) unless http_method.is_a?(String)
         | 
| 29 | 
            +
                  METHODS_WITH_BODIES.include?(http_method.downcase)
         | 
| 30 | 
            +
                end
         | 
| 31 | 
            +
             | 
| 16 32 | 
             
                module Configurables
         | 
| 17 33 | 
             
                  attr_writer :path_params
         | 
| 18 34 | 
             
                  def path_params
         | 
| @@ -55,7 +71,7 @@ module Scorpio | |
| 55 71 | 
             
                    return @body if instance_variable_defined?(:@body)
         | 
| 56 72 | 
             
                    if instance_variable_defined?(:@body_object)
         | 
| 57 73 | 
             
                      if content_type && content_type.json?
         | 
| 58 | 
            -
                        JSON.pretty_generate(JSI:: | 
| 74 | 
            +
                        JSON.pretty_generate(JSI::Util.as_json(body_object))
         | 
| 59 75 | 
             
                      elsif content_type && content_type.form_urlencoded?
         | 
| 60 76 | 
             
                        URI.encode_www_form(body_object)
         | 
| 61 77 |  | 
| @@ -310,7 +326,7 @@ module Scorpio | |
| 310 326 | 
             
                #   the named value
         | 
| 311 327 | 
             
                # @param name [String, Symbol] the parameter name
         | 
| 312 328 | 
             
                # @return [Object]
         | 
| 313 | 
            -
                # @raise [ | 
| 329 | 
            +
                # @raise [OpenAPI::SemanticError] invalid `param_in` parameter
         | 
| 314 330 | 
             
                # @raise [NotImplementedError] cookies aren't implemented
         | 
| 315 331 | 
             
                def get_param_from(param_in, name)
         | 
| 316 332 | 
             
                  if param_in == 'path'
         | 
| @@ -323,7 +339,7 @@ module Scorpio | |
| 323 339 | 
             
                  elsif param_in == 'cookie'
         | 
| 324 340 | 
             
                    raise(NotImplementedError, "cookies not implemented: #{name.inspect}")
         | 
| 325 341 | 
             
                  else
         | 
| 326 | 
            -
                    raise( | 
| 342 | 
            +
                    raise(OpenAPI::SemanticError, "cannot get param from param_in = #{param_in.inspect} (name: #{name.pretty_inspect.chomp})")
         | 
| 327 343 | 
             
                  end
         | 
| 328 344 | 
             
                end
         | 
| 329 345 |  | 
| @@ -341,14 +357,17 @@ module Scorpio | |
| 341 357 | 
             
                    else
         | 
| 342 358 | 
             
                      # I'd rather not have a default content-type, but if none is set then the HTTP adapter sets this to 
         | 
| 343 359 | 
             
                      # application/x-www-form-urlencoded and issues a warning about it.
         | 
| 344 | 
            -
                       | 
| 360 | 
            +
                      if METHODS_WITH_BODIES.include?(http_method.to_s)
         | 
| 361 | 
            +
                        headers['Content-Type'] = FALLBACK_CONTENT_TYPE
         | 
| 362 | 
            +
                      end
         | 
| 345 363 | 
             
                    end
         | 
| 346 364 | 
             
                  end
         | 
| 347 | 
            -
                   | 
| 348 | 
            -
             | 
| 349 | 
            -
             | 
| 365 | 
            +
                  headers.update(self.headers)
         | 
| 366 | 
            +
                  body = self.body
         | 
| 367 | 
            +
             | 
| 350 368 | 
             
                  ur = nil
         | 
| 351 | 
            -
                  faraday_connection(-> (yur) { ur = yur }) | 
| 369 | 
            +
                  conn = faraday_connection(-> (yur) { ur = yur })
         | 
| 370 | 
            +
                  conn.run_request(http_method.downcase.to_sym, url, body, headers)
         | 
| 352 371 | 
             
                  ur.scorpio_request = self
         | 
| 353 372 | 
             
                  ur
         | 
| 354 373 | 
             
                end
         | 
| @@ -375,6 +394,12 @@ module Scorpio | |
| 375 394 | 
             
                  return to_enum(__method__, next_page: next_page, raise_on_http_error: raise_on_http_error) unless block_given?
         | 
| 376 395 | 
             
                  page_ur = run_ur
         | 
| 377 396 | 
             
                  while page_ur
         | 
| 397 | 
            +
                    unless page_ur.is_a?(Scorpio::Ur)
         | 
| 398 | 
            +
                      raise(TypeError, [
         | 
| 399 | 
            +
                        "next_page must result in a #{Scorpio::Ur}",
         | 
| 400 | 
            +
                        "this should be the result of #run_ur from a #{OpenAPI::Operation} or #{Request}",
         | 
| 401 | 
            +
                      ].join("\n"))
         | 
| 402 | 
            +
                    end
         | 
| 378 403 | 
             
                    page_ur.raise_on_http_error if raise_on_http_error
         | 
| 379 404 | 
             
                    yield page_ur
         | 
| 380 405 | 
             
                    page_ur = next_page.call(page_ur)
         | 
| @@ -1,8 +1,6 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 3 | 
             
            module Scorpio
         | 
| 4 | 
            -
              # see also Faraday::Env::MethodsWithBodies
         | 
| 5 | 
            -
              METHODS_WITH_BODIES = %w(post put patch options).map(&:freeze).freeze
         | 
| 6 4 | 
             
              class RequestSchemaFailure < Error
         | 
| 7 5 | 
             
              end
         | 
| 8 6 |  | 
| @@ -265,7 +263,7 @@ module Scorpio | |
| 265 263 | 
             
                    call_params = JSI::Util.stringify_symbol_keys(call_params) if call_params.respond_to?(:to_hash)
         | 
| 266 264 | 
             
                    model_attributes = JSI::Util.stringify_symbol_keys(model_attributes || {})
         | 
| 267 265 |  | 
| 268 | 
            -
                    request =  | 
| 266 | 
            +
                    request = operation.build_request
         | 
| 269 267 |  | 
| 270 268 | 
             
                    accessor_overridden = -> (accessor) do
         | 
| 271 269 | 
             
                      # an accessor is overridden if the default accessor getter (UnboundMethod) is the same
         | 
| @@ -326,7 +324,7 @@ module Scorpio | |
| 326 324 | 
             
                        else
         | 
| 327 325 | 
             
                          jsi = operation.request_schema.new_jsi(o)
         | 
| 328 326 | 
             
                        end
         | 
| 329 | 
            -
                        jsi. | 
| 327 | 
            +
                        jsi.jsi_select_descendents_leaf_first do |node|
         | 
| 330 328 | 
             
                          # we want to specifically reject only nodes described (only) by a false schema.
         | 
| 331 329 | 
             
                          # note that for OpenAPI schemas, false is only a valid schema as a value
         | 
| 332 330 | 
             
                          # of `additionalProperties`
         | 
| @@ -344,7 +342,7 @@ module Scorpio | |
| 344 342 | 
             
                      end
         | 
| 345 343 | 
             
                    else
         | 
| 346 344 | 
             
                      if other_params
         | 
| 347 | 
            -
                        if  | 
| 345 | 
            +
                        if Request.method_with_body?(request.http_method)
         | 
| 348 346 | 
             
                          request.body_object = other_params
         | 
| 349 347 | 
             
                        else
         | 
| 350 348 | 
             
                          if other_params.respond_to?(:to_hash)
         | 
| @@ -394,7 +392,7 @@ module Scorpio | |
| 394 392 |  | 
| 395 393 | 
             
              class ResourceBase
         | 
| 396 394 | 
             
                module Containment
         | 
| 397 | 
            -
                  def [](key)
         | 
| 395 | 
            +
                  def [](key, _: nil) # unused keyword param lets an empty keyword hash be passed in older ruby versions
         | 
| 398 396 | 
             
                    sub = contained_object[key]
         | 
| 399 397 | 
             
                    if sub.is_a?(JSI::Base)
         | 
| 400 398 | 
             
                      # TODO avoid reinstantiating the container only to throw it away if it matches the memo
         | 
| @@ -420,7 +418,7 @@ module Scorpio | |
| 420 418 | 
             
                  end
         | 
| 421 419 |  | 
| 422 420 | 
             
                  def as_json(*opt)
         | 
| 423 | 
            -
                    JSI:: | 
| 421 | 
            +
                    JSI::Util.as_json(contained_object, *opt)
         | 
| 424 422 | 
             
                  end
         | 
| 425 423 |  | 
| 426 424 | 
             
                  def inspect
         | 
| @@ -513,12 +511,10 @@ module Scorpio | |
| 513 511 |  | 
| 514 512 | 
             
                      # TODO this is JSI internals that scorpio shouldn't really be using
         | 
| 515 513 | 
             
                      if object.respond_to?(:to_hash)
         | 
| 516 | 
            -
                        container_modules <<  | 
| 517 | 
            -
                        container_modules << JSI::PathedHashNode
         | 
| 514 | 
            +
                        container_modules << JSI::Base::HashNode
         | 
| 518 515 | 
             
                      end
         | 
| 519 516 | 
             
                      if object.respond_to?(:to_ary)
         | 
| 520 | 
            -
                        container_modules <<  | 
| 521 | 
            -
                        container_modules << JSI::PathedArrayNode
         | 
| 517 | 
            +
                        container_modules << JSI::Base::ArrayNode
         | 
| 522 518 | 
             
                      end
         | 
| 523 519 |  | 
| 524 520 | 
             
                      container_modules += object.jsi_schemas.map do |schema|
         | 
    
        data/lib/scorpio/version.rb
    CHANGED
    
    
    
        data/scorpio.gemspec
    CHANGED
    
    | @@ -26,8 +26,8 @@ Gem::Specification.new do |spec| | |
| 26 26 |  | 
| 27 27 | 
             
              spec.require_paths = ["lib"]
         | 
| 28 28 |  | 
| 29 | 
            -
              spec.add_dependency "jsi", "~> 0. | 
| 29 | 
            +
              spec.add_dependency "jsi", "~> 0.7.0"
         | 
| 30 30 | 
             
              spec.add_dependency "ur", "~> 0.2.1"
         | 
| 31 | 
            -
              spec.add_dependency "faraday", "<  | 
| 31 | 
            +
              spec.add_dependency "faraday", "< 3.0"
         | 
| 32 32 | 
             
              spec.add_dependency "addressable", '~> 2.3'
         | 
| 33 33 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: scorpio
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.6. | 
| 4 | 
            +
              version: 0.6.2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Ethan
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2023-01-28 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: jsi
         | 
| @@ -16,14 +16,14 @@ dependencies: | |
| 16 16 | 
             
                requirements:
         | 
| 17 17 | 
             
                - - "~>"
         | 
| 18 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            -
                    version: 0. | 
| 19 | 
            +
                    version: 0.7.0
         | 
| 20 20 | 
             
              type: :runtime
         | 
| 21 21 | 
             
              prerelease: false
         | 
| 22 22 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 23 | 
             
                requirements:
         | 
| 24 24 | 
             
                - - "~>"
         | 
| 25 25 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            -
                    version: 0. | 
| 26 | 
            +
                    version: 0.7.0
         | 
| 27 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 28 | 
             
              name: ur
         | 
| 29 29 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -44,14 +44,14 @@ dependencies: | |
| 44 44 | 
             
                requirements:
         | 
| 45 45 | 
             
                - - "<"
         | 
| 46 46 | 
             
                  - !ruby/object:Gem::Version
         | 
| 47 | 
            -
                    version: ' | 
| 47 | 
            +
                    version: '3.0'
         | 
| 48 48 | 
             
              type: :runtime
         | 
| 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: ' | 
| 54 | 
            +
                    version: '3.0'
         | 
| 55 55 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 56 56 | 
             
              name: addressable
         | 
| 57 57 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -117,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 117 117 | 
             
                - !ruby/object:Gem::Version
         | 
| 118 118 | 
             
                  version: '0'
         | 
| 119 119 | 
             
            requirements: []
         | 
| 120 | 
            -
            rubygems_version: 3.1. | 
| 120 | 
            +
            rubygems_version: 3.1.6
         | 
| 121 121 | 
             
            signing_key:
         | 
| 122 122 | 
             
            specification_version: 4
         | 
| 123 123 | 
             
            summary: Scorpio REST client
         |