Class: Quickeebooks::Windows::Model::Clazz

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

Constant Summary collapse

XML_COLLECTION_NODE =
'Classes'
XML_NODE =
'Class'
REST_RESOURCE =
"class"

Instance Method Summary collapse

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/quickeebooks/windows/model/clazz.rb', line 34

def active?
  active == 'true'
end

#to_xml_ns(options = {}) ⇒ Object



53
54
55
# File 'lib/quickeebooks/windows/model/clazz.rb', line 53

def to_xml_ns(options = {})
  to_xml
end

#valid_for_create?Boolean

Returns:

  • (Boolean)


45
46
47
48
49
50
51
# File 'lib/quickeebooks/windows/model/clazz.rb', line 45

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

Returns:

  • (Boolean)


58
59
60
61
# File 'lib/quickeebooks/windows/model/clazz.rb', line 58

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)


38
39
40
41
42
43
# File 'lib/quickeebooks/windows/model/clazz.rb', line 38

def valid_for_update?
  if sync_token.nil?
    errors.add(:sync_token, "Missing required attribute SyncToken for update")
  end
  errors.empty?
end