Class: Datalab::Request
- Inherits:
-
Object
- Object
- Datalab::Request
- Defined in:
- lib/datalab/request.rb
Overview
The Request
class encapsulates a request to the Datalab API. This class serves as the implementation of the MarkerRequest, OcrRequest and other classes and should not be used directly.
Direct Known Subclasses
Constant Summary collapse
- BASE_URI =
'https://www.datalab.to/api/v1'
Instance Method Summary collapse
-
#initialize(connection: nil, api_key: nil) ⇒ Request
constructor
The
initialize
method initializes theRequest
instance.
Constructor Details
#initialize(connection: nil, api_key: nil) ⇒ Request
The initialize
method initializes the Request
instance. You can pass an api_key
and and optionally a (Faraday) connection
.
16 17 18 19 20 21 |
# File 'lib/datalab/request.rb', line 16 def initialize( connection: nil, api_key: nil ) @connection = connection || Datalab.connection @api_key = api_key || Datalab.api_key raise ArgumentError, "An 'api_key' is required unless configured using 'Datalab.api_key'." \ unless @api_key end |