Class: Dupe::Network::PostMock
Overview
:nodoc:
Instance Attribute Summary
Attributes inherited from Mock
Instance Method Summary collapse
-
#process_response(resp, url) ⇒ Object
returns a tuple representing the xml of the processed entity, plus the url to the entity.
Methods inherited from Mock
#initialize, #match?, #mocked_response
Constructor Details
This class inherits a constructor from Dupe::Network::Mock
Instance Method Details
#process_response(resp, url) ⇒ Object
returns a tuple representing the xml of the processed entity, plus the url to the entity.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/superdupe/mock.rb', line 72 def process_response(resp, url) case resp when NilClass raise StandardError, "Failed with 500: the request '#{url}' returned nil." when Dupe::Database::Record new_path = "/#{resp.__model__.name.to_s.pluralize}/#{resp.id}.xml" resp = resp.to_xml_safe(:root => resp.demodulize) Dupe.network.log.add_request :post, url, resp return resp, new_path else raise StandardError, "Unknown PostMock Response. Your Post intercept mocks must return a Duped resource object or nil" end end |