Class: BreezyPDFLite::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/breezy_pdf_lite/client.rb

Overview

HTTP Client for BreezyPDFLite API

Instance Method Summary collapse

Instance Method Details

#post(path, body) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 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