Sha256: 33575ac908f0d2677bcd8912ce16dc8222cbb2246948bef8f13c264b727c30e9

Contents?: true

Size: 768 Bytes

Versions: 4

Compression:

Stored size: 768 Bytes

Contents

class Iro::Alert
  include Mongoid::Document
  include Mongoid::Timestamps
  store_in collection: 'iro_alerts'

  SLEEP_TIME_SECONDS = Rails.env.production? ? 60 : 15

  DIRECTION_ABOVE = 'ABOVE'
  DIRECTION_BELOW = 'BELOW'
  def self.directions_list
    [ nil, DIRECTION_ABOVE, DIRECTION_BELOW ]
  end

  STATUS_ACTIVE   = 'active'
  STATUS_INACTIVE = 'inactive'
  STATUSES        = [ nil, 'active', 'inactive' ]
  field :status, default: STATUS_ACTIVE
  def self.active
    where( status: STATUS_ACTIVE )
  end

  field :class_name, default: 'Iro::Stock'
  validates :class_name, presence: true

  field :symbol
  validates :symbol, presence: true

  field :direction
  validates :direction, presence: true

  field :strike
  validates :strike, presence: true

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
iron_warbler-2.0.7.14 app/models/iro/alert.rb
iron_warbler-2.0.7.13 app/models/iro/alert.rb
iron_warbler-2.0.7.12 app/models/iro/alert.rb
iron_warbler-2.0.7.11 app/models/iro/alert.rb