Module: Finexclub::Document::InstanceMethods

Defined in:
lib/finexclub/document.rb

Instance Method Summary collapse

Instance Method Details

#apply_meta(meta) ⇒ Object



112
113
114
115
116
# File 'lib/finexclub/document.rb', line 112

def apply_meta(meta)
  meta.each do |name, field_type|
    self.class.field(name, field_type)
  end
end

#build(params) ⇒ Object



118
119
120
121
122
# File 'lib/finexclub/document.rb', line 118

def build(params)
  params.each do |key, value|
    send "#{key}=", value
  end
end

#to_docObject



124
125
126
127
128
# File 'lib/finexclub/document.rb', line 124

def to_doc
  doc = {}
  self.class.export_fields.each { |name| doc[name] = send(name) }
  doc
end