ish_manager 0.1.8.278 → 0.1.8.282

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: 1ea88d9378fd171766a3dfd996a631f5a92d28880018fcc52bca01aed7d7d2b2
4
- data.tar.gz: f4ae443eb6d4ff99e7242b11205121fa93111db2e3666602e227480a3156844a
3
+ metadata.gz: 62ac19ed592915fa7a6434a0a61ee2b9efa4d1cd988ac354391abe13e061138f
4
+ data.tar.gz: 44beb8d38194b1615c5d2d40168ac1acb8d2eccd53034f5652e3a425caecf7a8
5
5
  SHA512:
6
- metadata.gz: 487c21d056637ed963ca9bf71e11540fb083eb528a78c477ccaa718e0c5acf3c40b23e229d5c2668a62dc4403151de0447523facfb76c83a670c2a5e3d22aa99
7
- data.tar.gz: 779c28a83610c15f69cb44111258d27ecb6200e338f5c20cd95471b7c37805bb25121b2a3e5b00f8846ed3153793a5f02f8d5283894ae58152ccfa2dbab4bd63
6
+ metadata.gz: a946c5fd3c36b6156b323015e647ced9570b22ea41962133db97a7d01bc8887784e78d06f542750714c7a8fee04fafbc239f465bcc0d253e88bd5ccaf168d5c5
7
+ data.tar.gz: 8467f4cbb960f3d1eba742d834660a73eb7817486ab5fd98389276f22f945c66cb3653888b646c68b7ecbc173c14ba47cf829566eb36a0bc5d81ed9e40dd4053
@@ -58,23 +58,6 @@ ul:not(.browser-default).bullets, {
58
58
  }
59
59
 
60
60
 
61
- .flat-row {
62
- display: flex;
63
- flex-direction: row;
64
- justify-content: flex-start;
65
- align-content: flex-start;
66
-
67
- height: 2.4em;
68
- line-height: 3em;
69
-
70
- width: 100%;
71
- margin: 1em 0 0 0;
72
- padding: 0;
73
-
74
- > * {
75
- padding-right: 1em;
76
- }
77
- }
78
61
 
79
62
 
80
63
  /* A */
@@ -130,9 +113,28 @@ ul:not(.browser-default).bullets, {
130
113
  /* E */
131
114
  /* F */
132
115
 
116
+ .flat-row {
117
+ display: flex;
118
+ flex-direction: row;
119
+ justify-content: flex-start;
120
+ align-content: flex-start;
121
+
122
+ height: 2.4em;
123
+ line-height: 3em;
124
+
125
+ width: 100%;
126
+ margin: 1em 0 0 0;
127
+ padding: 0;
128
+
129
+ > * {
130
+ padding-right: 1em;
131
+ }
132
+ }
133
+
134
+
133
135
  .flex-row {
134
136
  display: flex;
135
- flex-wrap: wrap;
137
+ flex-wrap: wrap; /* @TODO: why does it wrap? in ish_manager/show , I'd prefer it didn't. */
136
138
  }
137
139
 
138
140
  .float-left {
@@ -172,14 +174,6 @@ textarea.large {
172
174
 
173
175
  /* M */
174
176
 
175
- .menu-secondary li {
176
- display: inline;
177
- }
178
- .menu-secondary li a {
179
- padding: 1rem;
180
- background: white;
181
- }
182
-
183
177
 
184
178
  .manager--main-header {
185
179
  background: url('/assets/bg/weather.png');
@@ -217,6 +211,16 @@ textarea.large {
217
211
  border-bottom: 1px solid red;
218
212
  }
219
213
 
214
+ .menu-secondary li {
215
+ display: inline;
216
+ }
217
+ .menu-secondary li a {
218
+ padding: 1rem;
219
+ background: white;
220
+ }
221
+ .meta-edit {
222
+ display: inline;
223
+ }
220
224
 
221
225
  /* P */
222
226
  .panel-content {
@@ -1 +1,26 @@
1
1
 
2
+ .ish_manager-videos-show {
3
+ border-bottom: 2px solid red;
4
+ margin: 0 auto;
5
+ padding-bottom: .8em;
6
+ width: 640px;
7
+
8
+
9
+ .title {
10
+ font-size: 1.4em;
11
+ margin-left: .2em;
12
+ }
13
+
14
+ .row {
15
+ display: flex;
16
+ margin: 0;
17
+
18
+ img {
19
+ margin-right: .8em;
20
+ width: 100px;
21
+ height: 100px;
22
+ }
23
+ }
24
+
25
+
26
+ }
@@ -0,0 +1,60 @@
1
+
2
+ class IshManager::OptionWatchesController < IshManager::ApplicationController
3
+
4
+ layout 'ish_manager/application2'
5
+
6
+ ## alphabetized : )
7
+
8
+ def create
9
+ @option_watch = Warbler::OptionWatch.new permitted_params
10
+ authorize! :create, @option_watch
11
+ flag = @option_watch.save
12
+ if flag
13
+ flash[:notice] = 'Created option watch.'
14
+ else
15
+ flash[:alert] = "Cannot create option watch: #{@option_watch.errors.messages}"
16
+ end
17
+ redirect_to controller: 'stock_watches', action: 'index'
18
+ end
19
+
20
+ def destroy
21
+ @w = Warbler::StockWatch.find params[:id]
22
+ authorize! :destroy, @w
23
+ flag = @w.destroy
24
+ if flag
25
+ flash[:notice] = 'Success.'
26
+ else
27
+ flash[:alert] = @w.errors.messages
28
+ end
29
+ redirect_to controller: 'stock_watches', action: 'index'
30
+ end
31
+
32
+ def index
33
+ authorize! :open_permission, IshManager::Ability
34
+ flash[:notice] = 'Redirected option->stock watch index'
35
+ # redirect_to controller: IshManager::StockWatchesController, action: 'index'
36
+ redirect_to controller: 'stock_watches', action: 'index'
37
+ end
38
+
39
+ def update
40
+ @option_watch = Warbler::OptionWatch.find params[:id]
41
+ authorize! :update, @option_watch
42
+ flag = @option_watch.update_attributes permitted_params
43
+ if flag
44
+ flash[:notice] = 'Updated option watch.'
45
+ else
46
+ flash[:alert] = "Cannot update option watch: #{@option_watch.errors.messages}"
47
+ end
48
+ redirect_to controller: 'stock_watches', action: 'index'
49
+ end
50
+
51
+ private
52
+
53
+ def permitted_params
54
+ params[:warbler_option_watch].permit!
55
+ end
56
+
57
+ end
58
+
59
+
60
+
@@ -3,6 +3,8 @@ class IshManager::StockWatchesController < IshManager::ApplicationController
3
3
 
4
4
  layout 'ish_manager/application2'
5
5
 
6
+ ## alphabetized : )
7
+
6
8
  def create
7
9
  @stock_watch = Warbler::StockWatch.new permitted_params
8
10
  authorize! :create, @stock_watch
@@ -33,6 +35,8 @@ class IshManager::StockWatchesController < IshManager::ApplicationController
33
35
  @stock_watches = Warbler::StockWatch.order_by( ticker: :asc, direction: :asc, price: :desc
34
36
  ).includes( :profile )
35
37
  @stock_watch = Warbler::StockWatch.new
38
+ @option_watches = Warbler::OptionWatch.order_by( ticker: :asc, direction: :asc, price: :desc ).includes( :profile )
39
+ @option_watch = Warbler::OptionWatch.new
36
40
  end
37
41
 
38
42
  def update
@@ -34,7 +34,7 @@ class IshManager::VideosController < IshManager::ApplicationController
34
34
  def destroy
35
35
  @video = Video.unscoped.find params[:id]
36
36
  authorize! :destroy, @video
37
- flag = @video.update_attributes( :is_trash => true )
37
+ flag = @video.delete
38
38
  @video.city.touch if @video.city
39
39
  @video.site.touch if @video.site
40
40
  @video.tags.map &:touch
@@ -91,7 +91,7 @@ class IshManager::VideosController < IshManager::ApplicationController
91
91
  end
92
92
 
93
93
  def show
94
- @video = Video.where( :youtube_id => params[:youtube_id] ).first
94
+ @video = Video.unscoped.where( :youtube_id => params[:youtube_id] ).first
95
95
  @video ||= Video.unscoped.find params[:id]
96
96
  authorize! :show, @video
97
97
 
@@ -7,7 +7,7 @@ class IshManager::Ability
7
7
  #
8
8
  # signed in user
9
9
  #
10
- unless user.blank?
10
+ if !user.blank?
11
11
 
12
12
  #
13
13
  # only sudoer... total power
@@ -100,6 +100,8 @@ class IshManager::Ability
100
100
  #
101
101
  user ||= ::User.new
102
102
 
103
+ can [ :open_permission ], IshManager::Ability
104
+
103
105
  can [ :show ], ::Gallery do |gallery|
104
106
  gallery.is_public
105
107
  end
@@ -0,0 +1,37 @@
1
+
2
+ - if option_watch.persisted?
3
+ .float-left= button_to '[X]', option_watch_path(option_watch.id), method: :delete, data: { confirm: 'Are you sure?' }
4
+
5
+
6
+ - url = option_watches_path if !option_watch.persisted?
7
+ - url = option_watch_path( option_watch ) if option_watch.persisted?
8
+
9
+ = form_for option_watch, :url => url, :html => { :class => 'form-inline well' } do |f|
10
+ .flex-row
11
+ .form-group
12
+ = f.label :action
13
+ = f.select :action, options_for_select( Warbler::StockWatch::ACTIONS.map{|a|[a,a]}, :selected => option_watch.action )
14
+ .form-group
15
+ = f.label :profile
16
+ = f.select :profile, options_for_select( [[nil,nil]]+@profiles.map{|p|[p.email,p.id]}, :selected => option_watch.profile ? option_watch.profile.id : nil )
17
+ .form-group
18
+ %label.control-label When
19
+ = f.text_field :ticker, :class => 'form-control', :placeholder => 'ticker'
20
+ .form-group
21
+ %label.control-label Type
22
+ = f.select :contractType, options_for_select( [['none',nil],['PUT', 'PUT'], ['CALL', 'CALL']], :selected => option_watch.contractType )
23
+ .form-group
24
+ %label.control-label On date
25
+ = f.text_field :date, :class => 'form-control', :placeholder => 'date'
26
+ .form-group
27
+ %label.control-label Strike
28
+ = f.number_field :strike, :step => 0.01, :placeholder => "0.01"
29
+ .form-group
30
+ %label.control-label Is
31
+ = f.select :direction, options_for_select( Warbler::StockWatch::DIRECTIONS.map{|d|[d,d]}, :selected => option_watch.direction )
32
+ .form-group
33
+ %label.control-label Price
34
+ = f.number_field :price, :step => 0.01, :placeholder => "0.01"
35
+ .form-group
36
+ = f.submit ">", :class => %w(btn blue)
37
+
@@ -1,10 +1,24 @@
1
1
 
2
2
  %h4 Stock Watches
3
3
 
4
- %hr
5
4
  - @stock_watches.each do |stock|
5
+ %hr
6
6
  = render 'form', :stock_watch => stock
7
-
7
+
8
8
  %hr
9
9
  %h5 New
10
10
  = render 'form', :stock_watch => @stock_watch
11
+
12
+
13
+ %hr
14
+ %hr
15
+
16
+ %h4 Option Watches
17
+
18
+ - @option_watches.each do |option|
19
+ %hr
20
+ = render 'ish_manager/option_watches/form', option_watch: option
21
+
22
+ %hr
23
+ %h5 New
24
+ = render 'ish_manager/option_watches/form', option_watch: @option_watch
@@ -0,0 +1,5 @@
1
+
2
+ - if !video.youtube_id.blank?
3
+ = render 'embed_youtube', video: video
4
+ - else
5
+ = render 'embed_s3', video: video
@@ -0,0 +1,6 @@
1
+
2
+ <div class="" style="" >
3
+ <!-- <iframe width="430" height="322" src="<%= video.video.url %>" frameborder="0" allowfullscreen></iframe> -->
4
+ <iframe width="640" height="480" src="<%= video.video.url %>" frameborder="0" allowfullscreen></iframe>
5
+ <!-- <iframe src="<%= video.video.url %>" frameborder="0" allowfullscreen></iframe> -->
6
+ </div>
@@ -23,9 +23,8 @@
23
23
  .thumb= image_tag video.thumb.url(:thumb)
24
24
  .a
25
25
  = link_to video.name, video_path( video )
26
- .inline= button_to '[x]', video_path( video ), :method => :delete, :data => { :confirm => 'Are you sure?' }
27
- = link_to '[~]', edit_video_path( video )
28
- = render 'meta', :item => video
26
+ = render 'meta_edit', item: video
27
+ = render 'meta', item: video
29
28
  .c
30
29
 
31
30
  = paginate videos, :param_name => :videos_page, :views_prefix => 'ish_manager'
@@ -0,0 +1,4 @@
1
+
2
+ .meta-edit
3
+ .inline= button_to '[x]', video_path( item ), :method => :delete, :data => { :confirm => 'Are you sure?' }
4
+ = link_to '[~]', edit_video_path( item )
@@ -2,19 +2,18 @@
2
2
  - content_for :title do
3
3
  #{@video.name} | #{@site ? @site.title : ''}
4
4
 
5
- .row
6
- .large-12.columns
5
+ .ish_manager-videos-show
6
+ = link_to '[Back]', videos_path
7
7
 
8
- %h3
9
- - if @video.name.blank?
10
- = t('videos.no_title')
11
- - else
12
- = @video.name
13
- = render 'ish_manager/application/meta', :item => @video
14
- .text-center= render 'embed', :video => @video
15
- %hr
16
- = link_to @video.video.url, @video.video.url
8
+ = render 'embed', :video => @video
9
+
10
+ .row
11
+ = image_tag @video.thumb.url(:thumb)
12
+ .a
13
+ .title
14
+ = @video.name.blank? ? t('videos.no_title') : @video.name
15
+ .flex-row
16
+ = render 'meta_edit', item: @video
17
+ = render 'ish_manager/application/meta', :item => @video
18
+ = link_to @video.video_file_name, @video.video.url
17
19
 
18
- %p <b>User Profile:</b> #{@video.user_profile.name}
19
- %p= image_tag @video.thumb.url(:thumb)
20
- %p <b>Video:</b> #{@video.inspect}
data/config/routes.rb CHANGED
@@ -82,6 +82,7 @@ IshManager::Engine.routes.draw do
82
82
  # resources :stock_actions
83
83
  # resources :stock_options
84
84
  resources :stock_watches
85
+ resources :option_watches
85
86
 
86
87
  resources :tags do
87
88
  resources :features
@@ -4,10 +4,6 @@ def puts! a, b=''
4
4
  puts a.inspect
5
5
  end
6
6
 
7
- class Warbler::StockWatch
8
- SLEEP_TIME_SECONDS = 60
9
- end
10
-
11
7
  namespace :ish_manager do
12
8
 
13
9
  desc "every user needs a user_profile"
@@ -27,9 +23,6 @@ namespace :ish_manager do
27
23
  while true
28
24
  stocks = Warbler::StockWatch.where( notification_type: :EMAIL )
29
25
  stocks.each do |stock|
30
-
31
- puts! stock, 'stock'
32
-
33
26
  begin
34
27
  Timeout::timeout( 10 ) do
35
28
  out = Warbler::Ameritrade::Api.get_quote({ symbol: stock.ticker })
@@ -40,7 +33,7 @@ namespace :ish_manager do
40
33
  end
41
34
  end
42
35
  rescue Exception => e
43
- puts! e, 'e in :watch_stocks'
36
+ puts! e, 'Error in ish_manager:watch_stocks :'
44
37
  end
45
38
  end
46
39
  sleep Warbler::StockWatch::SLEEP_TIME_SECONDS
@@ -0,0 +1,55 @@
1
+
2
+ def puts! a, b=''
3
+ puts "+++ +++ #{b}:"
4
+ pp a
5
+ end
6
+
7
+ namespace :warbler do
8
+
9
+ ## @TODO: this is still in ish_manager namespace, need to actually move it here.
10
+ desc 'watch the stocks, and trigger actions - not alphavantage, tda now. 2021-08-08'
11
+ task watch_stocks: :environment do
12
+ while true
13
+ stocks = Warbler::StockWatch.where( notification_type: :EMAIL )
14
+ stocks.each do |stock|
15
+ begin
16
+ Timeout::timeout( 10 ) do
17
+ out = Warbler::Ameritrade::Api.get_quote({ symbol: stock.ticker })
18
+ r = out[:lastPrice]
19
+ if stock.direction == :ABOVE && r >= stock.price ||
20
+ stock.direction == :BELOW && r <= stock.price
21
+ IshManager::ApplicationMailer.stock_alert( stock ).deliver
22
+ end
23
+ end
24
+ rescue Exception => e
25
+ puts! e, 'Error in ish_manager:watch_stocks :'
26
+ end
27
+ end
28
+ sleep Warbler::StockWatch::SLEEP_TIME_SECONDS
29
+ end
30
+ end
31
+
32
+ desc 'watch option: contractType=PUT|CALL strike symbol date=yyyy-mm-dd'
33
+ task watch_options: :environment do
34
+ while true
35
+ option_watches = Warbler::OptionWatch.where( notification_type: :EMAIL )
36
+ option_watches.each do |option|
37
+ begin
38
+ Timeout::timeout( 10 ) do
39
+ ## opts = { contractType: 'PUT', strike: 355.0, symbol: 'NVDA', date: '2022-02-18' }
40
+ out = Warbler::Ameritrade::Api.get_option( option )
41
+ r = out[:last]
42
+ if option.direction == :ABOVE && r >= option.price ||
43
+ option.direction == :BELOW && r <= option.price
44
+ Warbler::ApplicationMailer.option_alert( option ).deliver
45
+ end
46
+ end
47
+ rescue Exception => e
48
+ puts! e, 'Error in ish_manager:watch_options :'
49
+ end
50
+ end
51
+ sleep Warbler::OptionWatch::SLEEP_TIME_SECONDS
52
+ end
53
+ end
54
+
55
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ish_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8.278
4
+ version: 0.1.8.282
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-20 00:00:00.000000000 Z
11
+ date: 2022-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -202,6 +202,7 @@ files:
202
202
  - app/controllers/ish_manager/maps_controller.rb
203
203
  - app/controllers/ish_manager/markers_controller.rb
204
204
  - app/controllers/ish_manager/newsitems_controller.rb
205
+ - app/controllers/ish_manager/option_watches_controller.rb
205
206
  - app/controllers/ish_manager/orders_controller.rb
206
207
  - app/controllers/ish_manager/payments_controller.rb
207
208
  - app/controllers/ish_manager/photos_controller.rb
@@ -305,6 +306,7 @@ files:
305
306
  - app/views/ish_manager/newsitems/edit.haml
306
307
  - app/views/ish_manager/newsitems/index.haml
307
308
  - app/views/ish_manager/newsitems/new.haml
309
+ - app/views/ish_manager/option_watches/_form.haml
308
310
  - app/views/ish_manager/payments/index.haml
309
311
  - app/views/ish_manager/photos/_meta.haml
310
312
  - app/views/ish_manager/photos/_meta_manager.haml
@@ -355,14 +357,17 @@ files:
355
357
  - app/views/ish_manager/venues/index.haml
356
358
  - app/views/ish_manager/venues/new.haml
357
359
  - app/views/ish_manager/venues/show.haml
358
- - app/views/ish_manager/videos/_embed.erb
360
+ - app/views/ish_manager/videos/_embed.haml
359
361
  - app/views/ish_manager/videos/_embed_half.erb
360
362
  - app/views/ish_manager/videos/_embed_mini.erb
363
+ - app/views/ish_manager/videos/_embed_s3.erb
364
+ - app/views/ish_manager/videos/_embed_youtube.erb
361
365
  - app/views/ish_manager/videos/_form.haml
362
366
  - app/views/ish_manager/videos/_index.haml
363
367
  - app/views/ish_manager/videos/_index_title.haml
364
368
  - app/views/ish_manager/videos/_list.haml
365
369
  - app/views/ish_manager/videos/_list_small.haml
370
+ - app/views/ish_manager/videos/_meta_edit.haml
366
371
  - app/views/ish_manager/videos/_preview.haml
367
372
  - app/views/ish_manager/videos/edit.haml
368
373
  - app/views/ish_manager/videos/index.haml
@@ -377,6 +382,7 @@ files:
377
382
  - lib/systemd/system/watch_stocks.service
378
383
  - lib/tasks/ish_manager_tasks.rake
379
384
  - lib/tasks/migrate.rake
385
+ - lib/tasks/warbler_tasks.rake
380
386
  homepage: http://wasya.co
381
387
  licenses:
382
388
  - MIT