class Gpdb::REST::Client

Attributes

http_client[RW]
pronunciations[RW]
recording_requests[RW]

Public Class Methods

new() click to toggle source
# 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

Public Instance Methods

request(request, namespace: Gpdb.configuration.namespace) click to toggle source
# 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