Class: Quickbooks::Model::CustomField

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/quickbooks/model/custom_field.rb

Instance Method Summary collapse

Methods inherited from BaseModel

#as_json, attribute_names, #attributes, attrs_with_types, #initialize, 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

#line_item_size

Methods included from Definition

included, #is_name_list_entity?, #is_transaction_entity?

Constructor Details

This class inherits a constructor from Quickbooks::Model::BaseModel

Instance Method Details

#valueObject



12
13
14
15
16
17
18
19
# File 'lib/quickbooks/model/custom_field.rb', line 12

def value
  case type
  when 'BooleanType' then boolean_value == 'true'
  when 'StringType' then string_value
  when 'DateType' then date_value
  when 'NumberType' then number_value
  end
end

#value=(value) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/quickbooks/model/custom_field.rb', line 21

def value=(value)
  case type
  when 'BooleanType' then self.boolean_value = value ? 'true' : 'false'
  when 'StringType' then self.string_value = value
  when 'DateType' then self.date_value = value
  when 'NumberType' then self.number_value = value
  end
end