ish_models 0.0.33.221 → 0.0.33.224
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gallery.rb +1 -7
- data/lib/ish/email_campaign.rb +1 -1
- data/lib/ish/payment.rb +4 -9
- data/lib/ish/premium_item.rb +2 -3
- data/lib/ish/user_profile.rb +23 -52
- data/lib/ish_models.rb +4 -2
- data/lib/office/email_message_stub.rb +1 -1
- data/lib/report.rb +1 -8
- data/lib/video.rb +1 -18
- metadata +1 -2
- data/lib/gameui/premium_purchase.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50675cc51e51d76bc4b1b20396f6aaa5cc21d44f8517a9f419ba64651ab47f3a
|
4
|
+
data.tar.gz: '08e520ea0df95f8fb0ae157d4b8ca1658d1d144bb02533fa14f4e11ecad35fa7'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49900207ca24ec6708fa9842a284d761e4d4b095dc0ce36374a14ed4a0014ba858461c5f6febc0813350fc5195f1c31c0bc3e577e0aed6ef7a8db4e4bdd370e1
|
7
|
+
data.tar.gz: fbaab4658c3c2d6370b71156543b4ee592b341c55862e9c708fdd8eec1071de4ca191211c23243c11c5fe8863e7eba92f84039db31bca50746c02145ebb82e87
|
data/lib/gallery.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
class Gallery
|
3
3
|
include ::Mongoid::Document
|
4
4
|
include ::Mongoid::Timestamps
|
5
|
+
include Ish::PremiumItem
|
5
6
|
include Ish::Utils
|
6
7
|
|
7
8
|
PER_PAGE = 6
|
@@ -17,13 +18,6 @@ class Gallery
|
|
17
18
|
field :is_trash, type: Boolean, default: false
|
18
19
|
field :is_done, type: Boolean, default: false
|
19
20
|
|
20
|
-
field :premium_tier, type: Integer, default: 0 # how many stars need to spend, to get access? 0 = free
|
21
|
-
def is_premium
|
22
|
-
premium_tier > 0
|
23
|
-
end
|
24
|
-
def premium?; is_premium; end
|
25
|
-
has_many :premium_purchases, class_name: '::Gameui::PremiumPurchase', as: :item
|
26
|
-
|
27
21
|
default_scope ->{ where({ :is_public => true, :is_trash => false }).order_by({ :created_at => :desc }) }
|
28
22
|
|
29
23
|
field :x, :type => Float
|
data/lib/ish/email_campaign.rb
CHANGED
@@ -16,7 +16,7 @@ class Ish::EmailCampaign
|
|
16
16
|
PAGE_PARAM_NAME = 'email_contexts_page'
|
17
17
|
|
18
18
|
FROM_EMAILS = %w| hello@infiniteshelter.com no-reply@infiniteshelter.com
|
19
|
-
piousbox@gmail.com
|
19
|
+
piousbox@gmail.com hello@piousbox.com no-reply@piousbox.com victor@piousbox.com
|
20
20
|
admin@wasya.co hello@wasya.co no-reply@wasya.co victor@wasya.co |
|
21
21
|
field :from_email
|
22
22
|
validates_presence_of :from_email
|
data/lib/ish/payment.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
|
2
|
-
|
3
2
|
class Ish::Payment
|
4
3
|
include Mongoid::Document
|
5
4
|
include Mongoid::Timestamps
|
6
5
|
|
7
|
-
belongs_to :invoice, :
|
8
|
-
belongs_to :profile, :
|
6
|
+
belongs_to :invoice, class_name: 'Ish::Invoice', optional: true
|
7
|
+
belongs_to :profile, class_name: 'Ish::UserProfile'
|
8
|
+
belongs_to :item, polymorphic: true
|
9
9
|
|
10
10
|
field :amount, :type => Integer # in cents
|
11
11
|
field :charge, :type => Hash
|
@@ -17,13 +17,8 @@ class Ish::Payment
|
|
17
17
|
field :status, type: Symbol
|
18
18
|
|
19
19
|
after_create :compute_paid_invoice_amount
|
20
|
-
|
21
|
-
protected
|
22
|
-
|
23
20
|
def compute_paid_invoice_amount
|
24
|
-
|
25
|
-
self.invoice.update_attributes :paid_amount => self.invoice.paid_amount + self.amount
|
26
|
-
end
|
21
|
+
self.invoice&.update_attributes({ paid_amount: self.invoice.paid_amount + self.amount })
|
27
22
|
end
|
28
23
|
|
29
24
|
end
|
data/lib/ish/premium_item.rb
CHANGED
@@ -2,13 +2,12 @@
|
|
2
2
|
module Ish::PremiumItem
|
3
3
|
|
4
4
|
def self.included base
|
5
|
-
base.send :field, :premium_tier, type: Integer, default: 0 # how many
|
6
|
-
base.send :has_many, :premium_purchases, class_name: '::
|
5
|
+
base.send :field, :premium_tier, type: Integer, default: 0 # how many unlocks are need, to get access? 0 = free
|
6
|
+
base.send :has_many, :premium_purchases, class_name: '::Ish::Payment', as: :item
|
7
7
|
end
|
8
8
|
|
9
9
|
def is_premium
|
10
10
|
premium_tier > 0
|
11
11
|
end
|
12
|
-
def premium?; is_premium; end
|
13
12
|
|
14
13
|
end
|
data/lib/ish/user_profile.rb
CHANGED
@@ -2,7 +2,9 @@
|
|
2
2
|
require 'ish/utils'
|
3
3
|
require 'mongoid/votable'
|
4
4
|
|
5
|
-
##
|
5
|
+
##
|
6
|
+
## It explicitly doesn't have a relation to user! Use email as key.
|
7
|
+
##
|
6
8
|
class Ish::UserProfile
|
7
9
|
include Mongoid::Document
|
8
10
|
include Mongoid::Timestamps
|
@@ -38,48 +40,18 @@ class Ish::UserProfile
|
|
38
40
|
ROLE_ADMIN = :admin
|
39
41
|
field :role_name, :type => Symbol, default: :guy
|
40
42
|
|
41
|
-
has_one :profile_photo, :class_name
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
has_many :galleries, :inverse_of => :user_profile
|
50
|
-
has_and_belongs_to_many :shared_galleries, :inverse_of => :shared_profiles, class_name: 'Gallery'
|
51
|
-
has_and_belongs_to_many :shared_markers, :inverse_of => :shared_profiles, class_name: 'Gameui::Marker'
|
52
|
-
has_many :my_markers, :inverse_of => :creator_profile, class_name: 'Gameui::Marker'
|
53
|
-
has_and_belongs_to_many :shared_locations, :inverse_of => :shared_profiles, class_name: 'Gameui::Map'
|
54
|
-
has_many :my_maps, :inverse_of => :creator_profile, class_name: 'Gameui::Map'
|
55
|
-
|
56
|
-
has_many :invoices, :class_name => '::Ish::Invoice'
|
43
|
+
has_one :profile_photo, inverse_of: :profile_city, class_name: 'Photo'
|
44
|
+
has_many :galleries, inverse_of: :user_profile
|
45
|
+
has_and_belongs_to_many :shared_galleries, inverse_of: :shared_profiles, class_name: 'Gallery'
|
46
|
+
has_and_belongs_to_many :shared_markers, inverse_of: :shared_profiles, class_name: 'Gameui::Marker'
|
47
|
+
has_and_belongs_to_many :shared_locations, inverse_of: :shared_profiles, class_name: 'Gameui::Map'
|
48
|
+
has_many :my_markers, inverse_of: :creator_profile, class_name: 'Gameui::Marker'
|
49
|
+
has_many :my_locations, inverse_of: :creator_profile, class_name: 'Gameui::Map'
|
50
|
+
has_many :invoices, class_name: '::Ish::Invoice'
|
57
51
|
has_many :photos
|
58
|
-
has_many :reports,
|
59
|
-
|
60
|
-
## @TODO: do something about this.
|
61
|
-
# has_many :stock_watches, class_name: 'IronWarbler::StockWatch'
|
62
|
-
# has_many :option_watches, class_name: 'IronWarbler::OptionWatch'
|
63
|
-
|
52
|
+
has_many :reports, inverse_of: :user_profile
|
64
53
|
has_many :videos, inverse_of: :user_profile
|
65
|
-
has_many :newsitems, inverse_of: :profile
|
66
|
-
|
67
|
-
has_and_belongs_to_many :bookmarked_locations, class_name: '::Gameui::Map', inverse_of: :bookmarked_profile
|
68
|
-
def bookmarks
|
69
|
-
bookmarked_locations
|
70
|
-
end
|
71
|
-
|
72
|
-
has_and_belongs_to_many :friends, :class_name => '::Ish::UserProfile', :inverse_of => :friendeds
|
73
|
-
has_and_belongs_to_many :friendeds, :class_name => '::Ish::UserProfile', :inverse_of => :friends
|
74
|
-
|
75
|
-
field :n_unlocks, type: Integer, default: 0
|
76
|
-
def n_coins # @deprecated, do not use
|
77
|
-
n_unlocks
|
78
|
-
end
|
79
|
-
|
80
|
-
## preferences
|
81
|
-
## @TODO: better naming convention, or remove this
|
82
|
-
field :videos_embed, :type => Boolean, :default => false
|
54
|
+
has_many :newsitems, inverse_of: :profile
|
83
55
|
|
84
56
|
def sudoer?
|
85
57
|
%w( piousbox@gmail.com victor@wasya.co ).include?( self.email )
|
@@ -89,22 +61,22 @@ class Ish::UserProfile
|
|
89
61
|
## @TODO: check this, this is shit. _vp_ 20170527
|
90
62
|
def self.list
|
91
63
|
out = self.all.order_by( :domain => :asc, :lang => :asc )
|
92
|
-
[['', nil]] + out.map { |item| [ item.name, item.id ] }
|
64
|
+
[['', nil]] + out.map { |item| [ "#{item.email} :: #{item.name}", item.id ] }
|
93
65
|
end
|
94
66
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
has_many :premium_purchases, :class_name => '::Gameui::PremiumPurchase'
|
67
|
+
field :n_unlocks, type: Integer, default: 0
|
68
|
+
|
69
|
+
has_many :payments, :class_name => '::Ish::Payment'
|
70
|
+
|
100
71
|
def has_premium_purchase item
|
101
|
-
|
102
|
-
end
|
103
|
-
def premium_purchases
|
104
|
-
::Gameui::PremiumPurchase.where( user_profile_id: self.id )
|
72
|
+
payments.where( item: item ).exists?
|
105
73
|
end
|
74
|
+
|
106
75
|
field :is_purchasing, type: Boolean, default: false
|
107
76
|
|
77
|
+
has_and_belongs_to_many :friends, :class_name => '::Ish::UserProfile', inverse_of: :friendeds
|
78
|
+
has_and_belongs_to_many :friendeds, :class_name => '::Ish::UserProfile', inverse_of: :friends
|
79
|
+
|
108
80
|
# used in rake tasks
|
109
81
|
def self.generate delta
|
110
82
|
email = delta[:email]
|
@@ -113,7 +85,6 @@ class Ish::UserProfile
|
|
113
85
|
|
114
86
|
profile = Ish::UserProfile.where( email: email ).first
|
115
87
|
if profile
|
116
|
-
puts!( profile, "UserProfile#generate, already exists" ) if !Rails.env.test?
|
117
88
|
return
|
118
89
|
end
|
119
90
|
|
data/lib/ish_models.rb
CHANGED
@@ -8,6 +8,9 @@ require 'kaminari/mongoid'
|
|
8
8
|
|
9
9
|
class Gameui; end
|
10
10
|
|
11
|
+
class Iro; end
|
12
|
+
class Iro::OptionPriceItem; end
|
13
|
+
|
11
14
|
module Ish; end
|
12
15
|
class Ish::InputError < RuntimeError; end
|
13
16
|
|
@@ -39,12 +42,11 @@ require 'mongoid/voter'
|
|
39
42
|
|
40
43
|
require 'gameui/asset3d'
|
41
44
|
require 'gameui/map'
|
42
|
-
require 'gameui/map_bookmark'
|
43
45
|
require 'gameui/marker'
|
44
|
-
require 'gameui/premium_purchase'
|
45
46
|
|
46
47
|
# require 'iro/option_price_item'
|
47
48
|
|
49
|
+
|
48
50
|
require 'ish/cache_key'
|
49
51
|
require 'ish/crawler'
|
50
52
|
require 'ish/email_campaign'
|
data/lib/report.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
class Report
|
2
2
|
include ::Mongoid::Document
|
3
3
|
include ::Mongoid::Timestamps
|
4
|
+
include Ish::PremiumItem
|
4
5
|
include Ish::Utils
|
5
6
|
|
6
7
|
field :name, :type => String
|
@@ -83,14 +84,6 @@ class Report
|
|
83
84
|
end
|
84
85
|
end
|
85
86
|
|
86
|
-
## copy-paste
|
87
|
-
field :premium_tier, type: Integer, default: 0 # how many stars need to spend, to get access? 0 = free
|
88
|
-
def is_premium
|
89
|
-
premium_tier > 0
|
90
|
-
end
|
91
|
-
def premium?; is_premium; end
|
92
|
-
has_many :premium_purchases, class_name: '::Gameui::PremiumPurchase', as: :item
|
93
|
-
|
94
87
|
def export_fields
|
95
88
|
%w| name descr |
|
96
89
|
end
|
data/lib/video.rb
CHANGED
@@ -7,6 +7,7 @@ class Video
|
|
7
7
|
include Mongoid::Timestamps
|
8
8
|
include Mongoid::Paperclip
|
9
9
|
include Mongoid::Paranoia
|
10
|
+
include Ish::PremiumItem
|
10
11
|
include Ish::Utils
|
11
12
|
|
12
13
|
include Mongoid::Votable
|
@@ -75,26 +76,8 @@ class Video
|
|
75
76
|
s3_region: ::S3_CREDENTIALS[:region]
|
76
77
|
validates_attachment_content_type :thumb, :content_type => ["image/jpg", "image/jpeg", "image/png", "image/gif", 'application/octet-stream' ]
|
77
78
|
|
78
|
-
## copy-paste
|
79
|
-
field :premium_tier, type: Integer, default: 0 # how many stars need to spend, to get access? 0 = free
|
80
|
-
def is_premium
|
81
|
-
premium_tier > 0
|
82
|
-
end
|
83
|
-
def premium?; is_premium; end
|
84
|
-
has_many :premium_purchases, class_name: '::Gameui::PremiumPurchase', as: :item
|
85
|
-
|
86
79
|
def export_fields
|
87
80
|
%w| name descr |
|
88
81
|
end
|
89
82
|
|
90
|
-
|
91
|
-
|
92
83
|
end
|
93
|
-
|
94
|
-
|
95
|
-
=begin
|
96
|
-
field :issue
|
97
|
-
|
98
|
-
field :is_feature, :type => Boolean, :default => false
|
99
|
-
field :lang, :type => String, :default => 'en'
|
100
|
-
=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.
|
4
|
+
version: 0.0.33.224
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- piousbox
|
@@ -135,7 +135,6 @@ files:
|
|
135
135
|
- lib/gameui/map.rb
|
136
136
|
- lib/gameui/map_bookmark.rb
|
137
137
|
- lib/gameui/marker.rb
|
138
|
-
- lib/gameui/premium_purchase.rb
|
139
138
|
- lib/ish/cache_key.rb
|
140
139
|
- lib/ish/configuration.rb
|
141
140
|
- lib/ish/crawler.rb
|