Sha256: 9392d0f8892d1f8a2ae09c9d187ed2173ce1b949567d012d481364cc1be1373f
Contents?: true
Size: 990 Bytes
Versions: 2
Compression:
Stored size: 990 Bytes
Contents
module Zoro class Record attr_reader :zoho_module, :fields def initialize(zoho_module= self.class.name) @zoho_module = zoho_module @fields = {} end def api=(api) @api = api end def api @api ||= Zoro::Api.new end def save! api.insert_records(self) end def to_xml xml_map = Hash.new xml_map['row'] = { 'no' => '1', 'FL' => @fields.map do |k, v| { 'val' => k, 'content' => v} end } XmlSimple.xml_out(xml_map, :RootName => @zoho_module) end def method_missing(name, *args, &block) property_name = Zoro::FieldName.make_field(name.to_s) assignment = name.to_s.match(/=/) if assignment set_field property_name, args[0] else get_field property_name end end protected def set_field(name, value) @fields[name] = value end def get_field(name) @fields[name] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
zoro-0.0.3 | lib/zoro/record.rb |
zoro-0.0.2 | lib/zoro/record.rb |