Class: Virgil::SDK::Client::HTTP::BaseConnection
- Inherits:
-
Object
- Object
- Virgil::SDK::Client::HTTP::BaseConnection
- Defined in:
- lib/virgil/sdk/client/http/base_connection.rb
Overview
Base API service connection class.
Direct Known Subclasses
Defined Under Namespace
Classes: ApiError
Constant Summary collapse
- ERRORS =
{}
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#base_url ⇒ Object
Returns the value of attribute base_url.
Instance Method Summary collapse
-
#initialize(access_token, base_url) ⇒ BaseConnection
constructor
Constructs new BaseConnection object.
-
#send_request(request) ⇒ Hash
Sends http request to the endpoint.
Constructor Details
#initialize(access_token, base_url) ⇒ BaseConnection
Constructs new BaseConnection object.
52 53 54 55 |
# File 'lib/virgil/sdk/client/http/base_connection.rb', line 52 def initialize(access_token, base_url) self.access_token = access_token self.base_url = base_url end |
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token
49 50 51 |
# File 'lib/virgil/sdk/client/http/base_connection.rb', line 49 def access_token @access_token end |
#base_url ⇒ Object
Returns the value of attribute base_url
49 50 51 |
# File 'lib/virgil/sdk/client/http/base_connection.rb', line 49 def base_url @base_url end |
Instance Method Details
#send_request(request) ⇒ Hash
Sends http request to the endpoint.
62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/virgil/sdk/client/http/base_connection.rb', line 62 def send_request(request) response = faraday_connection.run_request( request.method, request.endpoint, request.body, request.headers ) return response.body if response.success? raise ApiError.new((response)) end |