Class: Comgate::ApiCaller
- Inherits:
-
BaseService
- Object
- BaseService
- Comgate::ApiCaller
- Defined in:
- lib/comgate/api_caller.rb
Defined Under Namespace
Classes: HttpResponseStubStruct
Constant Summary collapse
- KNOWN_CONNECTION_ERRORS =
[ Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, SocketError, Net::ReadTimeout, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError ].freeze
Instance Attribute Summary collapse
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Attributes inherited from BaseService
Instance Method Summary collapse
- #build_result ⇒ Object
-
#initialize(url:, payload:, test_call: false, proxy_uri: nil) ⇒ ApiCaller
constructor
A new instance of ApiCaller.
Methods inherited from BaseService
call, #call, #failure?, #success?
Constructor Details
#initialize(url:, payload:, test_call: false, proxy_uri: nil) ⇒ ApiCaller
Returns a new instance of ApiCaller.
23 24 25 26 27 28 29 |
# File 'lib/comgate/api_caller.rb', line 23 def initialize(url:, payload:, test_call: false, proxy_uri: nil) super() @url = url @payload = payload @payload.merge!(test: "true") if test_call @proxy_uri = proxy_uri end |
Instance Attribute Details
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
21 22 23 |
# File 'lib/comgate/api_caller.rb', line 21 def payload @payload end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
21 22 23 |
# File 'lib/comgate/api_caller.rb', line 21 def url @url end |
Instance Method Details
#build_result ⇒ Object
31 32 33 34 |
# File 'lib/comgate/api_caller.rb', line 31 def build_result call_api process_response end |