Class: OAS::Client
- Inherits:
-
Object
- Object
- OAS::Client
- Defined in:
- lib/oas/client.rb
Instance Method Summary collapse
- #execute(request) ⇒ Object
-
#initialize(opts = {}) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(opts = {}) ⇒ Client
Returns a new instance of Client.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/oas/client.rb', line 8 def initialize(opts={}) = OAS..merge(opts) Configuration::VALID_OPTIONS_KEYS.each do |key| send("#{key}=", [key]) end @savon = Savon::Client.new do |client| client.endpoint endpoint.to_s client.namespace "http://api.oas.tfsm.com/" client.namespace_identifier :n1 client.convert_request_keys_to :camelcase client.open_timeout timeout.to_i client.read_timeout timeout.to_i client.ssl_verify_mode :none client.logger logger client.log !!logger end end |
Instance Method Details
#execute(request) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/oas/client.rb', line 27 def execute(request) response = @savon.call :oas_xml_request, message: Hash["String_1", account.to_s, "String_2", username.to_s, "String_3", password.to_s, "String_4", request.to_xml.to_s] OAS::AdXML.parse response.body[:oas_xml_request_response][:result] rescue Savon::HTTPError => e _raise_http_error!(e) rescue Savon::InvalidResponseError => e raise OAS::Error.new(e.) end |