class Belvo::Invoice

An Invoice is the representation of an electronic invoice, that can be received or sent, by a business or an individual and has been uploaded to the fiscal institution website

Public Class Methods

new(session) click to toggle source
Calls superclass method Belvo::Resource::new
# File lib/belvo/resources.rb, line 325
def initialize(session)
  super(session)
  @endpoint = 'invoices/'
end

Public Instance Methods

retrieve(link:, date_from:, date_to:, type:, options: nil) click to toggle source

@param link [String] Link UUID @param date_from [String] Date string (YYYY-MM-DD) @param date_to [String] Date string (YYYY-MM-DD) @param options [InvoiceOptions] Configurable properties @return [Hash] created invoices details @raise [RequestError] If response code is different than 2XX

# File lib/belvo/resources.rb, line 336
def retrieve(link:, date_from:, date_to:, type:, options: nil)
  options = InvoiceOptions.from(options)
  body = {
    link: link,
    date_from: date_from,
    date_to: date_to,
    type: type,
    token: options.token,
    save_data: options.save_data || true,
    attach_xml: options.attach_xml
  }.merge(options)
  body = clean body: body
  @session.post(@endpoint, body)
end