Method: AsposePdfCloud::ApiClient#call_api
- Defined in:
- lib/aspose_pdf_cloud/api_client.rb
#call_api(http_method, path, opts = {}) ⇒ Array<(Object, Fixnum, Hash)>
Call an API with given options.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/aspose_pdf_cloud/api_client.rb', line 64 def call_api(http_method, path, opts = {}) response = build_request(http_method, path, opts) download_file response if opts[:return_type] == 'File' if @config.debugging @config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n" end unless response.success? if response.status == 0 # Errors from libcurl will be made visible here fail ApiError.new(:code => 0, :message => response.reason_phrase) else fail ApiError.new(:code => response.status, :response_headers => response.headers, :response_body => response.body), response.reason_phrase end end if opts[:return_type] data = deserialize(response, opts[:return_type]) else data = nil end [data, response.status, response.headers] end |