Class: Gpdb::REST::Client
- Inherits:
-
Object
- Object
- Gpdb::REST::Client
- Defined in:
- lib/gpdb/rest/client.rb
Instance Attribute Summary collapse
-
#http_client ⇒ Object
Returns the value of attribute http_client.
-
#pronunciations ⇒ Object
Returns the value of attribute pronunciations.
-
#recording_requests ⇒ Object
Returns the value of attribute recording_requests.
Instance Method Summary collapse
-
#initialize ⇒ Client
constructor
A new instance of Client.
- #request(request, namespace: Gpdb.configuration.namespace) ⇒ Object
Constructor Details
#initialize ⇒ Client
Returns a new instance of Client.
9 10 11 12 13 14 |
# File 'lib/gpdb/rest/client.rb', line 9 def initialize self.http_client = HttpClient.new self.recording_requests = Gpdb::REST::RecordingRequest::Resource.new(self) self.pronunciations = Gpdb::REST::Pronunciation::Resource.new(self) end |
Instance Attribute Details
#http_client ⇒ Object
Returns the value of attribute http_client.
6 7 8 |
# File 'lib/gpdb/rest/client.rb', line 6 def http_client @http_client end |
#pronunciations ⇒ Object
Returns the value of attribute pronunciations.
7 8 9 |
# File 'lib/gpdb/rest/client.rb', line 7 def pronunciations @pronunciations end |
#recording_requests ⇒ Object
Returns the value of attribute recording_requests.
7 8 9 |
# File 'lib/gpdb/rest/client.rb', line 7 def recording_requests @recording_requests end |
Instance Method Details
#request(request, namespace: Gpdb.configuration.namespace) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/gpdb/rest/client.rb', line 16 def request(request, namespace: Gpdb.configuration.namespace) request.api_url = Gpdb.configuration.api_url request.path = "#{namespace}#{request.path}" request.headers = { 'Authorization': Gpdb.configuration.credentials.signature_header } response = http_client.request(request) Response.new(body: response.body, status: response.status, _response: response) end |