Class: Quickeebooks::Online::Model::Clazz
- Inherits:
-
IntuitType
- Object
- IntuitType
- Quickeebooks::Online::Model::Clazz
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/quickeebooks/online/model/clazz.rb
Constant Summary collapse
- XML_COLLECTION_NODE =
'Classes'
- XML_NODE =
'Class'
- REST_RESOURCE =
"class"
Class Method Summary collapse
Instance Method Summary collapse
- #to_xml_ns(options = {}) ⇒ Object
- #valid_for_create? ⇒ Boolean
-
#valid_for_deletion? ⇒ Boolean
To delete an account Intuit requires we provide Id and SyncToken fields.
- #valid_for_update? ⇒ Boolean
Methods inherited from IntuitType
Methods included from Logging
Class Method Details
.resource_for_collection ⇒ Object
53 54 55 |
# File 'lib/quickeebooks/online/model/clazz.rb', line 53 def self.resource_for_collection "classes" end |
Instance Method Details
#to_xml_ns(options = {}) ⇒ Object
42 43 44 45 |
# File 'lib/quickeebooks/online/model/clazz.rb', line 42 def to_xml_ns( = {}) .merge!(:destination_name => 'Class') to_xml_inject_ns('Clazz', ) end |
#valid_for_create? ⇒ Boolean
34 35 36 37 38 39 40 |
# File 'lib/quickeebooks/online/model/clazz.rb', line 34 def valid_for_create? valid? if type_of.nil? errors.add(:type_of, "Missing required attribute TypeOf for Create") end errors.empty? end |
#valid_for_deletion? ⇒ Boolean
To delete an account Intuit requires we provide Id and SyncToken fields
48 49 50 51 |
# File 'lib/quickeebooks/online/model/clazz.rb', line 48 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
27 28 29 30 31 32 |
# File 'lib/quickeebooks/online/model/clazz.rb', line 27 def valid_for_update? if sync_token.nil? errors.add(:sync_token, "Missing required attribute SyncToken for update") end errors.empty? end |