Class: Quickeebooks::Online::Model::Item
- Inherits:
-
IntuitType
- Object
- IntuitType
- Quickeebooks::Online::Model::Item
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/quickeebooks/online/model/item.rb
Constant Summary collapse
- XML_NODE =
"Item"
- REST_RESOURCE =
<baseURL>/resource/items/v2/<realmID>
"item"
Instance Method Summary collapse
- #taxable? ⇒ Boolean
- #to_xml_ns(options = {}) ⇒ Object
-
#valid_for_deletion? ⇒ Boolean
To delete a record Intuit requires we provide Id and SyncToken fields.
- #valid_for_update? ⇒ Boolean
Methods inherited from IntuitType
resource_for_collection, resource_for_singular
Methods included from Logging
Instance Method Details
#taxable? ⇒ Boolean
55 56 57 |
# File 'lib/quickeebooks/online/model/item.rb', line 55 def taxable? taxable == "true" end |
#to_xml_ns(options = {}) ⇒ Object
37 38 39 |
# File 'lib/quickeebooks/online/model/item.rb', line 37 def to_xml_ns( = {}) to_xml_inject_ns('Item', ) end |
#valid_for_deletion? ⇒ Boolean
To delete a record Intuit requires we provide Id and SyncToken fields
42 43 44 45 |
# File 'lib/quickeebooks/online/model/item.rb', line 42 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
47 48 49 50 51 52 53 |
# File 'lib/quickeebooks/online/model/item.rb', line 47 def valid_for_update? if sync_token.nil? errors.add(:sync_token, "Missing required attribute SyncToken for update") end valid? errors.empty? end |