ish_models 0.0.33.227 → 0.0.33.228

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d7b14f0b96452f68ed6ab5862cc62252d77bbb59d2609a416d74e8e4da8bc503
4
- data.tar.gz: b4b5e486087969d999f015a0df69fac64a253a66608525951e533b92449a59c9
3
+ metadata.gz: 72c17273c98a213fb3173169bf9cf80ac5679d575cf1c0eba0b52862a5a2bf60
4
+ data.tar.gz: ab4da31fe3114aba80c648b51cf58eef1a9e2f6a78649d37f99f944806596196
5
5
  SHA512:
6
- metadata.gz: 916c01143a3b402f5e21ddd4c90b70027e4a427e9ed6870cc1049b706b91b18a2ea482135c1730ec4b09d2813f7a7a90d2f6580931648ef86d005750c918644f
7
- data.tar.gz: 4d3c8b684f3a9c21365477668019a9c7f1f48e929a340aea99c408fd7d8fa043ffe7a047a7c467eda575e9d884eb1800bfea08ab503e0dd7a97305251b6b32c0
6
+ metadata.gz: b7070edc5d664690a478d7c767e742b8881b49c5670474dd5314a6cf85b44b46a2b04132bcc7e0a4de6d036c1168a62e40aecaf7c5d26d091134daf622c5b7b5
7
+ data.tar.gz: a9eb167806f67e420a6638a1d951a851dc10b22f4975b450bc7b42c015981e2c0d160f9dc47f7830d85e35f088a6d4bb5acd573610e807a59b2c7cd2eee3dadb
@@ -0,0 +1,69 @@
1
+
2
+ class Iro::OptionWatch
3
+
4
+ include Mongoid::Document
5
+ include Mongoid::Timestamps
6
+ store_in collection: 'iro_option_watches'
7
+
8
+ field :ticker # like NVDA
9
+ validates :ticker, presence: true
10
+
11
+ field :symbol # like NVDA_021822C230
12
+
13
+ KIND_OPTION = 'option'
14
+ KIND_STOCK = 'stock'
15
+ KINDS = [ KIND_OPTION, KIND_STOCK ]
16
+ field :kind, type: String
17
+ validates :kind, presence: true
18
+ def self.kinds_list
19
+ [ nil, 'option', 'stock' ]
20
+ end
21
+
22
+ ## Strike isn't the same as price!
23
+ field :strike, :type => Float
24
+ # validates :strike, presence: true
25
+
26
+ ## What is the price of the option at some strike?
27
+ field :mark, type: Float
28
+ validates :mark, presence: true
29
+
30
+ field :contractType
31
+ # validates :contractType, presence: true
32
+
33
+ field :expirationDate
34
+ # validates :expirationDate, presence: true
35
+
36
+ NOTIFICATION_TYPES = [ :NONE, :EMAIL, :SMS ]
37
+ ACTIONS = NOTIFICATION_TYPES
38
+ NOTIFICATION_NONE = :NONE
39
+ NOTIFICATION_EMAIL = :EMAIL
40
+ NOTIFICATION_SMS = :SMS
41
+ field :notification_type, :type => Symbol, :as => :action
42
+ def self.actions_list
43
+ [nil] + ACTIONS
44
+ end
45
+
46
+ STATE_ACTIVE = 'active'
47
+ STATE_INACTIVE = 'inactive'
48
+ STATES = [ STATE_ACTIVE, STATE_INACTIVE ]
49
+ field :state, type: String, default: STATE_ACTIVE
50
+ validates :state, presence: true
51
+ scope :active, ->{ where( state: STATE_ACTIVE ) }
52
+ def self.states_list
53
+ [ nil, 'active', 'inactive' ]
54
+ end
55
+
56
+ DIRECTION_ABOVE = :ABOVE
57
+ DIRECTION_BELOW = :BELOW
58
+ DIRECTIONS = [ :ABOVE, :BELOW ]
59
+ field :direction, :type => Symbol
60
+ validates :direction, presence: true
61
+ def self.directions_list
62
+ [nil] + DIRECTIONS
63
+ end
64
+
65
+ belongs_to :profile, :class_name => 'Ish::UserProfile'
66
+ field :email
67
+ field :phone
68
+
69
+ end
@@ -17,6 +17,7 @@ class Ish::UserProfile
17
17
  validates_format_of :email,:with => /\A[^@\s]+@([^@\s]+\.)+[^@\s]+\z/
18
18
  validates_uniqueness_of :email
19
19
 
20
+
20
21
  field :name
21
22
 
22
23
  def export_fields
@@ -57,10 +58,12 @@ class Ish::UserProfile
57
58
  %w( piousbox@gmail.com victor@wasya.co ).include?( self.email )
58
59
  end
59
60
 
60
- ## manager uses it.
61
- ## @TODO: check this, this is shit. _vp_ 20170527
62
61
  def self.list
63
- out = self.all.order_by( :domain => :asc, :lang => :asc )
62
+ out = self.all
63
+ [['', nil]] + out.map { |item| [ item.email, item.id ] }
64
+ end
65
+ def self.list_lg
66
+ out = self.all
64
67
  [['', nil]] + out.map { |item| [ "#{item.email} :: #{item.name}", item.id ] }
65
68
  end
66
69
 
data/lib/ish_models.rb CHANGED
@@ -6,13 +6,12 @@ require 'kaminari/mongoid'
6
6
 
7
7
  ::S3_CREDENTIALS ||= {}
8
8
 
9
- class Gameui; end
10
-
9
+ module Gameui; end
10
+ module Iro; end
11
11
  module Ish; end
12
12
  class Ish::InputError < RuntimeError; end
13
13
 
14
- # I need this thing for permissions???
15
- class Manager; end
14
+ module Manager; end
16
15
 
17
16
  module Office; end
18
17
 
@@ -41,8 +40,7 @@ require 'gameui/asset3d'
41
40
  require 'gameui/map'
42
41
  require 'gameui/marker'
43
42
 
44
- # require 'iro/option_price_item'
45
-
43
+ require 'iro/option_watch'
46
44
 
47
45
  require 'ish/cache_key'
48
46
  require 'ish/crawler'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ish_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.33.227
4
+ version: 0.0.33.228
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
@@ -135,6 +135,7 @@ files:
135
135
  - lib/gameui/map.rb
136
136
  - lib/gameui/map_bookmark.rb
137
137
  - lib/gameui/marker.rb
138
+ - lib/iro/option_watch.rb
138
139
  - lib/ish/cache_key.rb
139
140
  - lib/ish/configuration.rb
140
141
  - lib/ish/crawler.rb