Class: DpdApi::Client::Response
- Inherits:
-
Object
- Object
- DpdApi::Client::Response
- Includes:
- Observable
- Defined in:
- lib/dpd_api/client/response.rb
Defined Under Namespace
Classes: ResourceBuilder
Instance Method Summary collapse
-
#initialize(url) ⇒ Response
constructor
A new instance of Response.
- #response(method, params = {}, options = {}) ⇒ Object
Constructor Details
#initialize(url) ⇒ Response
Returns a new instance of Response.
9 10 11 12 |
# File 'lib/dpd_api/client/response.rb', line 9 def initialize(url) @url = url @client = Savon.client(wsdl: @url) end |
Instance Method Details
#response(method, params = {}, options = {}) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/dpd_api/client/response.rb', line 14 def response(method, params = {}, = {}) changed builder = ResourceBuilder.new(@client, method, params, ) result = begin builder.resources rescue Savon::SOAPFault => error { errors: error.to_s } end notify_observers(@url, builder.request_params, builder.response_body, result) result end |