Class: Eligible::ReceivedPdf
- Inherits:
-
APIResource
- Object
- EligibleObject
- APIResource
- Eligible::ReceivedPdf
- Defined in:
- lib/eligible/received_pdf.rb
Instance Attribute Summary
Attributes inherited from EligibleObject
Class Method Summary collapse
- .download(params, api_key = nil) ⇒ Object
- .get(params, api_key = nil) ⇒ Object
- .received_pdf_url(params) ⇒ Object
Methods inherited from APIResource
api_url, class_name, require_param, send_request, url
Methods inherited from EligibleObject
#[], #[]=, construct_from, #each, #error, #initialize, #keys, #refresh_from, #to_hash, #to_json, #values
Constructor Details
This class inherits a constructor from Eligible::EligibleObject
Class Method Details
.download(params, api_key = nil) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/eligible/received_pdf.rb', line 12 def self.download(params, api_key = nil) enrollment_npi_id = Util.value(params, :enrollment_npi_id) require_param(enrollment_npi_id, 'Enrollment Npi id') params[:format] = 'x12' response = Eligible.request(:get, "/enrollment_npis/#{params[:enrollment_npi_id]}/received_pdf/download", api_key, **params)[0] filename = params[:filename] || '/tmp/received_pdf.pdf' file = File.new(filename, 'w') file.write response file.close "PDF file stored at #{filename}" end |
.get(params, api_key = nil) ⇒ Object
8 9 10 |
# File 'lib/eligible/received_pdf.rb', line 8 def self.get(params, api_key = nil) send_request(:get, received_pdf_url(params), api_key, params, :enrollment_npi_id) end |