Class: Moneybird::Resource::SalesInvoice

Inherits:
Object
  • Object
show all
Extended by:
ClassMethods
Includes:
Moneybird::Resource
Defined in:
lib/moneybird/resource/sales_invoice.rb

Instance Attribute Summary

Attributes included from ClassMethods

#attributes, #logger, #nillable_attributes

Attributes included from Moneybird::Resource

#client, #errors

Instance Method Summary collapse

Methods included from ClassMethods

build, has_attributes, has_boolean_attributes, has_datetime_attributes, has_integer_attributes, has_nillable_attributes, resource

Methods included from Moneybird::Resource

#attributes, #attributes=, #initialize, #link_booking, #path, #persisted?, #to_json

Instance Method Details

#contact=(attributes) ⇒ Object



61
62
63
# File 'lib/moneybird/resource/sales_invoice.rb', line 61

def contact=(attributes)
  @contact = Moneybird::Resource::Contact.build(attributes)
end

#custom_fields=(custom_fields) ⇒ Object



88
89
90
# File 'lib/moneybird/resource/sales_invoice.rb', line 88

def custom_fields=(custom_fields)
  @custom_fields = custom_fields.map { |custom_field| Moneybird::Resource::CustomField.build(custom_field) }
end

#details=(line_items) ⇒ Object



80
81
82
# File 'lib/moneybird/resource/sales_invoice.rb', line 80

def details=(line_items)
  @details = line_items.map{ |line_item| Moneybird::Resource::Invoice::Details.build(line_item) }
end

#events=(events) ⇒ Object



84
85
86
# File 'lib/moneybird/resource/sales_invoice.rb', line 84

def events=(events)
  @events = events.map{ |event| Moneybird::Resource::Generic::Event.build(event) }
end

#mark_as_uncollectible(options = {}) ⇒ Object



70
71
72
73
# File 'lib/moneybird/resource/sales_invoice.rb', line 70

def mark_as_uncollectible(options = {})
  invoice_service = Moneybird::Service::SalesInvoice.new(client, administration_id)
  invoice_service.mark_as_uncollectible(self, options)
end

#notes=(notes) ⇒ Object



57
58
59
# File 'lib/moneybird/resource/sales_invoice.rb', line 57

def notes=(notes)
  @notes = notes.map{ |note| Moneybird::Resource::Generic::Note.build(note) }
end

#payments=(payments) ⇒ Object



75
76
77
78
# File 'lib/moneybird/resource/sales_invoice.rb', line 75

def payments=(payments)
  payment_data = payments.map{ |payment| Moneybird::Resource::Invoice::Payment.build(payment) }
  @payments = Moneybird::Service::Payment.new(client, administration_id, preloaded_data: payment_data, invoice_id: id)
end

#send_invoice(options = {}) ⇒ Object



65
66
67
68
# File 'lib/moneybird/resource/sales_invoice.rb', line 65

def send_invoice(options = {})
  invoice_service = Moneybird::Service::SalesInvoice.new(client, administration_id)
  invoice_service.send_invoice(self, options)
end