ish_models 0.0.33.139 → 0.0.33.143

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/lib/city.rb +3 -3
  3. data/lib/co_tailors/README.txt +2 -0
  4. data/lib/co_tailors/address.rb +1 -1
  5. data/lib/co_tailors/order.rb +1 -1
  6. data/lib/co_tailors/profile_measurement.rb +1 -1
  7. data/lib/country.rb +1 -1
  8. data/lib/gallery.rb +3 -7
  9. data/lib/gameui/map.rb +16 -1
  10. data/lib/gameui/map_bookmark.rb +1 -1
  11. data/lib/gameui/marker.rb +13 -3
  12. data/lib/gameui/premium_purchase.rb +1 -1
  13. data/lib/{app_model2.rb → ish/app_model2.rb} +3 -8
  14. data/lib/ish/cache_key.rb +14 -0
  15. data/lib/ish/campaign.rb +1 -1
  16. data/lib/{ish_models → ish}/configuration.rb +1 -1
  17. data/lib/ish/gallery_name.rb +1 -0
  18. data/lib/ish/lead.rb +3 -3
  19. data/lib/ish/payment.rb +1 -1
  20. data/lib/ish/premium_item.rb +14 -0
  21. data/lib/ish/railtie.rb +8 -0
  22. data/lib/{ish_models → ish}/user_profile.rb +18 -29
  23. data/lib/ish_models.rb +53 -61
  24. data/lib/newsitem.rb +1 -1
  25. data/lib/photo.rb +2 -2
  26. data/lib/report.rb +2 -2
  27. data/lib/video.rb +1 -1
  28. data/lib/{ish → warbler}/alphavantage_stockwatcher.rb +0 -0
  29. data/lib/{ish → warbler}/ameritrade.rb +5 -18
  30. data/lib/{ish → warbler}/covered_call.rb +0 -0
  31. data/lib/{ish → warbler}/covered_call_watcher.rb +0 -0
  32. data/lib/{ish → warbler}/iron_condor.rb +0 -0
  33. data/lib/{ish → warbler}/iron_condor_watcher.rb +0 -0
  34. data/lib/{ish → warbler}/stock_action.rb +1 -1
  35. data/lib/{ish → warbler}/stock_option.rb +1 -1
  36. data/lib/{ish_models → warbler}/stock_watch.rb +2 -15
  37. data/lib/{ish → warbler}/yahoo_stockwatcher.rb +0 -0
  38. metadata +18 -21
  39. data/lib/co_tailors.rb +0 -3
  40. data/lib/gameui.rb +0 -2
  41. data/lib/ish/stock_watch.rb +0 -33
  42. data/lib/ish_models/cache_key.rb +0 -14
  43. data/lib/ish_models/railtie.rb +0 -18
  44. data/lib/manager.rb +0 -7
  45. data/lib/public_item.rb +0 -60
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ca15ab4eb3ebc3e6a6ea6766fa2b80281bcf89eefe3efd35ac7e531545147e6f
4
- data.tar.gz: ccd4b15972edb2bd61320bd17e2b3443062130f532d460fe2fd6185722d649e1
3
+ metadata.gz: 978399c10de8f705d8bef460bded4c2a596f4e622f27deadc6eabe0d68ec690f
4
+ data.tar.gz: faabf03ef0cda1f10e651bc94406e1965cb86161fdcbb303da3f17faceba702e
5
5
  SHA512:
6
- metadata.gz: 650afa1a9f2a769facc5361560dc94436793fca21992532348a48bcaf5c4fc627194221a4527700034613cedba247d2dcf9d490b2c3e0dbe54038b905efcee8a
7
- data.tar.gz: 803f1bcbb5bad0ac64125fd3d370ff9da205f7ba231b29b276c67b2f8648d30be064f6cc29bf213300001f57993e94ca5a0eb3dace6e4e277c08490714c2c619
6
+ metadata.gz: 9c8ecd8a69ce9961b10b1cfc49a64876753ce04dd838fd8b2f9ff5288951a7e442c98817f2461dc5b2a321bfdd6d4836e3591ec5741aaa4da45c60477646ecf7
7
+ data.tar.gz: 0073c773b8e96ca5a66eb771d22180edd6bed3b42e8c750c989462bd1e73ae94f96a135708ed18ee748cbe039bc7d0042d8c1f6f13f35666d0a31c226221d562
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 => '::IshModels::UserProfile', :inverse_of => :current_city
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 => '::IshModels::UserProfile', :inverse_of => :current_city
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 => '::IshModels::UserProfile', :inverse_of => :guide_city
37
+ has_one :guide, :class_name => '::Ish::UserProfile', :inverse_of => :guide_city
38
38
 
39
39
  has_many :features
40
40
 
@@ -0,0 +1,2 @@
1
+
2
+ namespace co_tailors is trash. It'd take me too much eddors, and I'd rather use SpreeCommerce.
@@ -3,7 +3,7 @@ class CoTailors::Address
3
3
  include Mongoid::Document
4
4
  include Mongoid::Timestamps
5
5
 
6
- belongs_to :profile, :class_name => '::IshModels::UserProfile'
6
+ belongs_to :profile, :class_name => '::Ish::UserProfile'
7
7
  validates :profile, :presence => true
8
8
 
9
9
  field :name
@@ -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 => '::IshModels::UserProfile'
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 => 'IshModels::UserProfile', :optional => true
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
@@ -10,4 +10,4 @@ class Country
10
10
 
11
11
  has_many :cities
12
12
 
13
- end
13
+ end
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 => 'IshModels::UserProfile', :inverse_of => :galleries
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: '::IshModels::UserProfile', inverse_of: :bookmarked_location
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
@@ -3,7 +3,7 @@ class ::Gameui::MapBookmark
3
3
  include Mongoid::Document
4
4
  include Mongoid::Timestamps
5
5
 
6
- belongs_to :profile, class_name: 'IshModels::UserProfile'
6
+ belongs_to :profile, class_name: 'Ish::UserProfile'
7
7
  belongs_to :location, class_name: '::Gameui::Map'
8
8
 
9
9
  end
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
- ITEM_TYPES = [ ITEM_TYPE_LOCATION, ITEM_TYPE_MAP ]
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 => '::IshModels::UserProfile'
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
- class AppModel2
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 => 'IshModels::UserProfile'
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'
@@ -1,5 +1,5 @@
1
1
 
2
- module IshModels
2
+ module Ish
3
3
  class Configuration
4
4
  attr_accessor :s3_credentials
5
5
 
@@ -1,4 +1,5 @@
1
1
 
2
+ # @TODO: completely rework this
2
3
  module Ish
3
4
  class GalleryName
4
5
  include Mongoid::Document
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 => 'IshModels::UserProfile'
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 => 'IshModels::UserProfile' # , :optional => true
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
@@ -0,0 +1,8 @@
1
+ require 'rails'
2
+
3
+ module Ish
4
+ class Railtie < Rails::Railtie
5
+ initializer "ish_models.configure" do |app|
6
+ end
7
+ end
8
+ end
@@ -1,4 +1,4 @@
1
- class IshModels::UserProfile
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, :class_name => 'Gallery', :inverse_of => :shared_profiles
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, :class_name => 'Ish::Invoice'
34
- has_many :leads, :class_name => 'Ish::Lead'
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, :inverse_of => :user_profile
37
- has_many :stocks, :class_name => 'Ish::StockWatch'
38
- has_many :videos, :inverse_of => :user_profile
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 => 'IshModels::UserProfile', :inverse_of => :friendeds
47
- has_and_belongs_to_many :friendeds, :class_name => 'IshModels::UserProfile', :inverse_of => :friends
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
- # preferences
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
- # manager uses it.
64
- # @TODO: check this, this is shit. _vp_ 20170527
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
- # CoT - colombia tailors
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_models.rb CHANGED
@@ -1,10 +1,15 @@
1
1
 
2
- require 'ish_models/railtie' if defined?(Rails)
3
- require 'ish_models/configuration'
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 'co_tailors'
25
- require 'co_tailors/product.rb'
26
- require 'co_tailors/profile_measurement.rb'
27
- require 'co_tailors/order.rb'
28
- # require 'co_tailors/order_item.rb' # this is required from within order.rb
29
- require 'co_tailors/address.rb'
30
-
31
- require 'gameui'
32
- require 'gameui/map.rb'
33
- require 'gameui/map_bookmark.rb'
34
- require 'gameui/marker.rb'
35
- require 'gameui/premium_purchase.rb'
36
-
37
- # require 'ish/alphavantage_stockwatcher.rb'
38
- require 'ish/ameritrade'
39
- require 'ish/campaign.rb'
40
- require 'ish/covered_call'
41
- require 'ish/crawler.rb'
42
- require 'ish/gallery_name.rb'
43
- require 'ish/image_asset.rb'
44
- require 'ish/input_error.rb'
45
- require 'ish/invoice.rb'
46
- require 'ish/iron_condor.rb'
47
- require 'ish/iron_condor_watcher.rb'
48
- require 'ish/issue.rb'
49
- require 'ish/lead.rb'
50
- require 'ish/payment.rb'
51
- require 'ish/stock_action.rb'
52
- require 'ish/stock_option.rb'
53
- require 'ish/stock_watch.rb'
54
- require 'ish/utils.rb'
55
- require 'ish/yahoo_stockwatcher.rb'
56
-
57
- # obsolete, use `ish` namespace now
58
- require 'ish_models/cache_key.rb' # this is really obsolete? _vp_ 20180123
59
- require 'ish_models/user_profile.rb'
60
-
61
- require 'app_model2.rb'
62
- require 'aux_model.rb'
63
- require 'city.rb'
64
- require 'cities_user.rb'
65
- require 'country.rb'
66
- require 'event.rb'
67
- require 'feature.rb'
68
- require 'gallery.rb'
69
- # require 'gallery2.rb'
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: 'IshModels::UserProfile', optional: true
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 => 'IshModels::UserProfile', :optional => true
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 => 'IshModels::UserProfile', :inverse_of => :profile_photo, :optional => true
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
@@ -19,7 +19,7 @@ class Report
19
19
  field :descr, :type => String
20
20
 
21
21
  field :is_trash, :type => Boolean, :default => false
22
- index :is_trash => 1, :is_public => 1
22
+ index({ :is_trash => 1, :is_public => 1 }, { name: 'default_index' })
23
23
 
24
24
  field :is_public, :type => Boolean, :default => true
25
25
  index({ :is_public => 1 })
@@ -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 => 'IshModels::UserProfile'
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 => 'IshModels::UserProfile', :inverse_of => :videos
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 Ish::Ameritrade
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 = ::Ish::Ameritrade::Api.get_quote({ symbol: 'FVRR' })
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 Ish::Ameritrade::Api
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 => 'IshModels::UserProfile'
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 => 'IshModels::UserProfile'
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 => 'IshModels::UserProfile'
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.139
4
+ version: 0.0.33.143
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.rb
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/alphavantage_stockwatcher.rb
123
- - lib/ish/ameritrade.rb
120
+ - lib/ish/app_model2.rb
121
+ - lib/ish/cache_key.rb
124
122
  - lib/ish/campaign.rb
125
- - lib/ish/covered_call.rb
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/stock_action.rb
138
- - lib/ish/stock_option.rb
139
- - lib/ish/stock_watch.rb
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
@@ -1,3 +0,0 @@
1
-
2
- module CoTailors
3
- end
data/lib/gameui.rb DELETED
@@ -1,2 +0,0 @@
1
- class Gameui
2
- end
@@ -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
@@ -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
@@ -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
@@ -1,7 +0,0 @@
1
-
2
- #
3
- # I need this thing for permissions
4
- #
5
- class Manager
6
- end
7
-
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