Sequel model class with automatic update

Hi,

I want to download stock prices from a website and encapsulate these inside a class. I want store the values in a database with Sequel. During each access the class needs to check the current date and update the values if necessary

In the end I want to access the date in the following way and don’t want to do any manual update calls
price = StockValues(:wkn => WKN, :date => date)

I understood how to create and access a model with Sequel. But how do I implement the updating inside the class?

create_table :stockprices do
primary_key :id
Date :date, :null=>false
String :wkn
Float :price
index :wkn
end

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs