Class: Quickbooks::Model::Item
Constant Summary
collapse
- XML_COLLECTION_NODE =
"Item"
- XML_NODE =
"Item"
- REST_RESOURCE =
'item'
- INVENTORY_TYPE =
'Inventory'
- NON_INVENTORY_TYPE =
'Non Inventory'
- SERVICE_TYPE =
'Service'
- ITEM_TYPES =
[INVENTORY_TYPE, NON_INVENTORY_TYPE, SERVICE_TYPE]
Instance Method Summary
collapse
Methods inherited from BaseModel
reference_setters, resource_for_collection, resource_for_singular, #to_xml_inject_ns, #to_xml_ns
Constructor Details
#initialize ⇒ Item
Returns a new instance of Item.
57
58
59
60
|
# File 'lib/quickbooks/model/item.rb', line 57
def initialize
self.type = INVENTORY_TYPE
super
end
|
Instance Method Details
#active? ⇒ Boolean
62
63
64
|
# File 'lib/quickbooks/model/item.rb', line 62
def active?
active.to_s == 'true'
end
|
#purchase_tax_included? ⇒ Boolean
82
83
84
|
# File 'lib/quickbooks/model/item.rb', line 82
def purchase_tax_included?
purchase_tax_included.to_s == 'true'
end
|
#sales_tax_included? ⇒ Boolean
78
79
80
|
# File 'lib/quickbooks/model/item.rb', line 78
def sales_tax_included?
sales_tax_included.to_s == 'true'
end
|
#sub_item? ⇒ Boolean
66
67
68
|
# File 'lib/quickbooks/model/item.rb', line 66
def sub_item?
sub_item.to_s == 'true'
end
|
#taxable? ⇒ Boolean
70
71
72
|
# File 'lib/quickbooks/model/item.rb', line 70
def taxable?
taxable.to_s == 'true'
end
|
#track_quantity_on_hand? ⇒ Boolean
74
75
76
|
# File 'lib/quickbooks/model/item.rb', line 74
def track_quantity_on_hand?
track_quantity_on_hand.to_s == 'true'
end
|
#valid_for_create? ⇒ Boolean
86
87
88
89
|
# File 'lib/quickbooks/model/item.rb', line 86
def valid_for_create?
valid?
errors.empty?
end
|
#valid_for_deletion? ⇒ Boolean
To delete an object Intuit requires we provide Id and SyncToken fields
92
93
94
95
|
# File 'lib/quickbooks/model/item.rb', line 92
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
97
98
99
100
101
102
|
# File 'lib/quickbooks/model/item.rb', line 97
def valid_for_update?
if sync_token.nil?
errors.add(:sync_token, "Missing required attribute SyncToken for update")
end
errors.empty?
end
|