ish_models 0.0.33.137 → 0.0.33.141
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/city.rb +3 -3
- data/lib/co_tailors/README.txt +2 -0
- data/lib/co_tailors/address.rb +1 -1
- data/lib/co_tailors/order.rb +1 -1
- data/lib/co_tailors/profile_measurement.rb +1 -1
- data/lib/country.rb +1 -1
- data/lib/gallery.rb +7 -11
- data/lib/gameui/map.rb +18 -1
- data/lib/gameui/map_bookmark.rb +1 -1
- data/lib/gameui/marker.rb +11 -2
- data/lib/gameui/premium_purchase.rb +1 -1
- data/lib/{app_model2.rb → ish/app_model2.rb} +3 -8
- data/lib/ish/cache_key.rb +14 -0
- data/lib/ish/campaign.rb +1 -1
- data/lib/{ish_models → ish}/configuration.rb +1 -1
- data/lib/ish/gallery_name.rb +1 -0
- data/lib/ish/lead.rb +3 -3
- data/lib/ish/nonpublic.rb +13 -0
- data/lib/ish/payment.rb +1 -1
- data/lib/ish/premium_item.rb +14 -0
- data/lib/ish/railtie.rb +8 -0
- data/lib/{ish_models → ish}/user_profile.rb +18 -29
- data/lib/ish/utils.rb +5 -1
- data/lib/ish_models.rb +54 -61
- data/lib/newsitem.rb +1 -1
- data/lib/photo.rb +2 -2
- data/lib/report.rb +4 -3
- data/lib/video.rb +1 -1
- data/lib/{ish → warbler}/alphavantage_stockwatcher.rb +0 -0
- data/lib/{ish → warbler}/ameritrade.rb +5 -18
- data/lib/{ish → warbler}/covered_call.rb +0 -0
- data/lib/{ish → warbler}/covered_call_watcher.rb +0 -0
- data/lib/{ish → warbler}/iron_condor.rb +0 -0
- data/lib/{ish → warbler}/iron_condor_watcher.rb +0 -0
- data/lib/{ish → warbler}/stock_action.rb +1 -1
- data/lib/{ish → warbler}/stock_option.rb +1 -1
- data/lib/{ish_models → warbler}/stock_watch.rb +2 -15
- data/lib/{ish → warbler}/yahoo_stockwatcher.rb +0 -0
- metadata +19 -21
- data/lib/co_tailors.rb +0 -3
- data/lib/gameui.rb +0 -2
- data/lib/ish/stock_watch.rb +0 -33
- data/lib/ish_models/cache_key.rb +0 -14
- data/lib/ish_models/railtie.rb +0 -18
- data/lib/manager.rb +0 -7
- data/lib/public_item.rb +0 -60
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a63c954511cab021c7cef772ae4ad322b1bb61c790aa7c7ebe14f7efcf793f5
|
4
|
+
data.tar.gz: 8da5fe1bec8a68cc7ddddc95723a9b024233ab234257dd3a5af697978eff8bdb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c3960a977b88f7920f2ee65c95c04656f61e0c640bca650912f72dbdc3f00062a0ca37ff92fe2c576d1b3a5715d40bc561ce6d1c822165e356fa5219e2b2866
|
7
|
+
data.tar.gz: 5c44ffd813468049999ae2791ad1c2b30f413c1ff6539dce722add499f6275041bf38bc2cb402d630d20d93f39b0e82474444c45bf5aaed60d971e0e061b441a
|
data/lib/city.rb
CHANGED
@@ -29,12 +29,12 @@ class City
|
|
29
29
|
has_many :videos
|
30
30
|
has_and_belongs_to_many :tags
|
31
31
|
|
32
|
-
has_many :current_users, :class_name => '::
|
32
|
+
has_many :current_users, :class_name => '::Ish::UserProfile', :inverse_of => :current_city
|
33
33
|
has_many :newsitems
|
34
34
|
|
35
|
-
has_many :current_users, :class_name => '::
|
35
|
+
has_many :current_users, :class_name => '::Ish::UserProfile', :inverse_of => :current_city
|
36
36
|
has_one :profile_photo, :class_name => 'Photo', :inverse_of => :profile_city
|
37
|
-
has_one :guide, :class_name => '::
|
37
|
+
has_one :guide, :class_name => '::Ish::UserProfile', :inverse_of => :guide_city
|
38
38
|
|
39
39
|
has_many :features
|
40
40
|
|
data/lib/co_tailors/address.rb
CHANGED
data/lib/co_tailors/order.rb
CHANGED
@@ -4,7 +4,7 @@ class CoTailors::Order
|
|
4
4
|
include Mongoid::Document
|
5
5
|
include Mongoid::Timestamps
|
6
6
|
|
7
|
-
belongs_to :profile, :class_name => '::
|
7
|
+
belongs_to :profile, :class_name => '::Ish::UserProfile'
|
8
8
|
|
9
9
|
has_many :items, :class_name => '::CoTailors::OrderItem'
|
10
10
|
|
@@ -8,7 +8,7 @@ class CoTailors::ProfileMeasurement
|
|
8
8
|
UNITS_CENTIMETERS = :centimeters
|
9
9
|
field :units, :type => Symbol
|
10
10
|
|
11
|
-
belongs_to :profile, :class_name => '
|
11
|
+
belongs_to :profile, :class_name => 'Ish::UserProfile', :optional => true
|
12
12
|
belongs_to :order_item, :class_name => 'CoTailors::OrderItem', :optional => true
|
13
13
|
|
14
14
|
## shirt
|
data/lib/country.rb
CHANGED
data/lib/gallery.rb
CHANGED
@@ -11,6 +11,8 @@ class Gallery
|
|
11
11
|
validates :name, :uniqueness => true # , :allow_nil => false
|
12
12
|
|
13
13
|
field :is_public, type: Boolean, default: false
|
14
|
+
has_and_belongs_to_many :shared_profiles, :class_name => 'Ish::UserProfile', :inverse_of => :shared_galleries
|
15
|
+
|
14
16
|
field :is_trash, type: Boolean, default: false
|
15
17
|
field :is_done, type: Boolean, default: false
|
16
18
|
|
@@ -25,20 +27,16 @@ class Gallery
|
|
25
27
|
|
26
28
|
field :x, :type => Float
|
27
29
|
field :y, :type => Float
|
28
|
-
field :subhead
|
29
|
-
field :descr, :
|
30
|
-
field :lang, :
|
30
|
+
field :subhead
|
31
|
+
field :descr, :as => :description
|
32
|
+
field :lang, :default => 'en'
|
31
33
|
field :issue
|
32
34
|
field :username
|
33
35
|
|
34
|
-
## @TODO: this is still not autogenerated
|
35
36
|
field :slug
|
36
37
|
index({ :slug => -1 }, { :unique => true })
|
37
38
|
validates :slug, presence: true, uniqueness: true
|
38
|
-
|
39
|
-
## @TODO: I should have a redirect service, instead of this specific thing. But only after making $50.
|
40
|
-
# embeds_many :gallery_names, :class_name => '::Ish::GalleryName'
|
41
|
-
|
39
|
+
before_validation :set_slug, :on => :create
|
42
40
|
|
43
41
|
def self.list conditions = { :is_trash => false }
|
44
42
|
out = self.unscoped.where( conditions ).order_by( :created_at => :desc )
|
@@ -46,9 +44,8 @@ class Gallery
|
|
46
44
|
end
|
47
45
|
|
48
46
|
belongs_to :site, :optional => true
|
49
|
-
belongs_to :user_profile, :optional => true, :class_name => '
|
47
|
+
belongs_to :user_profile, :optional => true, :class_name => 'Ish::UserProfile', :inverse_of => :galleries
|
50
48
|
|
51
|
-
has_and_belongs_to_many :shared_profiles, :class_name => 'IshModels::UserProfile', :inverse_of => :shared_galleries
|
52
49
|
has_and_belongs_to_many :tags
|
53
50
|
|
54
51
|
has_many :newsitems
|
@@ -56,7 +53,6 @@ class Gallery
|
|
56
53
|
|
57
54
|
belongs_to :city, :optional => true
|
58
55
|
belongs_to :venue, :optional => true
|
59
|
-
belongs_to :newsparent, polymorphic: true, optional: true
|
60
56
|
|
61
57
|
|
62
58
|
set_callback(:create, :before) do |doc|
|
data/lib/gameui/map.rb
CHANGED
@@ -1,11 +1,16 @@
|
|
1
|
+
require 'ish/premium_item'
|
1
2
|
|
2
3
|
class ::Gameui::Map
|
3
4
|
include Mongoid::Document
|
4
5
|
include Mongoid::Timestamps
|
6
|
+
include Ish::PremiumItem
|
5
7
|
|
6
8
|
has_many :markers, :class_name => '::Gameui::Marker', inverse_of: :map
|
9
|
+
|
7
10
|
has_many :newsitems, inverse_of: :map, order: :created_at.desc
|
8
11
|
|
12
|
+
field :deleted_at, type: Time, default: nil
|
13
|
+
|
9
14
|
field :slug
|
10
15
|
validates :slug, uniqueness: true, presence: true
|
11
16
|
|
@@ -14,7 +19,14 @@ class ::Gameui::Map
|
|
14
19
|
has_many :childs, class_name: '::Gameui::Map', inverse_of: :parent
|
15
20
|
has_one :image, class_name: '::Ish::ImageAsset', inverse_of: :location
|
16
21
|
|
17
|
-
has_and_belongs_to_many :bookmarked_profiles, class_name: '::
|
22
|
+
has_and_belongs_to_many :bookmarked_profiles, class_name: '::Ish::UserProfile', inverse_of: :bookmarked_location
|
23
|
+
|
24
|
+
# shareable, nonpublic
|
25
|
+
field :is_public, type: Boolean, default: true
|
26
|
+
has_and_belongs_to_many :shared_profiles, :class_name => 'Ish::UserProfile', :inverse_of => :shared_locations
|
27
|
+
default_scope ->{ where({ is_public: true, deleted_at: nil }).order_by({ slug: :desc }) }
|
28
|
+
## @TODO: index default scope, maybe instead of HABTM, use :thru for shared profiles. Make is poly anyway?
|
29
|
+
|
18
30
|
|
19
31
|
field :map_slug
|
20
32
|
def map
|
@@ -24,6 +36,9 @@ class ::Gameui::Map
|
|
24
36
|
field :name
|
25
37
|
field :description
|
26
38
|
|
39
|
+
RATED_OPTIONS = [ 'pg-13', 'r', 'nc-17' ]
|
40
|
+
field :rated, default: 'pg-13' # 'r', 'nc-17'
|
41
|
+
|
27
42
|
## Possible keys: description, map, markers, newsitems,
|
28
43
|
field :labels, type: Object, default: {}
|
29
44
|
## Possible keys:
|
@@ -69,3 +84,5 @@ class ::Gameui::Map
|
|
69
84
|
end
|
70
85
|
|
71
86
|
end
|
87
|
+
|
88
|
+
Location = ::Gameui::Map
|
data/lib/gameui/map_bookmark.rb
CHANGED
data/lib/gameui/marker.rb
CHANGED
@@ -3,9 +3,9 @@ class ::Gameui::Marker
|
|
3
3
|
include Mongoid::Document
|
4
4
|
include Mongoid::Timestamps
|
5
5
|
|
6
|
-
belongs_to :map, :class_name => '::Gameui::Map'
|
7
6
|
|
8
7
|
field :slug
|
8
|
+
## @TODO: probably remove this, no reason not to have two markers to the same slug (destination)
|
9
9
|
validates_uniqueness_of :slug, scope: :map_id
|
10
10
|
validates_presence_of :slug
|
11
11
|
|
@@ -14,6 +14,16 @@ class ::Gameui::Marker
|
|
14
14
|
has_one :image, class_name: '::Ish::ImageAsset', inverse_of: :marker_image
|
15
15
|
has_one :title_image, class_name: '::Ish::ImageAsset', inverse_of: :marker_title_image
|
16
16
|
|
17
|
+
field :deleted_at, type: Time, default: nil
|
18
|
+
|
19
|
+
# shareable, nonpublic
|
20
|
+
field :is_public, type: Boolean, default: true
|
21
|
+
has_and_belongs_to_many :shared_profiles, :class_name => 'Ish::UserProfile', :inverse_of => :shared_markers
|
22
|
+
default_scope ->{ where({ is_public: true, deleted_at: nil }).order_by({ slug: :desc }) }
|
23
|
+
## @TODO: index default scope, maybe instead of HABTM, use :thru for shared profiles. Make is poly anyway?
|
24
|
+
|
25
|
+
belongs_to :map, :class_name => '::Gameui::Map'
|
26
|
+
|
17
27
|
|
18
28
|
# @deprecated, don't use!
|
19
29
|
# _vp_ 2021-09-23
|
@@ -42,7 +52,6 @@ class ::Gameui::Marker
|
|
42
52
|
end
|
43
53
|
|
44
54
|
field :is_active, type: Boolean, default: true
|
45
|
-
field :deleted_at, type: Time, default: nil
|
46
55
|
|
47
56
|
field :name, type: String
|
48
57
|
validates :name, presence: true
|
@@ -3,7 +3,7 @@ class ::Gameui::PremiumPurchase
|
|
3
3
|
include Mongoid::Document
|
4
4
|
include Mongoid::Timestamps
|
5
5
|
|
6
|
-
belongs_to :user_profile, :class_name => '::
|
6
|
+
belongs_to :user_profile, :class_name => '::Ish::UserProfile'
|
7
7
|
belongs_to :item, polymorphic: true
|
8
8
|
|
9
9
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
|
2
|
-
|
2
|
+
# @deprecated, remove
|
3
|
+
class Ish::AppModel2
|
3
4
|
include ::Mongoid::Document
|
4
5
|
include ::Mongoid::Timestamps
|
5
6
|
|
@@ -7,7 +8,7 @@ class AppModel2
|
|
7
8
|
field :is_trash, :type => Boolean, :default => false
|
8
9
|
|
9
10
|
default_scope ->{ where({ :is_public => true, :is_trash => false }).order_by({ :created_at => :desc }) }
|
10
|
-
|
11
|
+
|
11
12
|
field :x, :type => Float
|
12
13
|
field :y, :type => Float
|
13
14
|
|
@@ -16,11 +17,5 @@ class AppModel2
|
|
16
17
|
[['', nil]] + out.map { |item| [ "#{item.created_at.strftime('%Y%m%d')} #{item.name}", item.id ] }
|
17
18
|
end
|
18
19
|
|
19
|
-
private
|
20
20
|
|
21
|
-
def puts! arg, label=""
|
22
|
-
puts "+++ +++ #{label}"
|
23
|
-
puts arg.inspect
|
24
|
-
end
|
25
|
-
|
26
21
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
class Ish::CacheKey
|
4
|
+
include ::Mongoid::Document
|
5
|
+
include ::Mongoid::Timestamps
|
6
|
+
|
7
|
+
field :cities, :type => Time # /api/cities.json
|
8
|
+
field :feature_cities, :type => Time # /api/cities/features.json
|
9
|
+
|
10
|
+
def self.one
|
11
|
+
Ish::CacheKey.first || Ish::CacheKey.new
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
data/lib/ish/campaign.rb
CHANGED
@@ -4,7 +4,7 @@ class Ish::Campaign
|
|
4
4
|
|
5
5
|
store_in :collection => 'ish_campaign'
|
6
6
|
|
7
|
-
belongs_to :profile, :class_name => '
|
7
|
+
belongs_to :profile, :class_name => 'Ish::UserProfile'
|
8
8
|
|
9
9
|
has_and_belongs_to_many :leads, :class_name => 'Ish::Lead'
|
10
10
|
has_and_belongs_to_many :unsubscribe_leads, :class_name => 'Ish::Lead'
|
data/lib/ish/gallery_name.rb
CHANGED
data/lib/ish/lead.rb
CHANGED
@@ -9,10 +9,10 @@ class Ish::Lead
|
|
9
9
|
|
10
10
|
store_in :collection => 'ish_lead'
|
11
11
|
|
12
|
-
belongs_to :profile, :class_name => '
|
12
|
+
belongs_to :profile, :class_name => '::Ish::UserProfile'
|
13
13
|
|
14
|
-
has_and_belongs_to_many :campaigns, :class_name => 'Ish::Campaign', :inverse_of => :leads
|
15
|
-
has_and_belongs_to_many :unsubscribe_campaigns, :class_name => 'Ish::Campaign', :inverse_of => :unsubscribe_leads
|
14
|
+
has_and_belongs_to_many :campaigns, :class_name => '::Ish::Campaign', :inverse_of => :leads
|
15
|
+
has_and_belongs_to_many :unsubscribe_campaigns, :class_name => '::Ish::Campaign', :inverse_of => :unsubscribe_leads
|
16
16
|
|
17
17
|
field :email
|
18
18
|
field :job_url
|
@@ -0,0 +1,13 @@
|
|
1
|
+
|
2
|
+
## THIS IS TRASH. I copy-paste repetitively instead!
|
3
|
+
|
4
|
+
## aka: Ish::Shareable
|
5
|
+
## adds is_public (default true) and #shared_profiles, inverse :shared_items ???
|
6
|
+
module Ish::Nonpublic
|
7
|
+
|
8
|
+
def self.included base
|
9
|
+
base.send :field, :is_public, type: Boolean, default: true
|
10
|
+
base.send :has_and_belongs_to_many, :shared_profiles, :class_name => 'Ish::UserProfile', :inverse_of => :shared_markers
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
data/lib/ish/payment.rb
CHANGED
@@ -3,7 +3,7 @@ class Ish::Payment
|
|
3
3
|
include Mongoid::Timestamps
|
4
4
|
|
5
5
|
belongs_to :invoice, :class_name => 'Ish::Invoice', optional: true
|
6
|
-
belongs_to :profile, :class_name => '
|
6
|
+
belongs_to :profile, :class_name => 'Ish::UserProfile' # , :optional => true
|
7
7
|
|
8
8
|
field :amount, :type => Integer # in cents
|
9
9
|
field :charge, :type => Hash
|
@@ -0,0 +1,14 @@
|
|
1
|
+
|
2
|
+
module Ish::PremiumItem
|
3
|
+
|
4
|
+
def self.included base
|
5
|
+
base.send :field, :premium_tier, type: Integer, default: 0 # how many stars need to spend, to get access? 0 = free
|
6
|
+
base.send :has_many, :premium_purchases, class_name: '::Gameui::PremiumPurchase', as: :item
|
7
|
+
end
|
8
|
+
|
9
|
+
def is_premium
|
10
|
+
premium_tier > 0
|
11
|
+
end
|
12
|
+
def premium?; is_premium; end
|
13
|
+
|
14
|
+
end
|
data/lib/ish/railtie.rb
ADDED
@@ -1,4 +1,4 @@
|
|
1
|
-
class
|
1
|
+
class Ish::UserProfile
|
2
2
|
include Mongoid::Document
|
3
3
|
include Mongoid::Timestamps
|
4
4
|
|
@@ -28,14 +28,16 @@ class IshModels::UserProfile
|
|
28
28
|
belongs_to :guide_city, :class_name => 'City', :inverse_of => :guide, :optional => true
|
29
29
|
|
30
30
|
has_many :galleries, :inverse_of => :user_profile
|
31
|
-
has_and_belongs_to_many :shared_galleries, :
|
31
|
+
has_and_belongs_to_many :shared_galleries, :inverse_of => :shared_profiles, class_name: 'Gallery'
|
32
|
+
has_and_belongs_to_many :shared_markers, :inverse_of => :shared_profiles, class_name: 'Gameui::Marker'
|
33
|
+
has_and_belongs_to_many :shared_locations, :inverse_of => :shared_profiles, class_name: 'Gameui::Map'
|
32
34
|
|
33
|
-
has_many :invoices,
|
34
|
-
has_many :leads,
|
35
|
+
has_many :invoices, :class_name => '::Ish::Invoice'
|
36
|
+
has_many :leads, :class_name => '::Ish::Lead'
|
35
37
|
has_many :photos
|
36
|
-
has_many :reports,
|
37
|
-
has_many :stocks,
|
38
|
-
has_many :videos,
|
38
|
+
has_many :reports, inverse_of: :user_profile
|
39
|
+
has_many :stocks, :class_name => '::Warbler::StockWatch'
|
40
|
+
has_many :videos, inverse_of: :user_profile
|
39
41
|
has_many :newsitems, inverse_of: :user_profile
|
40
42
|
|
41
43
|
has_and_belongs_to_many :bookmarked_locations, class_name: '::Gameui::Map', inverse_of: :bookmarked_profile
|
@@ -43,43 +45,32 @@ class IshModels::UserProfile
|
|
43
45
|
bookmarked_locations
|
44
46
|
end
|
45
47
|
|
46
|
-
has_and_belongs_to_many :friends, :class_name => '
|
47
|
-
has_and_belongs_to_many :friendeds, :class_name => '
|
48
|
+
has_and_belongs_to_many :friends, :class_name => '::Ish::UserProfile', :inverse_of => :friendeds
|
49
|
+
has_and_belongs_to_many :friendeds, :class_name => '::Ish::UserProfile', :inverse_of => :friends
|
48
50
|
|
49
51
|
field :n_unlocks, type: Integer, default: 0
|
50
52
|
def n_coins
|
51
53
|
n_unlocks
|
52
54
|
end
|
53
55
|
|
54
|
-
|
55
|
-
|
56
|
-
#
|
56
|
+
## preferences
|
57
|
+
## @TODO: better naming convention, or remove this
|
57
58
|
field :videos_embed, :type => Boolean, :default => false
|
58
59
|
|
59
60
|
def sudoer?
|
60
61
|
%w( piousbox@gmail.com victor@wasya.co ).include?( self.user.email ) ? true : false
|
61
62
|
end
|
62
63
|
|
63
|
-
|
64
|
-
|
64
|
+
## manager uses it.
|
65
|
+
## @TODO: check this, this is shit. _vp_ 20170527
|
65
66
|
def self.list
|
66
67
|
out = self.all.order_by( :domain => :asc, :lang => :asc )
|
67
68
|
[['', nil]] + out.map { |item| [ item.name, item.id ] }
|
68
69
|
end
|
69
70
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
has_one :measurement, :class_name => '::CoTailors::ProfileMeasurement'
|
74
|
-
has_many :addresses, :class_name => '::CoTailors::Address'
|
75
|
-
has_many :orders, :class_name => '::CoTailors::Order'
|
76
|
-
def current_order
|
77
|
-
self.orders.where( :submitted_at => nil ).first || CoTailors::Order.create( :profile => self )
|
78
|
-
end
|
79
|
-
|
80
|
-
#
|
81
|
-
# GameUI
|
82
|
-
#
|
71
|
+
##
|
72
|
+
## GameUI
|
73
|
+
##
|
83
74
|
field :n_stars, type: Integer, default: 0
|
84
75
|
has_many :premium_purchases, :class_name => '::Gameui::PremiumPurchase'
|
85
76
|
def has_premium_purchase item
|
@@ -90,5 +81,3 @@ class IshModels::UserProfile
|
|
90
81
|
end
|
91
82
|
|
92
83
|
end
|
93
|
-
|
94
|
-
Profile = IshModels::UserProfile
|
data/lib/ish/utils.rb
CHANGED
@@ -5,7 +5,11 @@ module Ish::Utils
|
|
5
5
|
|
6
6
|
def set_slug
|
7
7
|
return if slug
|
8
|
-
|
8
|
+
if name
|
9
|
+
new_slug = name.downcase.gsub(/[^a-z0-9\s]/i, '').gsub(' ', '-')
|
10
|
+
else
|
11
|
+
new_slug = '1'
|
12
|
+
end
|
9
13
|
if self.class.where( slug: new_slug ).first
|
10
14
|
loop do
|
11
15
|
if new_slug[new_slug.length-1].to_i != 0
|
data/lib/ish_models.rb
CHANGED
@@ -1,10 +1,15 @@
|
|
1
1
|
|
2
|
-
require '
|
3
|
-
require '
|
2
|
+
require 'ish/railtie' if defined?(Rails)
|
3
|
+
require 'ish/configuration'
|
4
4
|
|
5
5
|
::S3_CREDENTIALS ||= {}
|
6
6
|
|
7
|
+
module CoTailors; end
|
8
|
+
class Gameui; end
|
7
9
|
module Ish; end
|
10
|
+
# I need this thing for permissions#
|
11
|
+
class Manager; end
|
12
|
+
module Warbler; end
|
8
13
|
|
9
14
|
module IshModels
|
10
15
|
|
@@ -21,65 +26,53 @@ module IshModels
|
|
21
26
|
end
|
22
27
|
end
|
23
28
|
|
24
|
-
require '
|
25
|
-
require '
|
26
|
-
require '
|
27
|
-
require '
|
28
|
-
|
29
|
-
require '
|
30
|
-
|
31
|
-
require '
|
32
|
-
require '
|
33
|
-
require '
|
34
|
-
require '
|
35
|
-
require '
|
36
|
-
|
37
|
-
|
38
|
-
require 'ish/
|
39
|
-
require 'ish/
|
40
|
-
require 'ish/
|
41
|
-
require 'ish/
|
42
|
-
require 'ish/
|
43
|
-
|
44
|
-
require '
|
45
|
-
require '
|
46
|
-
require '
|
47
|
-
require '
|
48
|
-
require '
|
49
|
-
require '
|
50
|
-
require '
|
51
|
-
require '
|
52
|
-
require '
|
53
|
-
require '
|
54
|
-
require '
|
55
|
-
require '
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
require '
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
require '
|
64
|
-
require '
|
65
|
-
require '
|
66
|
-
require '
|
67
|
-
require '
|
68
|
-
require '
|
69
|
-
# require '
|
70
|
-
require '
|
71
|
-
require 'newsitem.rb'
|
72
|
-
require 'photo.rb'
|
73
|
-
require 'public_item.rb'
|
74
|
-
require 'report.rb'
|
75
|
-
require 'site.rb'
|
76
|
-
require 'tag.rb'
|
77
|
-
require 'venue.rb'
|
78
|
-
require 'video.rb'
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
29
|
+
require 'gameui/map'
|
30
|
+
require 'gameui/map_bookmark'
|
31
|
+
require 'gameui/marker'
|
32
|
+
require 'gameui/premium_purchase'
|
33
|
+
|
34
|
+
require 'ish/cache_key'
|
35
|
+
require 'ish/campaign'
|
36
|
+
require 'ish/crawler'
|
37
|
+
require 'ish/gallery_name'
|
38
|
+
require 'ish/image_asset'
|
39
|
+
require 'ish/input_error'
|
40
|
+
require 'ish/invoice'
|
41
|
+
require 'ish/issue'
|
42
|
+
require 'ish/lead'
|
43
|
+
require 'ish/nonpublic'
|
44
|
+
require 'ish/payment'
|
45
|
+
require 'ish/premium_item'
|
46
|
+
require 'ish/utils'
|
47
|
+
require 'ish/user_profile'
|
48
|
+
|
49
|
+
require 'aux_model'
|
50
|
+
require 'city'
|
51
|
+
require 'cities_user'
|
52
|
+
require 'country'
|
53
|
+
require 'event'
|
54
|
+
require 'feature'
|
55
|
+
require 'gallery'
|
56
|
+
require 'newsitem'
|
57
|
+
require 'photo'
|
58
|
+
require 'report'
|
59
|
+
require 'site'
|
60
|
+
require 'tag'
|
61
|
+
require 'venue'
|
62
|
+
require 'video'
|
63
|
+
|
64
|
+
require 'warbler/stock_watch'
|
65
|
+
require 'warbler/ameritrade'
|
66
|
+
|
67
|
+
## warbler
|
68
|
+
# require 'warbler/alphavantage_stockwatcher'
|
69
|
+
# require 'warbler/ameritrade'
|
70
|
+
# require 'warbler/covered_call'
|
71
|
+
# require 'warbler/iron_condor'
|
72
|
+
# require 'warbler/iron_condor_watcher'
|
73
|
+
# require 'warbler/stock_action'
|
74
|
+
# require 'warbler/stock_option'
|
75
|
+
# require 'warbler/yahoo_stockwatcher'
|
83
76
|
|
84
77
|
|
85
78
|
|
data/lib/newsitem.rb
CHANGED
@@ -6,7 +6,7 @@ class Newsitem
|
|
6
6
|
belongs_to :tag, :optional => true
|
7
7
|
belongs_to :city, :optional => true
|
8
8
|
belongs_to :report, :optional => true
|
9
|
-
belongs_to :user_profile, class_name: '
|
9
|
+
belongs_to :user_profile, class_name: 'Ish::UserProfile', optional: true
|
10
10
|
belongs_to :map, class_name: '::Gameui::Map', optional: true
|
11
11
|
|
12
12
|
belongs_to :gallery, :optional => true
|
data/lib/photo.rb
CHANGED
@@ -7,12 +7,12 @@ class Photo
|
|
7
7
|
|
8
8
|
has_and_belongs_to_many :viewers, :class_name => 'User', :inverse_of => :viewable_photos
|
9
9
|
|
10
|
-
belongs_to :user_profile, :class_name => '
|
10
|
+
belongs_to :user_profile, :class_name => 'Ish::UserProfile', :optional => true
|
11
11
|
def user
|
12
12
|
user_profile
|
13
13
|
end
|
14
14
|
belongs_to :profile_city, :class_name => 'City', :inverse_of => :profile_photo, :optional => true
|
15
|
-
belongs_to :user_profile, :class_name => '
|
15
|
+
belongs_to :user_profile, :class_name => 'Ish::UserProfile', :inverse_of => :profile_photo, :optional => true
|
16
16
|
belongs_to :profile_venue, :class_name => 'Venue', :inverse_of => :profile_photo, :optional => true
|
17
17
|
belongs_to :profile_event, :class_name => 'Event', :inverse_of => :profile_photo, :optional => true
|
18
18
|
|
data/lib/report.rb
CHANGED
@@ -11,6 +11,7 @@ class Report
|
|
11
11
|
field :slug
|
12
12
|
validates :slug, :uniqueness => true, :presence => true
|
13
13
|
index({ :slug => 1 }, { :unique => true })
|
14
|
+
before_validation :set_slug, :on => :create
|
14
15
|
|
15
16
|
## Can be one of: default (nil), longscroll
|
16
17
|
field :item_type, type: String
|
@@ -18,7 +19,7 @@ class Report
|
|
18
19
|
field :descr, :type => String
|
19
20
|
|
20
21
|
field :is_trash, :type => Boolean, :default => false
|
21
|
-
index :is_trash => 1, :is_public => 1
|
22
|
+
index({ :is_trash => 1, :is_public => 1 }, { name: 'default_index' })
|
22
23
|
|
23
24
|
field :is_public, :type => Boolean, :default => true
|
24
25
|
index({ :is_public => 1 })
|
@@ -38,7 +39,7 @@ class Report
|
|
38
39
|
field :lang, :type => String, :default => 'en'
|
39
40
|
index({ :lang => 1 })
|
40
41
|
|
41
|
-
belongs_to :user_profile, :optional => true, :class_name => '
|
42
|
+
belongs_to :user_profile, :optional => true, :class_name => 'Ish::UserProfile'
|
42
43
|
|
43
44
|
# validates :user, :presence => true, :allow_nil => false
|
44
45
|
field :username, :type => String, :default => 'anonymous'
|
@@ -97,7 +98,7 @@ class Report
|
|
97
98
|
end
|
98
99
|
end
|
99
100
|
|
100
|
-
|
101
|
+
|
101
102
|
|
102
103
|
set_callback :update, :after do |doc|
|
103
104
|
Site.update_all updated_at: Time.now
|
data/lib/video.rb
CHANGED
@@ -27,7 +27,7 @@ class Video
|
|
27
27
|
belongs_to :site, :optional => true
|
28
28
|
# has_many :newsitems # unnecessary, right? _vp_ 20200412
|
29
29
|
|
30
|
-
belongs_to :user_profile, :optional => true, :class_name => '
|
30
|
+
belongs_to :user_profile, :optional => true, :class_name => 'Ish::UserProfile', :inverse_of => :videos
|
31
31
|
|
32
32
|
accepts_nested_attributes_for :site, :tags, :city
|
33
33
|
|
File without changes
|
@@ -1,4 +1,6 @@
|
|
1
1
|
|
2
|
+
require 'httparty'
|
3
|
+
|
2
4
|
#
|
3
5
|
# * make calls every once in a while
|
4
6
|
# * If the option price dips below a threshold, close the position (create the order to buy back the option)
|
@@ -9,36 +11,21 @@
|
|
9
11
|
# https://developer.tdameritrade.com/option-chains/apis/get/marketdata/chains
|
10
12
|
# FVRR_082021P200
|
11
13
|
|
12
|
-
require 'httparty'
|
13
14
|
|
14
|
-
module
|
15
|
+
module Warbler::Ameritrade
|
15
16
|
|
16
17
|
CONFIG = {
|
17
18
|
underlying_downprice_tolerance: 0.14,
|
18
19
|
}
|
19
20
|
|
20
|
-
# def self.main_fvrr_1
|
21
|
-
# query_hash = {
|
22
|
-
# apikey: ::TD_AME[:apiKey],
|
23
|
-
# symbol: 'FVRR',
|
24
|
-
# contractType: 'PUT',
|
25
|
-
# strike: 200,
|
26
|
-
# fromDate: '2021-08-20',
|
27
|
-
# toDate: '2021-08-20',
|
28
|
-
# }
|
29
|
-
# response = ::Ish::Ameritrade::Api.get_option_chain(query_hash)
|
30
|
-
# puts! response, 'ze repsonse'
|
31
|
-
# end
|
32
|
-
|
33
21
|
## AKA stop loss
|
34
22
|
def self.main_fvrr_2
|
35
|
-
# response = ::Ish::Ameritrade::Api.get_quote({ symbol: 'FVRR_082021P200' })
|
36
23
|
|
37
24
|
# @TODO: pass the info on the position in here.
|
38
25
|
strike_price = 200
|
39
26
|
|
40
27
|
# What is my risk tolerance here? 14% down movement of the underlying
|
41
|
-
response = ::
|
28
|
+
response = ::Warbler::Ameritrade::Api.get_quote({ symbol: 'FVRR' })
|
42
29
|
last_price = response[:lastPrice]
|
43
30
|
tolerable_price = ( strike_price * (1-CONFIG[:underlying_downprice_tolerance]) )
|
44
31
|
|
@@ -49,7 +36,7 @@ module Ish::Ameritrade
|
|
49
36
|
|
50
37
|
end
|
51
38
|
|
52
|
-
class
|
39
|
+
class ::Warbler::Ameritrade::Api
|
53
40
|
include ::HTTParty
|
54
41
|
base_uri 'https://api.tdameritrade.com'
|
55
42
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -9,7 +9,7 @@ class Ish::StockAction
|
|
9
9
|
|
10
10
|
store_in :collection => 'ish_stock_action'
|
11
11
|
|
12
|
-
belongs_to :profile, :class_name => '
|
12
|
+
belongs_to :profile, :class_name => 'Ish::UserProfile'
|
13
13
|
belongs_to :stock_watch, :class_name => 'Ish::StockWatch'
|
14
14
|
has_many :stock_options, :class_name => 'Ish::StockOption'
|
15
15
|
|
@@ -19,7 +19,7 @@ class Ish::StockOption
|
|
19
19
|
field :quantity, :type => Integer
|
20
20
|
field :is_active, :type => Integer, :default => true # whether this position is current or in the past
|
21
21
|
|
22
|
-
belongs_to :profile, :class_name => '
|
22
|
+
belongs_to :profile, :class_name => 'Ish::UserProfile'
|
23
23
|
belongs_to :stock_action, :class_name => 'Ish::StockAction', :optional => true
|
24
24
|
|
25
25
|
def to_s
|
@@ -1,9 +1,5 @@
|
|
1
1
|
|
2
|
-
|
3
|
-
# See also ish_manager / lib / stockwatcher.rb
|
4
|
-
#
|
5
|
-
|
6
|
-
class IshModels::StockWatch
|
2
|
+
class Warbler::StockWatch
|
7
3
|
include Mongoid::Document
|
8
4
|
include Mongoid::Timestamps
|
9
5
|
|
@@ -16,15 +12,6 @@ class IshModels::StockWatch
|
|
16
12
|
ACTIONS = NOTIFICATION_TYPES
|
17
13
|
field :notification_type, :type => Symbol, :as => :action
|
18
14
|
|
19
|
-
=begin
|
20
|
-
def action
|
21
|
-
return notification_type
|
22
|
-
end
|
23
|
-
def action= which
|
24
|
-
notification_type = which
|
25
|
-
end
|
26
|
-
=end
|
27
|
-
|
28
15
|
field :price, :type => Float
|
29
16
|
|
30
17
|
DIRECTIONS = [ :ABOVE, :BELOW ]
|
@@ -32,6 +19,6 @@ class IshModels::StockWatch
|
|
32
19
|
DIRECTION_BELOW = :BELOW
|
33
20
|
field :direction, :type => Symbol
|
34
21
|
|
35
|
-
belongs_to :profile, :class_name => '
|
22
|
+
belongs_to :profile, :class_name => 'Ish::UserProfile'
|
36
23
|
|
37
24
|
end
|
File without changes
|
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.
|
4
|
+
version: 0.0.33.141
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- piousbox
|
@@ -100,11 +100,10 @@ executables: []
|
|
100
100
|
extensions: []
|
101
101
|
extra_rdoc_files: []
|
102
102
|
files:
|
103
|
-
- lib/app_model2.rb
|
104
103
|
- lib/aux_model.rb
|
105
104
|
- lib/cities_user.rb
|
106
105
|
- lib/city.rb
|
107
|
-
- lib/co_tailors.
|
106
|
+
- lib/co_tailors/README.txt
|
108
107
|
- lib/co_tailors/address.rb
|
109
108
|
- lib/co_tailors/order.rb
|
110
109
|
- lib/co_tailors/order_item.rb
|
@@ -114,46 +113,45 @@ files:
|
|
114
113
|
- lib/event.rb
|
115
114
|
- lib/feature.rb
|
116
115
|
- lib/gallery.rb
|
117
|
-
- lib/gameui.rb
|
118
116
|
- lib/gameui/map.rb
|
119
117
|
- lib/gameui/map_bookmark.rb
|
120
118
|
- lib/gameui/marker.rb
|
121
119
|
- lib/gameui/premium_purchase.rb
|
122
|
-
- lib/ish/
|
123
|
-
- lib/ish/
|
120
|
+
- lib/ish/app_model2.rb
|
121
|
+
- lib/ish/cache_key.rb
|
124
122
|
- lib/ish/campaign.rb
|
125
|
-
- lib/ish/
|
126
|
-
- lib/ish/covered_call_watcher.rb
|
123
|
+
- lib/ish/configuration.rb
|
127
124
|
- lib/ish/crawler.rb
|
128
125
|
- lib/ish/gallery_name.rb
|
129
126
|
- lib/ish/image_asset.rb
|
130
127
|
- lib/ish/input_error.rb
|
131
128
|
- lib/ish/invoice.rb
|
132
|
-
- lib/ish/iron_condor.rb
|
133
|
-
- lib/ish/iron_condor_watcher.rb
|
134
129
|
- lib/ish/issue.rb
|
135
130
|
- lib/ish/lead.rb
|
131
|
+
- lib/ish/nonpublic.rb
|
136
132
|
- lib/ish/payment.rb
|
137
|
-
- lib/ish/
|
138
|
-
- lib/ish/
|
139
|
-
- lib/ish/
|
133
|
+
- lib/ish/premium_item.rb
|
134
|
+
- lib/ish/railtie.rb
|
135
|
+
- lib/ish/user_profile.rb
|
140
136
|
- lib/ish/utils.rb
|
141
|
-
- lib/ish/yahoo_stockwatcher.rb
|
142
137
|
- lib/ish_models.rb
|
143
|
-
- lib/ish_models/cache_key.rb
|
144
|
-
- lib/ish_models/configuration.rb
|
145
|
-
- lib/ish_models/railtie.rb
|
146
|
-
- lib/ish_models/stock_watch.rb
|
147
|
-
- lib/ish_models/user_profile.rb
|
148
|
-
- lib/manager.rb
|
149
138
|
- lib/newsitem.rb
|
150
139
|
- lib/photo.rb
|
151
|
-
- lib/public_item.rb
|
152
140
|
- lib/report.rb
|
153
141
|
- lib/site.rb
|
154
142
|
- lib/tag.rb
|
155
143
|
- lib/venue.rb
|
156
144
|
- lib/video.rb
|
145
|
+
- lib/warbler/alphavantage_stockwatcher.rb
|
146
|
+
- lib/warbler/ameritrade.rb
|
147
|
+
- lib/warbler/covered_call.rb
|
148
|
+
- lib/warbler/covered_call_watcher.rb
|
149
|
+
- lib/warbler/iron_condor.rb
|
150
|
+
- lib/warbler/iron_condor_watcher.rb
|
151
|
+
- lib/warbler/stock_action.rb
|
152
|
+
- lib/warbler/stock_option.rb
|
153
|
+
- lib/warbler/stock_watch.rb
|
154
|
+
- lib/warbler/yahoo_stockwatcher.rb
|
157
155
|
homepage: http://wasya.co
|
158
156
|
licenses:
|
159
157
|
- MIT
|
data/lib/co_tailors.rb
DELETED
data/lib/gameui.rb
DELETED
data/lib/ish/stock_watch.rb
DELETED
@@ -1,33 +0,0 @@
|
|
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
|
data/lib/ish_models/cache_key.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
|
2
|
-
module IshModels
|
3
|
-
class CacheKey
|
4
|
-
include ::Mongoid::Document
|
5
|
-
include ::Mongoid::Timestamps
|
6
|
-
|
7
|
-
field :cities, :type => Time # /api/cities.json
|
8
|
-
field :feature_cities, :type => Time # /api/cities/features.json
|
9
|
-
|
10
|
-
def self.one
|
11
|
-
IshModels::CacheKey.first || IshModels::CacheKey.new
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
data/lib/ish_models/railtie.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
require 'rails'
|
2
|
-
# require 'byebug'
|
3
|
-
|
4
|
-
# File.open( '/tmp/this', 'a' ) { |f| f.puts "ish_models/railtie root: #{Rails.root}" }
|
5
|
-
# require Rails.root.join("config/initializers/00_s3.rb")
|
6
|
-
|
7
|
-
module IshModels
|
8
|
-
class Railtie < Rails::Railtie
|
9
|
-
|
10
|
-
# File.open( '/tmp/this', 'a' ) { |f| f.puts "ish_models/railtie config: #{config.inspect}" }
|
11
|
-
# File.open( '/tmp/this', 'a' ) { |f| f.puts "ish_models/railtie callback root: #{Rails.root}" }
|
12
|
-
|
13
|
-
initializer "ish_models.configure" do |app|
|
14
|
-
# File.open( '/tmp/this', 'a' ) { |f| f.puts "ish_models/railtie callback initializer root: #{Rails.root}" }
|
15
|
-
# require Rails.root.join("config/initializers/00_s3.rb")
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
data/lib/manager.rb
DELETED
data/lib/public_item.rb
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
class PublicItem
|
2
|
-
|
3
|
-
=begin
|
4
|
-
## let's try to make it work with newsitems, without publicitems yet.
|
5
|
-
|
6
|
-
include Mongoid::Document
|
7
|
-
include Mongoid::Timestamps
|
8
|
-
|
9
|
-
belongs_to :site
|
10
|
-
belongs_to :city
|
11
|
-
belongs_to :tag
|
12
|
-
|
13
|
-
field :username
|
14
|
-
|
15
|
-
# acts as a report
|
16
|
-
# acts as a gallery
|
17
|
-
# acts as a video
|
18
|
-
has_many :photos
|
19
|
-
|
20
|
-
belongs_to :photo
|
21
|
-
belongs_to :report
|
22
|
-
belongs_to :gallery
|
23
|
-
belongs_to :video
|
24
|
-
|
25
|
-
field :name, :type => String
|
26
|
-
field :descr, :type => String
|
27
|
-
field :image_path, :type => String
|
28
|
-
field :link_path, :type => String
|
29
|
-
field :username, :type => String # @TODO do I use this???
|
30
|
-
field :partial_name, :type => String, :default => nil # @deprecated, but let's not remove it.
|
31
|
-
|
32
|
-
field :weight, :type => Integer, :default => 10
|
33
|
-
field :n_upvotes, :type => Integer, :default => 0
|
34
|
-
field :n_downvotes, :type => Integer, :default => 0
|
35
|
-
field :upvoting_users, :type => Array, :default => []
|
36
|
-
field :downvoting_users, :type => Array, :default => []
|
37
|
-
field :is_feature, :type => Boolean, :default => false
|
38
|
-
|
39
|
-
default_scope ->{ order_by({ :created_at => :desc }) }
|
40
|
-
|
41
|
-
def self.from_params item
|
42
|
-
n = Newsitem.new
|
43
|
-
n.descr = item[:descr]
|
44
|
-
n.username = item[:username]
|
45
|
-
|
46
|
-
unless item[:report_id].blank?
|
47
|
-
n.report = Report.find item[:report_id]
|
48
|
-
end
|
49
|
-
|
50
|
-
unless item[:gallery_id].blank?
|
51
|
-
n.gallery = Gallery.find item[:gallery_id]
|
52
|
-
end
|
53
|
-
|
54
|
-
n.partial_name = item.partial_name unless item.partial_name.blank?
|
55
|
-
|
56
|
-
return n
|
57
|
-
end
|
58
|
-
=end
|
59
|
-
|
60
|
-
end
|