Class: PXMyPortal::DocumentDownloader
- Inherits:
-
Object
- Object
- PXMyPortal::DocumentDownloader
- Defined in:
- lib/pxmyportal/document_downloader.rb
Instance Method Summary collapse
-
#initialize(path:, form_data:, logger:, http:) ⇒ DocumentDownloader
constructor
A new instance of DocumentDownloader.
- #post ⇒ Object
Constructor Details
#initialize(path:, form_data:, logger:, http:) ⇒ DocumentDownloader
Returns a new instance of DocumentDownloader.
19 20 21 22 23 24 25 26 |
# File 'lib/pxmyportal/document_downloader.rb', line 19 def initialize(path:, form_data:, logger:, http:) @path = path @form_data = form_data @logger = logger @http = http @request = Net::HTTP::Post.new(@path) end |
Instance Method Details
#post ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/pxmyportal/document_downloader.rb', line 28 def post @http.(@request) @request.form_data = @form_data @logger.debug("request") { @request } response = @http.request(@request) response => Net::HTTPOK @logger.debug("response") { response.to_hash } response.to_hash["content-type"] => ["application/pdf"] response.body end |