ish_models 0.0.33.121 → 0.0.33.127

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4b574fae4d9d623f6a4c607caf3282693b8eab0b4e1c1a96680b96f5c1c9596f
4
- data.tar.gz: 9f02341af99ebd3a6c3cd94e30b4241a8d67ca77e73db7514d72a300dd635e52
3
+ metadata.gz: d025168334524e77a95ebd65c77aca9f238357650a60e1ac34d96a98fab70393
4
+ data.tar.gz: 880e8151b3f6c11dc6dd43e1b39a1b856ddf18a0f69b8029830a6b224007dd5f
5
5
  SHA512:
6
- metadata.gz: fd264b75c5a2c013bb028005c1bfb3e0440837c36248cb4c5902b440010bfc4f92e92c6983c7896557fd9570513f8c7993f7dff200049eb527f5b13aa879877d
7
- data.tar.gz: 879928f0e97a2db21dc54ce929e273a77cc0eeec515122256479f9c505b9dc66599dfce118489c77f2f5dcf29025f41fed5e3ad73fa7d4a57b1250bfa51153c6
6
+ metadata.gz: 9b5c590ad879d8841b94f9f6c293a24b6ded2a00f085b10704bc55c855954ef89ef324c010e117feaefcfa9da8d9691b0ecafe1220d665406bb748c82cda4ccc
7
+ data.tar.gz: fe93fcd905f544f3d584055b6e07ea826e42d451be19e446433ff8db05ff504340a3348087c72a0a2412f60f80c2da662f3efd0a771ad97bcc9f06689bc09142
data/lib/city.rb CHANGED
@@ -2,7 +2,7 @@ class City
2
2
  include ::Mongoid::Document
3
3
  include ::Mongoid::Timestamps
4
4
  include AuxModel
5
-
5
+
6
6
  field :name, :type => String
7
7
  field :description, :type => String, :default => 'The description of this city'
8
8
 
@@ -21,8 +21,8 @@ class City
21
21
 
22
22
  belongs_to :country, :optional => true
23
23
 
24
- has_many :events
25
- has_many :galleries
24
+ has_many :events
25
+ has_many :galleries
26
26
  has_many :photos
27
27
  has_many :reports
28
28
  has_many :venues
data/lib/gallery.rb CHANGED
@@ -8,6 +8,7 @@ class Gallery
8
8
 
9
9
  field :is_public, type: Boolean, default: false
10
10
  field :is_trash, type: Boolean, default: false
11
+ field :is_done, type: Boolean, default: false
11
12
 
12
13
  field :premium_tier, type: Integer, default: 0 # how many stars need to spend, to get access? 0 = free
13
14
  def is_premium
@@ -17,7 +18,7 @@ class Gallery
17
18
  has_many :premium_purchases, class_name: '::Gameui::PremiumPurchase', as: :item
18
19
 
19
20
  default_scope ->{ where({ :is_public => true, :is_trash => false }).order_by({ :created_at => :desc }) }
20
-
21
+
21
22
  field :x, :type => Float
22
23
  field :y, :type => Float
23
24
 
@@ -32,11 +33,11 @@ class Gallery
32
33
  belongs_to :user_profile, :optional => true, :class_name => 'IshModels::UserProfile', :inverse_of => :galleries
33
34
  field :username, :type => String
34
35
  has_and_belongs_to_many :shared_profiles, :class_name => 'IshModels::UserProfile', :inverse_of => :shared_galleries
35
-
36
- field :name, :type => String
36
+
37
+ field :name
37
38
  validates :name, :uniqueness => true # , :allow_nil => false
38
39
 
39
- field :galleryname, :type => String
40
+ field :galleryname
40
41
  index({ :galleryname => -1 }, { :unique => true })
41
42
  embeds_many :gallery_names, :class_name => '::Ish::GalleryName'
42
43
  def self.find_by_slug slug
@@ -64,7 +65,7 @@ class Gallery
64
65
  #
65
66
  # newsitems
66
67
  #
67
- if doc.is_public
68
+ if doc.is_public
68
69
  # for the sites
69
70
  if doc.site
70
71
  sites = Site.where( :domain => doc.site.domain )
@@ -117,6 +118,6 @@ class Gallery
117
118
  set_callback :update, :after do |doc|
118
119
  Site.update_all updated_at: Time.now
119
120
  end
120
-
121
+
121
122
  end
122
123
 
@@ -4,11 +4,8 @@ class ::Gameui::PremiumPurchase
4
4
  include Mongoid::Timestamps
5
5
 
6
6
  belongs_to :user_profile, :class_name => '::IshModels::UserProfile'
7
-
8
- field :purchased_class
9
- field :purchased_id
10
-
11
7
  belongs_to :item, polymorphic: true
12
8
 
13
9
  end
14
10
 
11
+ ::Purchase = ::Gameui::PremiumPurchase
@@ -0,0 +1,43 @@
1
+
2
+ #
3
+ # * make calls every once in a while
4
+ # * If the option price dips below a threshold, close the position (create the order to buy back the option)
5
+ #
6
+
7
+ # cron job or service? Well, I've historically done service. Cron is easier tho. The wiring should be for both.
8
+
9
+ module Ish::Ameritrade; end
10
+
11
+ class Ish::Ameritrade::Api
12
+ include HTTParty
13
+ base_uri 'api.tdameritrade.com'
14
+
15
+ def self.get_option_chain opts
16
+
17
+ # validate input
18
+ %i| apiKey symbol contrtactType strike fromDate toDate |.each do |s|
19
+ if !opts[s]
20
+ raise "invalid input, missing #{s}"
21
+ end
22
+ end
23
+
24
+ path = '/v1/marketdata/chains'
25
+ out = self.class.get path, opts
26
+ out
27
+ end
28
+
29
+ def self.main_fvrr_1
30
+ query_hash = {
31
+ apiKey: '',
32
+ symbol: 'FVRR',
33
+ contractType: 'PUT',
34
+ stike: 200,
35
+ fromDate: '2021-08-20',
36
+ toDate: '2021-08-20',
37
+ }
38
+ response = Ameritrade::Api.get_option_chain(query_hash)
39
+
40
+ puts! response, 'ze repsonse'
41
+ end
42
+
43
+ end
data/lib/ish/payment.rb CHANGED
@@ -8,7 +8,12 @@ class Ish::Payment
8
8
  field :amount, :type => Integer # in cents
9
9
  field :charge, :type => Hash
10
10
  field :email, :type => String
11
-
11
+
12
+ field :client_secret
13
+ field :payment_intent_id
14
+
15
+ field :status, type: Symbol
16
+
12
17
  after_create :compute_paid_invoice_amount
13
18
 
14
19
  protected
data/lib/ish_models.rb CHANGED
@@ -33,6 +33,7 @@ require 'gameui/map.rb'
33
33
  require 'gameui/marker.rb'
34
34
  require 'gameui/premium_purchase.rb'
35
35
 
36
+ require 'ish/ameritrade'
36
37
  require 'ish/covered_call'
37
38
  require 'ish/crawler.rb'
38
39
  require 'ish/gallery_name.rb'
@@ -61,7 +62,7 @@ require 'country.rb'
61
62
  require 'event.rb'
62
63
  require 'feature.rb'
63
64
  require 'gallery.rb'
64
- require 'gallery2.rb'
65
+ # require 'gallery2.rb'
65
66
  require 'manager.rb'
66
67
  require 'newsitem.rb'
67
68
  require 'photo.rb'
@@ -1,12 +1,12 @@
1
- class IshModels::UserProfile
1
+ class IshModels::UserProfile
2
2
  include Mongoid::Document
3
3
  include Mongoid::Timestamps
4
-
4
+
5
5
  field :name
6
6
  validates_presence_of :name
7
7
 
8
8
  field :username
9
-
9
+
10
10
  field :email
11
11
  # validates_format_of :email, :with => ::Devise::email_regexp
12
12
  validates_format_of :email,:with => /\A[^@\s]+@([^@\s]+\.)+[^@\s]+\z/
@@ -14,16 +14,16 @@ class IshModels::UserProfile
14
14
  field :fb_access_token
15
15
  field :fb_long_access_token
16
16
  field :fb_expires_in
17
-
17
+
18
18
  field :lang, :type => String, :default => :en
19
19
 
20
- ROLES = [ :admin, :manager, :guy ]
20
+ ROLES = [ :admin, :manager, :guy ]
21
21
  field :role_name, :type => Symbol
22
22
 
23
23
  belongs_to :user
24
24
  belongs_to :current_city, :class_name => 'City', :inverse_of => :current_users, :optional => true
25
25
  belongs_to :guide_city, :class_name => 'City', :inverse_of => :guide, :optional => true
26
-
26
+
27
27
  has_many :galleries, :inverse_of => :user_profile
28
28
  has_and_belongs_to_many :shared_galleries, :class_name => 'Gallery', :inverse_of => :shared_profiles
29
29
 
@@ -38,6 +38,8 @@ class IshModels::UserProfile
38
38
  has_and_belongs_to_many :friends, :class_name => 'IshModels::UserProfile', :inverse_of => :friendeds
39
39
  has_and_belongs_to_many :friendeds, :class_name => 'IshModels::UserProfile', :inverse_of => :friends
40
40
 
41
+ field :n_unlocks, type: Integer, default: 0
42
+
41
43
  #
42
44
  # preferences
43
45
  #
@@ -75,12 +77,14 @@ class IshModels::UserProfile
75
77
 
76
78
  end
77
79
 
80
+ Profile = IshModels::UserProfile
81
+
78
82
  =begin
79
83
  field :about, :type => String
80
84
  field :education, :type => String
81
85
  field :objectives, :type => String
82
86
  field :current_employment, :type => String
83
- field :past_employment, :type => String
87
+ field :past_employment, :type => String
84
88
  field :pdf_resume_path, :type => String
85
89
  field :doc_resume_path, :type => String
86
90
 
data/lib/tag.rb CHANGED
@@ -1,19 +1,19 @@
1
- class Tag
1
+ class Tag
2
2
  include Mongoid::Document
3
3
  include Mongoid::Timestamps
4
4
 
5
5
  field :name, :type => String
6
6
  # validates :name, :uniqueness => true, :allow_nil => false
7
-
7
+
8
8
  field :name_seo, :as => :tagname
9
9
  validates :name_seo, :uniqueness => true, :allow_nil => false
10
-
10
+
11
11
  field :descr, :type => String, :default => ''
12
-
12
+
13
13
  field :is_public, :type => Boolean, :default => true
14
14
  field :is_trash, :type => Boolean, :default => false
15
15
  field :is_feature, :type => Boolean, :default => false
16
-
16
+
17
17
  field :weight, :type => Integer, :default => 10
18
18
 
19
19
  has_many :children_tags, :class_name => 'Tag', :inverse_of => :parent_tag
@@ -47,7 +47,7 @@ class Tag
47
47
  Tag.each { |r| r.remove }
48
48
  end
49
49
  end
50
-
50
+
51
51
  def self.no_parent
52
52
  Tag.where( :parent_tag_id => nil )
53
53
  end
@@ -71,10 +71,10 @@ class Tag
71
71
  def self.n_videos
72
72
  4
73
73
  end
74
-
74
+
75
75
  # @deprecated I don't even know why I have this. Should be simplified into non-being.
76
76
  def self.n_features
77
77
  4
78
78
  end
79
-
79
+
80
80
  end
data/lib/video.rb CHANGED
@@ -56,7 +56,7 @@ class Video
56
56
  :validate_media_type => false
57
57
  validates_attachment_content_type :video, content_type: /\Avideo\/.*\Z/
58
58
 
59
- has_mongoid_attached_file :thumb,
59
+ has_mongoid_attached_file :thumb,
60
60
  :styles => {
61
61
  :mini => '20x20#',
62
62
  :thumb => "100x100#",
@@ -72,7 +72,7 @@ class Video
72
72
  :s3_protocol => 'https',
73
73
  :validate_media_type => false
74
74
  validates_attachment_content_type :thumb, :content_type => ["image/jpg", "image/jpeg", "image/png", "image/gif", 'application/octet-stream' ]
75
-
75
+
76
76
  set_callback :update, :after do |doc|
77
77
  Site.update_all updated_at: Time.now
78
78
  end
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.121
4
+ version: 0.0.33.127
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
@@ -114,12 +114,12 @@ files:
114
114
  - lib/event.rb
115
115
  - lib/feature.rb
116
116
  - lib/gallery.rb
117
- - lib/gallery2.rb
118
117
  - lib/gameui.rb
119
118
  - lib/gameui/map.rb
120
119
  - lib/gameui/marker.rb
121
120
  - lib/gameui/premium_purchase.rb
122
121
  - lib/ish/alphavantage_stockwatcher.rb
122
+ - lib/ish/ameritrade.rb
123
123
  - lib/ish/campaign.rb
124
124
  - lib/ish/covered_call.rb
125
125
  - lib/ish/covered_call_watcher.rb
@@ -169,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
169
  - !ruby/object:Gem::Version
170
170
  version: '0'
171
171
  requirements: []
172
- rubygems_version: 3.0.6
172
+ rubygems_version: 3.2.25
173
173
  signing_key:
174
174
  specification_version: 4
175
175
  summary: models of ish
data/lib/gallery2.rb DELETED
@@ -1,101 +0,0 @@
1
-
2
- class Gallery2
3
- include ::Mongoid::Document
4
- include ::Mongoid::Timestamps
5
- store_in :collection => 'galleries'
6
-
7
- field :is_feature, :type => Boolean, :default => false
8
- field :is_public, :type => Boolean, :default => false
9
- field :is_done, :type => Boolean, :default => false
10
- field :is_trash, :type => Boolean, :default => false
11
-
12
- default_scope ->{ where({ :is_public => true, :is_trash => false }).order_by({ :created_at => :desc }) }
13
- index({ :is_public => 1, :is_trash => -1, :order_by => 1 })
14
-
15
- field :x, :type => Float
16
- field :y, :type => Float
17
-
18
- def self.list conditions = { :is_trash => false }
19
- out = self.where( conditions ).order_by( :created_at => :desc )
20
- [['', nil]] + out.map { |item| [ "#{item.created_at.strftime('%Y%m%d')} #{item.name}", item.id ] }
21
- end
22
-
23
- belongs_to :site
24
- validates :site, :presence => true
25
-
26
- belongs_to :user_profile, :optional => true, :class_name => 'IshModels::UserProfile'
27
- field :username, :type => String
28
-
29
- field :name, :type => String
30
- validates :name, :uniqueness => true # , :allow_nil => false
31
-
32
- field :galleryname, :type => String
33
- index({ :galleryname => -1 }, { :unique => true })
34
- embeds_many :gallery_names, :class_name => 'Ish::GalleryName'
35
-
36
- field :subhead, :type => String
37
- field :descr, :type => String, :as => :description
38
- field :lang, :type => String, :default => 'en'
39
-
40
- has_many :photos
41
-
42
- belongs_to :tag, :optional => true
43
- belongs_to :city, :optional => true
44
- belongs_to :venue, :optional => true
45
-
46
- has_many :newsitems
47
-
48
- set_callback(:create, :before) do |doc|
49
- if doc.user_profile && doc.user_profile.username
50
- doc.username = doc.user_profile.username
51
- end
52
- doc.galleryname ||= doc.id.to_s
53
-
54
- #
55
- # newsitems
56
- #
57
- if doc.is_public
58
- # for the sites
59
- if doc.site
60
- sites = Site.where( :domain => doc.site.domain )
61
- sites.each do |site|
62
- n = Newsitem.new {}
63
- n.gallery = doc
64
- n.username = doc.username
65
- site.newsitems << n
66
- flag = site.save
67
- if !flag
68
- puts! site.errors
69
- end
70
- end
71
- end
72
- # for the city
73
- if doc.city
74
- n = Newsitem.new {}
75
- n.gallery = doc
76
- n.city = doc.city
77
- n.username = doc.username
78
- n.save
79
- end
80
- end
81
-
82
- #
83
- # cache
84
- #
85
- if doc.site
86
- doc.site.touch
87
- end
88
- if doc.city
89
- doc.city.touch
90
- end
91
-
92
- end
93
-
94
- # @deprecated, use Gallery::ACTIONS
95
- def self.actions
96
- [ 'show_mini', 'show_long', 'show' ]
97
- end
98
- ACTIONS = [ 'show_mini', 'show_long', 'show' ]
99
-
100
- end
101
-