class Opium::Schema

Attributes

class_name[R]
fields[R]

Public Class Methods

all() click to toggle source
# File lib/opium/schema.rb, line 10
def all
  http_get[:results].map {|schema| new( schema ) }.index_by(&:class_name)
end
find( model_name, options = {} ) click to toggle source
# File lib/opium/schema.rb, line 14
def find( model_name, options = {} )
  result = http_get( options.merge id: model_name )
  options[:sent_headers] ? result : new( result )
end
model_name() click to toggle source
# File lib/opium/schema.rb, line 19
def model_name
  @model_name ||= ActiveModel::Name.new( self, nil, self.name )
end
new( attributes = {} ) click to toggle source
# File lib/opium/schema.rb, line 27
def initialize( attributes = {} )
  attributes.deep_symbolize_keys.tap do |a|
    @class_name = a[:className]
    @fields = ( a[:fields] || {} ).map do |field_name, options|
      Opium::Model::Field.new( field_name, options[:type], nil, false, nil )
    end.index_by(&:name_to_ruby)
  end
end

Public Instance Methods

delete() click to toggle source
# File lib/opium/schema.rb, line 40
def delete

end
model() click to toggle source
# File lib/opium/schema.rb, line 44
def model

end
save() click to toggle source
# File lib/opium/schema.rb, line 36
def save

end