class BreezyPDFLite::Client

HTTP Client for BreezyPDFLite API

Public Instance Methods

post(path, body) click to toggle source
# File lib/breezy_pdf_lite/client.rb, line 6
def post(path, body)
  uri = URI.parse(BreezyPDFLite.base_url + path)

  http = Net::HTTP.new(uri.host, uri.port)
  http.use_ssl = uri.scheme == "https"
  http.open_timeout = BreezyPDFLite.open_timeout
  http.read_timeout = BreezyPDFLite.read_timeout

  request = Net::HTTP::Post.new(uri.request_uri, headers)

  request.body = body

  http.request(request)
end

Private Instance Methods

headers() click to toggle source
# File lib/breezy_pdf_lite/client.rb, line 23
def headers
  {
    "Authorization": "Bearer #{BreezyPDFLite.secret_api_key}"
  }
end