Class: Quickeebooks::Online::Model::CustomerCustomField

Inherits:
IntuitType
  • Object
show all
Defined in:
lib/quickeebooks/online/model/customer_custom_field.rb

Constant Summary collapse

TYPES =
%w{BooleanTypeCustomField StringTypeCustomField}
BOOLEAN_TYPE =
"BooleanTypeCustomField"
STRING_TYPE =
"StringTypeCustomField"

Instance Method Summary collapse

Methods inherited from IntuitType

resource_for_collection, resource_for_singular

Methods included from Logging

#log

Instance Method Details

#converted_valueObject

Intuit sends back “DONT” for “None” but they dont accept it when WE send it back to them, they want “None”. ugh.…



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/quickeebooks/online/model/customer_custom_field.rb', line 27

def converted_value
  if definition_id == "Preferred Delivery Method"
    if value == "DONT"
      "None"
    else
      value
    end
  else
    value
  end
end

#to_xml(options = {}) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/quickeebooks/online/model/customer_custom_field.rb', line 15

def to_xml(options = {})
  # Intuit v3 doesnt support custom field updating...
  return ""

  # return "" if value.to_s.empty?
  # xml = %Q{<CustomField xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="#{type_attr}">}
  # xml = "#{xml}<DefinitionId>#{definition_id}</DefinitionId><Value>#{converted_value}</Value></CustomField>"
  # xml
end

#type_attrObject



39
40
41
42
43
44
45
# File 'lib/quickeebooks/online/model/customer_custom_field.rb', line 39

def type_attr
  if definition_id == "Bill With Parent"
    "BooleanTypeCustomeField"
  else
    "StringTypeCustomField"
  end
end