ish_models 0.0.33.32 → 0.0.33.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7e747705d526fb9344bdfe6074d0c0c227db0765
4
- data.tar.gz: 0ce281f0fc5b26486647ffe524c899d8a1de7595
3
+ metadata.gz: 10dbdbbae0903bda1d2ad6e673147241b062697f
4
+ data.tar.gz: fef619a20b070aea3126912d9410aadfe2cc0f43
5
5
  SHA512:
6
- metadata.gz: 6b2264ef110897e64315e2220326a07c16bb448f6d06da84e550de96d81de877198668342504029256cd721adff0422a071f544ce83f5fbaa1a04d14480c12cd
7
- data.tar.gz: 504db5fe120651d41fda715622deb3b72c3dcf7b77526c7db8d97748184a1db3d08617cc131765fe1357f4ae27a6b538284f1f82e0c22a51a165ebb2477ec113
6
+ metadata.gz: 7c44b82bca93645e0697e42ee0a454455e4a8b6abb83d94e9df3d75bd88da05797308d458e248550b51565c92b640f029c836cfb87d762d97c812660f9fa0910
7
+ data.tar.gz: 03c2f6bd959fb2c95c236bd999ed3e2d1535595996d151cb8841038f5ddd2233a27e5c43fa61e149582ca7b41b1a47050ffd27357b7d3abe8661384d73a0e24d
@@ -0,0 +1,25 @@
1
+ require 'autoinc'
2
+
3
+ #
4
+ # Invoice - for wasya.co
5
+ # _vp_ 20171031
6
+ #
7
+ class Ish::Invoice
8
+ include Mongoid::Document
9
+ include Mongoid::Timestamps
10
+ include Mongoid::Autoinc
11
+
12
+ store_in :collection => 'ish_invoice'
13
+
14
+ belongs_to :profile, :class_name => 'IshModels::UserProfile'
15
+
16
+ field :number, :type => Integer
17
+ increments :number
18
+
19
+ field :amount, :type => Float
20
+
21
+ has_many :payments, :class_name => 'Ish::Payment'
22
+
23
+ field :description, :type => String
24
+
25
+ end
@@ -0,0 +1,13 @@
1
+
2
+ class Ish::Payment
3
+ include Mongoid::Document
4
+ include Mongoid::Timestamps
5
+
6
+ belongs_to :invoice, :class_name => 'Ish::Invoice'
7
+ belongs_to :profile, :class_name => 'IshModels::UserProfile', :optional => true
8
+
9
+ field :amount, :type => Float
10
+
11
+ end
12
+
13
+
@@ -0,0 +1,18 @@
1
+
2
+ #
3
+ # Stock action. Used to act on the existing inventory (before acting to aquire inventory)
4
+ # _vp_ 20171026
5
+ #
6
+ class Ish::StockAction
7
+ include Mongoid::Document
8
+ include Mongoid::Timestamps
9
+
10
+ store_in :collection => 'ish_stock_action'
11
+
12
+ belongs_to :profile, :class_name => 'IshModels::UserProfile'
13
+ belongs_to :stock_watch, :class_name => 'Ish::StockWatch'
14
+ has_many :stock_options, :class_name => 'Ish::StockOption'
15
+
16
+ field :is_active, :type => Boolean, :default => true # whether anything will be done upon alert trigger
17
+
18
+ end
@@ -0,0 +1,29 @@
1
+
2
+ #
3
+ # Stock Option. Owned by a person. This is a position that is held (or historical data).
4
+ # _vp_ 20171026
5
+ #
6
+ class Ish::StockOption
7
+ include Mongoid::Document
8
+ include Mongoid::Timestamps
9
+
10
+ store_in :collection => 'ish_stock_option'
11
+
12
+ field :ticker
13
+ field :expires_on, :type => Date
14
+ field :strike, :type => Float
15
+
16
+ DIRECTIONS = [ :CALL, :PUT ]
17
+ field :direction, :type => Symbol
18
+
19
+ field :quantity, :type => Integer
20
+ field :is_active, :type => Integer, :default => true # whether this position is current or in the past
21
+
22
+ belongs_to :profile, :class_name => 'IshModels::UserProfile'
23
+ belongs_to :stock_action, :class_name => 'Ish::StockAction', :optional => true
24
+
25
+ def to_s
26
+ "#{self.ticker} #{self.expires_on.to_time.strftime('%b %d %Y')} #{self.strike} (x #{self.quantity})"
27
+ end
28
+
29
+ end
@@ -0,0 +1,33 @@
1
+
2
+ #
3
+ # This is not used... not worth the time to change. Use IshModels::StockWatch instead
4
+ # _vp_ 20171026
5
+ #
6
+ class Ish::StockWatch
7
+ include Mongoid::Document
8
+ include Mongoid::Timestamps
9
+
10
+ store_in :collection => 'ish_stock_watch'
11
+
12
+ field :ticker
13
+
14
+ NOTIFICATION_TYPES = [ :NONE, :EMAIL, :SMS ]
15
+ NOTIFICATION_NONE = :NONE
16
+ NOTIFICATION_EMAIL = :EMAIL
17
+ NOTIFICATION_SMS = :SMS
18
+ ACTIONS = NOTIFICATION_TYPES
19
+ field :notification_type, :type => Symbol, :as => :action
20
+ field :price, :type => Float
21
+
22
+ DIRECTIONS = [ :ABOVE, :BELOW ]
23
+ DIRECTION_ABOVE = :ABOVE
24
+ DIRECTION_BELOW = :BELOW
25
+ field :direction, :type => Symbol
26
+
27
+ belongs_to :profile, :class_name => 'IshModels::UserProfile'
28
+
29
+ def to_s
30
+ "#{self.ticker} #{self.direction} #{self.price}"
31
+ end
32
+
33
+ end
@@ -32,7 +32,7 @@ class IshModels::UserProfile
32
32
  has_many :videos
33
33
  has_many :photos
34
34
 
35
- has_many :stocks, :class_name => 'IshModels::StockWatch'
35
+ has_many :stocks, :class_name => 'Ish::StockWatch'
36
36
 
37
37
  #
38
38
  # preferences
data/lib/ish_models.rb CHANGED
@@ -18,10 +18,14 @@ module IshModels
18
18
  end
19
19
 
20
20
  require 'ish/gallery_name.rb'
21
+ require 'ish/payment.rb'
22
+ require 'ish/stock_action.rb'
23
+ require 'ish/stock_option.rb'
24
+ require 'ish/stock_watch.rb'
25
+ require 'ish/invoice.rb'
21
26
 
27
+ # obsolete, use `ish` namespace now
22
28
  require 'ish_models/cache_key.rb'
23
- # require 'ish_models/user.rb'
24
- require 'ish_models/stock_watch.rb'
25
29
  require 'ish_models/user_profile.rb'
26
30
 
27
31
  require 'app_model2.rb'
data/lib/site.rb CHANGED
@@ -15,14 +15,13 @@ class Site
15
15
 
16
16
  field :n_features, :type => Integer, :default => 4
17
17
  field :n_newsitems, :type => Integer, :default => 20
18
+ field :newsitems_per_page, :type => Integer, :default => 10 # this is used. _vp_ 20171025
18
19
  field :play_videos_in_preview, :type => Boolean, :default => true
19
20
 
20
21
  # denormalized
21
22
  field :n_reports, :type => Integer
22
23
  field :n_galleries, :type => Integer
23
24
 
24
- field :newsitems_per_page, :type => Integer, :default => 10
25
-
26
25
  field :is_video_enabled, :type => Boolean, :default => false
27
26
  field :is_resume_enabled, :type => Boolean, :default => false
28
27
  field :is_ads_enabled, :type => Boolean, :default => true
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.32
4
+ version: 0.0.33.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
@@ -44,6 +44,20 @@ dependencies:
44
44
  - - ">"
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: mongoid-autoinc
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '6.0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '6.0'
47
61
  description: models of ish
48
62
  email: victor@wasya.co
49
63
  executables: []
@@ -62,6 +76,11 @@ files:
62
76
  - lib/gallery.rb
63
77
  - lib/gallery2.rb
64
78
  - lib/ish/gallery_name.rb
79
+ - lib/ish/invoice.rb
80
+ - lib/ish/payment.rb
81
+ - lib/ish/stock_action.rb
82
+ - lib/ish/stock_option.rb
83
+ - lib/ish/stock_watch.rb
65
84
  - lib/ish_models.rb
66
85
  - lib/ish_models.rb~
67
86
  - lib/ish_models/cache_key.rb