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, opts = {}) ⇒ Object
- .get(params, opts = {}) ⇒ Object
- .received_pdf_url(params) ⇒ Object
Methods inherited from APIResource
api_url, class_name, endpoint_name, require_param, required_param_validation, rest_api_params, 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, opts = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/eligible/received_pdf.rb', line 12 def self.download(params, opts = {}) enrollment_npi_id = Util.value(params, :enrollment_npi_id) require_param(enrollment_npi_id, 'Enrollment Npi id') params[:format] = 'x12' headers = opts.clone api_key = headers.delete(:api_key) response = Eligible.request(:get, "/enrollment_npis/#{params[:enrollment_npi_id]}/received_pdf/download", api_key, params, **headers)[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, opts = {}) ⇒ Object
8 9 10 |
# File 'lib/eligible/received_pdf.rb', line 8 def self.get(params, opts = {}) send_request :get, received_pdf_url(params), params, **opts.merge(required_params: [:enrollment_npi_id]) end |