ish_models 0.0.33.140 → 0.0.33.144
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 +3 -7
- data/lib/gameui/map.rb +16 -1
- data/lib/gameui/map_bookmark.rb +1 -1
- data/lib/gameui/marker.rb +13 -3
- 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/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 +19 -29
- data/lib/ish_models.rb +53 -61
- data/lib/newsitem.rb +1 -1
- data/lib/photo.rb +2 -2
- data/lib/report.rb +1 -1
- 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 +3 -15
- data/lib/{ish → warbler}/yahoo_stockwatcher.rb +0 -0
- metadata +18 -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: 2807ebb262080febaab78c66087d7ef4836ee6f765ce6a41aa828f9a042ccc28
|
4
|
+
data.tar.gz: 5674a4862d01ce30240aaefc7654e98a9343d69f0711fa095ccf009800416299
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b70f70184a0ac44ee02268fed7a99f0a02113f6a2f81287d5bb18d461bf13d58f495140700cd60b2271e11b8098ca9570280ae3bc5860b0426ead9044ca90abb
|
7
|
+
data.tar.gz: 6523e5eace38f3781478866a99de46d6ea01842162e07d91d5e4aebaf935872440cda597f3bae37c7e62900084679bac6eae6bda300a6d9d6093aa656f8afd3b
|
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
|
|
@@ -36,19 +38,14 @@ class Gallery
|
|
36
38
|
validates :slug, presence: true, uniqueness: true
|
37
39
|
before_validation :set_slug, :on => :create
|
38
40
|
|
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
|
-
|
42
|
-
|
43
41
|
def self.list conditions = { :is_trash => false }
|
44
42
|
out = self.unscoped.where( conditions ).order_by( :created_at => :desc )
|
45
43
|
[['', nil]] + out.map { |item| [ "#{item.created_at.strftime('%Y%m%d')} #{item.name}", item.id ] }
|
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,12 @@ 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
|
+
|
18
28
|
|
19
29
|
field :map_slug
|
20
30
|
def map
|
@@ -24,6 +34,9 @@ class ::Gameui::Map
|
|
24
34
|
field :name
|
25
35
|
field :description
|
26
36
|
|
37
|
+
RATED_OPTIONS = [ 'pg-13', 'r', 'nc-17' ]
|
38
|
+
field :rated, default: 'pg-13' # 'r', 'nc-17'
|
39
|
+
|
27
40
|
## Possible keys: description, map, markers, newsitems,
|
28
41
|
field :labels, type: Object, default: {}
|
29
42
|
## Possible keys:
|
@@ -69,3 +82,5 @@ class ::Gameui::Map
|
|
69
82
|
end
|
70
83
|
|
71
84
|
end
|
85
|
+
|
86
|
+
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
|
@@ -51,7 +60,8 @@ class ::Gameui::Marker
|
|
51
60
|
|
52
61
|
ITEM_TYPE_LOCATION = 'gameui-location'
|
53
62
|
ITEM_TYPE_MAP = 'gameui-map'
|
54
|
-
|
63
|
+
ITEM_TYPE_OBJ = 'gameui-obj'
|
64
|
+
ITEM_TYPES = [ ITEM_TYPE_LOCATION, ITEM_TYPE_MAP, ITEM_TYPE_OBJ ]
|
55
65
|
field :item_type, type: String
|
56
66
|
validates :item_type, presence: true
|
57
67
|
|
@@ -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
|
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
|
|
@@ -6,6 +6,7 @@ class IshModels::UserProfile
|
|
6
6
|
validates_presence_of :name
|
7
7
|
|
8
8
|
field :username
|
9
|
+
field :scratchpad
|
9
10
|
|
10
11
|
field :email
|
11
12
|
# validates_format_of :email, :with => ::Devise::email_regexp
|
@@ -28,14 +29,16 @@ class IshModels::UserProfile
|
|
28
29
|
belongs_to :guide_city, :class_name => 'City', :inverse_of => :guide, :optional => true
|
29
30
|
|
30
31
|
has_many :galleries, :inverse_of => :user_profile
|
31
|
-
has_and_belongs_to_many :shared_galleries, :
|
32
|
+
has_and_belongs_to_many :shared_galleries, :inverse_of => :shared_profiles, class_name: 'Gallery'
|
33
|
+
has_and_belongs_to_many :shared_markers, :inverse_of => :shared_profiles, class_name: 'Gameui::Marker'
|
34
|
+
has_and_belongs_to_many :shared_locations, :inverse_of => :shared_profiles, class_name: 'Gameui::Map'
|
32
35
|
|
33
|
-
has_many :invoices,
|
34
|
-
has_many :leads,
|
36
|
+
has_many :invoices, :class_name => '::Ish::Invoice'
|
37
|
+
has_many :leads, :class_name => '::Ish::Lead'
|
35
38
|
has_many :photos
|
36
|
-
has_many :reports,
|
37
|
-
has_many :stocks,
|
38
|
-
has_many :videos,
|
39
|
+
has_many :reports, inverse_of: :user_profile
|
40
|
+
has_many :stocks, :class_name => '::Warbler::StockWatch'
|
41
|
+
has_many :videos, inverse_of: :user_profile
|
39
42
|
has_many :newsitems, inverse_of: :user_profile
|
40
43
|
|
41
44
|
has_and_belongs_to_many :bookmarked_locations, class_name: '::Gameui::Map', inverse_of: :bookmarked_profile
|
@@ -43,43 +46,32 @@ class IshModels::UserProfile
|
|
43
46
|
bookmarked_locations
|
44
47
|
end
|
45
48
|
|
46
|
-
has_and_belongs_to_many :friends, :class_name => '
|
47
|
-
has_and_belongs_to_many :friendeds, :class_name => '
|
49
|
+
has_and_belongs_to_many :friends, :class_name => '::Ish::UserProfile', :inverse_of => :friendeds
|
50
|
+
has_and_belongs_to_many :friendeds, :class_name => '::Ish::UserProfile', :inverse_of => :friends
|
48
51
|
|
49
52
|
field :n_unlocks, type: Integer, default: 0
|
50
53
|
def n_coins
|
51
54
|
n_unlocks
|
52
55
|
end
|
53
56
|
|
54
|
-
|
55
|
-
|
56
|
-
#
|
57
|
+
## preferences
|
58
|
+
## @TODO: better naming convention, or remove this
|
57
59
|
field :videos_embed, :type => Boolean, :default => false
|
58
60
|
|
59
61
|
def sudoer?
|
60
62
|
%w( piousbox@gmail.com victor@wasya.co ).include?( self.user.email ) ? true : false
|
61
63
|
end
|
62
64
|
|
63
|
-
|
64
|
-
|
65
|
+
## manager uses it.
|
66
|
+
## @TODO: check this, this is shit. _vp_ 20170527
|
65
67
|
def self.list
|
66
68
|
out = self.all.order_by( :domain => :asc, :lang => :asc )
|
67
69
|
[['', nil]] + out.map { |item| [ item.name, item.id ] }
|
68
70
|
end
|
69
71
|
|
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
|
-
#
|
72
|
+
##
|
73
|
+
## GameUI
|
74
|
+
##
|
83
75
|
field :n_stars, type: Integer, default: 0
|
84
76
|
has_many :premium_purchases, :class_name => '::Gameui::PremiumPurchase'
|
85
77
|
def has_premium_purchase item
|
@@ -90,5 +82,3 @@ class IshModels::UserProfile
|
|
90
82
|
end
|
91
83
|
|
92
84
|
end
|
93
|
-
|
94
|
-
Profile = IshModels::UserProfile
|
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,52 @@ 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
|
-
|
43
|
-
require '
|
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
|
-
require '
|
59
|
-
require '
|
60
|
-
|
61
|
-
|
62
|
-
require '
|
63
|
-
require '
|
64
|
-
require '
|
65
|
-
require '
|
66
|
-
require '
|
67
|
-
require '
|
68
|
-
require '
|
69
|
-
# require '
|
70
|
-
require 'manager.rb'
|
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/payment'
|
44
|
+
require 'ish/premium_item'
|
45
|
+
require 'ish/utils'
|
46
|
+
require 'ish/user_profile'
|
47
|
+
|
48
|
+
require 'aux_model'
|
49
|
+
require 'city'
|
50
|
+
require 'cities_user'
|
51
|
+
require 'country'
|
52
|
+
require 'event'
|
53
|
+
require 'feature'
|
54
|
+
require 'gallery'
|
55
|
+
require 'newsitem'
|
56
|
+
require 'photo'
|
57
|
+
require 'report'
|
58
|
+
require 'site'
|
59
|
+
require 'tag'
|
60
|
+
require 'venue'
|
61
|
+
require 'video'
|
62
|
+
|
63
|
+
require 'warbler/stock_watch'
|
64
|
+
require 'warbler/ameritrade'
|
65
|
+
|
66
|
+
## warbler
|
67
|
+
# require 'warbler/alphavantage_stockwatcher'
|
68
|
+
# require 'warbler/ameritrade'
|
69
|
+
# require 'warbler/covered_call'
|
70
|
+
# require 'warbler/iron_condor'
|
71
|
+
# require 'warbler/iron_condor_watcher'
|
72
|
+
# require 'warbler/stock_action'
|
73
|
+
# require 'warbler/stock_option'
|
74
|
+
# require 'warbler/yahoo_stockwatcher'
|
83
75
|
|
84
76
|
|
85
77
|
|
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
@@ -39,7 +39,7 @@ class Report
|
|
39
39
|
field :lang, :type => String, :default => 'en'
|
40
40
|
index({ :lang => 1 })
|
41
41
|
|
42
|
-
belongs_to :user_profile, :optional => true, :class_name => '
|
42
|
+
belongs_to :user_profile, :optional => true, :class_name => 'Ish::UserProfile'
|
43
43
|
|
44
44
|
# validates :user, :presence => true, :allow_nil => false
|
45
45
|
field :username, :type => String, :default => 'anonymous'
|
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,11 +1,8 @@
|
|
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
|
5
|
+
store_in collection: 'ish_stock_watches'
|
9
6
|
|
10
7
|
field :ticker
|
11
8
|
|
@@ -16,15 +13,6 @@ class IshModels::StockWatch
|
|
16
13
|
ACTIONS = NOTIFICATION_TYPES
|
17
14
|
field :notification_type, :type => Symbol, :as => :action
|
18
15
|
|
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
16
|
field :price, :type => Float
|
29
17
|
|
30
18
|
DIRECTIONS = [ :ABOVE, :BELOW ]
|
@@ -32,6 +20,6 @@ class IshModels::StockWatch
|
|
32
20
|
DIRECTION_BELOW = :BELOW
|
33
21
|
field :direction, :type => Symbol
|
34
22
|
|
35
|
-
belongs_to :profile, :class_name => '
|
23
|
+
belongs_to :profile, :class_name => 'Ish::UserProfile'
|
36
24
|
|
37
25
|
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.144
|
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,44 @@ 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
|
136
131
|
- lib/ish/payment.rb
|
137
|
-
- lib/ish/
|
138
|
-
- lib/ish/
|
139
|
-
- lib/ish/
|
132
|
+
- lib/ish/premium_item.rb
|
133
|
+
- lib/ish/railtie.rb
|
134
|
+
- lib/ish/user_profile.rb
|
140
135
|
- lib/ish/utils.rb
|
141
|
-
- lib/ish/yahoo_stockwatcher.rb
|
142
136
|
- 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
137
|
- lib/newsitem.rb
|
150
138
|
- lib/photo.rb
|
151
|
-
- lib/public_item.rb
|
152
139
|
- lib/report.rb
|
153
140
|
- lib/site.rb
|
154
141
|
- lib/tag.rb
|
155
142
|
- lib/venue.rb
|
156
143
|
- lib/video.rb
|
144
|
+
- lib/warbler/alphavantage_stockwatcher.rb
|
145
|
+
- lib/warbler/ameritrade.rb
|
146
|
+
- lib/warbler/covered_call.rb
|
147
|
+
- lib/warbler/covered_call_watcher.rb
|
148
|
+
- lib/warbler/iron_condor.rb
|
149
|
+
- lib/warbler/iron_condor_watcher.rb
|
150
|
+
- lib/warbler/stock_action.rb
|
151
|
+
- lib/warbler/stock_option.rb
|
152
|
+
- lib/warbler/stock_watch.rb
|
153
|
+
- lib/warbler/yahoo_stockwatcher.rb
|
157
154
|
homepage: http://wasya.co
|
158
155
|
licenses:
|
159
156
|
- 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
|