Module: OnlineEntityModel::InstanceMethods

Defined in:
lib/quickeebooks/common/online_entity_model.rb

Instance Method Summary collapse

Instance Method Details

#email_address=(email_address) ⇒ Object



43
44
45
# File 'lib/quickeebooks/common/online_entity_model.rb', line 43

def email_address=(email_address)
  self.email = Quickeebooks::Online::Model::Email.new(email_address)
end

#to_xml_ns(options = {}) ⇒ Object



39
40
41
# File 'lib/quickeebooks/common/online_entity_model.rb', line 39

def to_xml_ns(options = {})
  to_xml_inject_ns(self.class::XML_NODE, options)
end

#valid_for_deletion?Boolean

To delete an account Intuit requires we provide Id and SyncToken fields

Returns:

  • (Boolean)


48
49
50
51
# File 'lib/quickeebooks/common/online_entity_model.rb', line 48

def valid_for_deletion?
  return false if(id.nil? || sync_token.nil?)
  id.value.to_i > 0 && !sync_token.to_s.empty? && sync_token.to_i >= 0
end

#valid_for_update?Boolean

Returns:

  • (Boolean)


32
33
34
35
36
37
# File 'lib/quickeebooks/common/online_entity_model.rb', line 32

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