class Ant::Server::Nanoservice::Datasource::Model

Attributes

data[RW]
repository[W]

Public Class Methods

new(data) click to toggle source
# File lib/ant/server/nanoservice/datasource/model.rb, line 24
def initialize(data)
  @data = data
end

Public Instance Methods

create() click to toggle source
# File lib/ant/server/nanoservice/datasource/model.rb, line 19
def create
  run_validations!
  @repository.create(@data)
end
run_validations!() click to toggle source
# File lib/ant/server/nanoservice/datasource/model.rb, line 10
def run_validations!
  puts 'WARN: model with no validations'
end
store() click to toggle source
# File lib/ant/server/nanoservice/datasource/model.rb, line 14
def store
  run_validations!
  @repository.store(@data)
end
to_json(options) click to toggle source
# File lib/ant/server/nanoservice/datasource/model.rb, line 30
def to_json(options)
  @data.to_json(options)
end