Class: PartnerApi::Endpoints::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/partner_api/endpoints/base.rb

Instance Method Summary collapse

Instance Method Details

#callObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/partner_api/endpoints/base.rb', line 17

def call
  config.logger.info(**logging_params.merge(class: self.class.name))

  response = config.instrumentation.call(action: self.class.name) do
    client.request(method, url, **request_options)
  end

  if successful?(response)
    Success(decode(response))
  else
    Failure(decode_error(response))
  end
rescue HTTP::Error, OpenSSL::SSL::SSLError => e
  raise Errors::ConnectionError, e.message
end