Class: Quickeebooks::Online::Model::Invoice

Inherits:
IntuitType
  • Object
show all
Includes:
ActiveModel::Validations
Defined in:
lib/quickeebooks/online/model/invoice.rb

Constant Summary collapse

XML_NODE =
"Invoice"
REST_RESOURCE =
"invoice"

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from IntuitType

resource_for_singular

Constructor Details

#initializeInvoice

Returns a new instance of Invoice.



37
38
39
# File 'lib/quickeebooks/online/model/invoice.rb', line 37

def initialize
  ensure_line_items_initialization
end

Class Method Details

.resource_for_collectionObject

Class methods



55
56
57
# File 'lib/quickeebooks/online/model/invoice.rb', line 55

def self.resource_for_collection
  "#{self::REST_RESOURCE}s"
end

Instance Method Details

#to_xml_ns(options = {}) ⇒ Object



50
51
52
# File 'lib/quickeebooks/online/model/invoice.rb', line 50

def to_xml_ns(options = {})
  to_xml_inject_ns(XML_NODE, options)
end

#valid_for_deletion?Boolean

Returns:

  • (Boolean)


45
46
47
48
# File 'lib/quickeebooks/online/model/invoice.rb', line 45

def valid_for_deletion?
  return false if(id.nil? || sync_token.nil?)
  id.to_i > 0 && !sync_token.to_s.empty? && sync_token.to_i >= 0
end

#valid_for_update?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/quickeebooks/online/model/invoice.rb', line 41

def valid_for_update?
  errors.empty?
end