Skip to content

Commit

Permalink
Merge 20684a8 into 620ea04
Browse files Browse the repository at this point in the history
  • Loading branch information
notEthan authored Jul 25, 2018
2 parents 620ea04 + 20684a8 commit 9808838
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
16 changes: 8 additions & 8 deletions lib/scorpio.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ class NetworkAuthenticationRequired511Error < ServerError; status(511); end
include HTTPErrors
error_classes_by_status.freeze

autoload :ResourceBase, 'scorpio/resource_base'
autoload :OpenAPI, 'scorpio/openapi'
autoload :Google, 'scorpio/google_api_document'
autoload :JSON, 'scorpio/json'
autoload :JSON, 'scorpio/json'
autoload :Google, 'scorpio/google_api_document'
autoload :OpenAPI, 'scorpio/openapi'
autoload :Typelike, 'scorpio/typelike_modules'
autoload :Hashlike, 'scorpio/typelike_modules'
autoload :Arraylike, 'scorpio/typelike_modules'
autoload :ResourceBase, 'scorpio/resource_base'
autoload :Schema, 'scorpio/schema'
autoload :SchemaInstanceBase, 'scorpio/schema_instance_base'
autoload :Schema, 'scorpio/schema'
autoload :Typelike, 'scorpio/typelike_modules'
autoload :Hashlike, 'scorpio/typelike_modules'
autoload :Arraylike, 'scorpio/typelike_modules'
end
2 changes: 1 addition & 1 deletion lib/scorpio/pickle_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def self.model_classes

# get a list of column names for a given class
def self.column_names(klass)
klass.all_schema_properties
klass.all_schema_properties.to_a
end

# Get an instance by id of the model
Expand Down
3 changes: 1 addition & 2 deletions lib/scorpio/resource_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -517,14 +517,13 @@ def call_operation(operation, call_params: nil)

# if we're making a POST or PUT and the request schema is this resource, we'll assume that
# the request is persisting this resource
operation.request_schema
request_resource_is_self = operation.request_schema && self.class.represented_schemas.include?(operation.request_schema)
if @options['response'] && @options['response'].status && operation.responses
_, response_schema_node = operation.responses.detect { |k, v| k.to_s == @options['response'].status.to_s }
end
response_schema = Scorpio::Schema.new(response_schema_node) if response_schema_node
response_resource_is_self = response_schema && self.class.represented_schemas.include?(response_schema)
if request_resource_is_self && %w(PUT POST).include?(operation.http_method)
if request_resource_is_self && %w(put post).include?(operation.http_method.to_s.downcase)
@persisted = true

if response_resource_is_self
Expand Down

0 comments on commit 9808838

Please sign in to comment.