Class: NetsuiteApi::Invoice

Inherits:
Base
  • Object
show all
Includes:
Concerns::RequestHandler, Concerns::ResponseHandler
Defined in:
lib/netsuite_api/invoice.rb

Constant Summary collapse

PATH =
"invoice"

Instance Attribute Summary

Attributes inherited from Base

#account_id, #consumer_key, #netsuite_host, #token

Instance Method Summary collapse

Methods included from Concerns::ResponseHandler

#delete_response_handler, #error_handler, #get_response_handler, #post_and_patch_response_handler

Methods included from Concerns::RequestHandler

#create, #delete, #get, #query, #update

Methods inherited from Base

#initialize, #request

Constructor Details

This class inherits a constructor from NetsuiteApi::Base

Instance Method Details

#get_pdf(query) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/netsuite_api/invoice.rb', line 12

def get_pdf(query)
  path = "app/site/hosting/restlet.nl"
  response = request(path, query_params: query, host_type: :netsuite_pdf_host)
  
  if response.success?
    ecrypted_str = JSON.parse(response.body).dig('data64')
    plain = Base64.decode64(ecrypted_str)
  else
    nil
  end
end