Skip to content

Commit

Permalink
resource_base: don't instantiate response object as a schema instance…
Browse files Browse the repository at this point in the history
… if it's not a hash or array.
  • Loading branch information
notEthan committed Jun 15, 2018
1 parent b1d9bea commit c19ea92
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/scorpio/resource_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,11 @@ def call_operation(operation, call_params: nil, model_attributes: nil)
response_schema = operation_response['schema'] if operation_response
end
if response_schema
response_object = Scorpio.class_for_schema(response_schema).new(response_object)
# not too sure about this, but I don't think it makes sense to instantiate things that are
# not hash or array as a SchemaInstanceBase
if response_object.respond_to?(:to_hash) || response_object.respond_to?(:to_ary)
response_object = Scorpio.class_for_schema(response_schema).new(response_object)
end
end

error_class = Scorpio.error_classes_by_status[response.status]
Expand Down

0 comments on commit c19ea92

Please sign in to comment.