Class: Quickbooks::Model::Item
- Defined in:
- lib/quickbooks/model/item.rb
Constant Summary collapse
- XML_COLLECTION_NODE =
- "Item"
- XML_NODE =
- "Item"
- REST_RESOURCE =
- 'item'
- INVENTORY_TYPE =
- 'Inventory'
- NON_INVENTORY_TYPE =
- 'NonInventory'
- SERVICE_TYPE =
- 'Service'
- CATEGORY_TYPE =
- 'Category'
- ITEM_TYPES =
- [INVENTORY_TYPE, NON_INVENTORY_TYPE, SERVICE_TYPE, CATEGORY_TYPE] 
Instance Method Summary collapse
- 
  
    
      #initialize(*args)  ⇒ Item 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of Item. 
- #valid_for_create? ⇒ Boolean
- 
  
    
      #valid_for_deletion?  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    To delete an object Intuit requires we provide Id and SyncToken fields. 
- #valid_for_update? ⇒ Boolean
Methods inherited from BaseModel
#as_json, attribute_names, #attributes, attrs_with_types, #inspect, inspect, reference_attrs, reference_setters, resource_for_collection, resource_for_singular, to_xml_big_decimal, #to_xml_inject_ns, #to_xml_ns
Methods included from Validator
Methods included from Definition
included, #is_name_list_entity?, #is_transaction_entity?
Constructor Details
#initialize(*args) ⇒ Item
Returns a new instance of Item.
| 65 66 67 68 | # File 'lib/quickbooks/model/item.rb', line 65 def initialize(*args) self.type = INVENTORY_TYPE super end | 
Instance Method Details
#valid_for_create? ⇒ Boolean
| 70 71 72 73 | # File 'lib/quickbooks/model/item.rb', line 70 def valid_for_create? valid? errors.empty? end | 
#valid_for_deletion? ⇒ Boolean
To delete an object Intuit requires we provide Id and SyncToken fields
| 76 77 78 79 | # File 'lib/quickbooks/model/item.rb', line 76 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
| 81 82 83 84 85 86 | # File 'lib/quickbooks/model/item.rb', line 81 def valid_for_update? if sync_token.nil? errors.add(:sync_token, "Missing required attribute SyncToken for update") end errors.empty? end |