Class: Quickbooks::Model::BaseModelJSON
- Defined in:
- lib/quickbooks/model/base_model_json.rb
Direct Known Subclasses
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
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
#to_json ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/quickbooks/model/base_model_json.rb', line 5 def to_json params = {} attributes.each_pair do |k, v| next if v.blank? params[k.camelize] = v.is_a?(Array) ? v.inject([]){|mem, item| mem << item.to_json; mem} : v end params.to_json end |