Class: BreezyPDF::Client
- Inherits:
-
Object
- Object
- BreezyPDF::Client
- Defined in:
- lib/breezy_pdf/client.rb
Overview
HTTP Client for BreezyPDF API
Instance Method Summary collapse
Instance Method Details
#post(path, body) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/breezy_pdf/client.rb', line 6 def post(path, body) uri = URI.parse(BreezyPDF.base_url + path) http = Net::HTTP.new(uri.host, uri.port).tap { |h| h.use_ssl = true } request = Net::HTTP::Post.new(uri.request_uri, headers) request.body = body.to_json Response.new http.request(request) end |
#put(path, body) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/breezy_pdf/client.rb', line 16 def put(path, body) uri = URI.parse(BreezyPDF.base_url + path) http = Net::HTTP.new(uri.host, uri.port).tap { |h| h.use_ssl = true } request = Net::HTTP::Put.new(uri.request_uri, headers) request.body = body.to_json Response.new http.request(request) end |