ish_models 0.0.33.261 → 0.0.33.263
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ish/user_profile.rb +17 -0
- data/lib/ish_models.rb +1 -1
- data/lib/wco/appliance.rb +15 -0
- data/lib/wco/subscription.rb +5 -1
- metadata +2 -2
- data/lib/wco/organization.rb-trash +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f2df50e8844bd9d616c1d84109defdba8e03303891d9a5d683aa9f54ea320fb
|
4
|
+
data.tar.gz: 53b870fb6162e9976769c3ec552b01cf0b730dabdf811fe47a97f840e7ead17a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe6500a906340a946f2a4797e80682c6721f7d42f18ac9226cdfcfd4e9609e1a327762130f26828d8cde85fbaf2ef6968a6ae0d38d3bbe279533ae7ac548787f
|
7
|
+
data.tar.gz: 9d2687e047eb3dd943b03b4981b34cae53200eee950599ad74a6e1acec578d9ca5c05bccef106bb55e5d280526c3e282ddd19a2673abe87fba9fd027821292df
|
data/lib/ish/user_profile.rb
CHANGED
@@ -78,6 +78,7 @@ class Ish::UserProfile
|
|
78
78
|
field :n_unlocks, type: Integer, default: 0
|
79
79
|
|
80
80
|
has_many :payments, :class_name => '::Ish::Payment'
|
81
|
+
has_many :subscriptions, class_name: 'Wco::Subscription', inverse_of: :profile
|
81
82
|
|
82
83
|
def has_premium_purchase item
|
83
84
|
payments.confirmed.where( item: item ).exists?
|
@@ -87,6 +88,22 @@ class Ish::UserProfile
|
|
87
88
|
|
88
89
|
field :customer_id # stripe
|
89
90
|
|
91
|
+
def customer_id
|
92
|
+
if !self[:customer_id]
|
93
|
+
# return nil if !email
|
94
|
+
existing = Stripe::Customer.search({ query: "email: '#{email}'" })
|
95
|
+
# puts! existing, 'existing'
|
96
|
+
if existing.data.present?
|
97
|
+
update_attributes( customer_id: existing.data[0][:id] )
|
98
|
+
else
|
99
|
+
customer = Stripe::Customer.create({ email: email })
|
100
|
+
# puts! customer, 'customer'
|
101
|
+
update_attributes( customer_id: customer[:id] )
|
102
|
+
end
|
103
|
+
end
|
104
|
+
self[:customer_id]
|
105
|
+
end
|
106
|
+
|
90
107
|
# used in rake tasks
|
91
108
|
def self.generate delta
|
92
109
|
email = delta[:email]
|
data/lib/ish_models.rb
CHANGED
@@ -74,7 +74,7 @@ require 'office/email_message'
|
|
74
74
|
require 'office/email_message_stub'
|
75
75
|
require 'office/scheduled_email_action'
|
76
76
|
|
77
|
-
|
77
|
+
require 'wco/appliance'
|
78
78
|
require 'wco/product'
|
79
79
|
require 'wco/subscription'
|
80
80
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
|
2
|
+
class Wco::Appliance
|
3
|
+
include Mongoid::Document
|
4
|
+
include Mongoid::Timestamps
|
5
|
+
|
6
|
+
field :name
|
7
|
+
field :kind
|
8
|
+
field :environment
|
9
|
+
field :subdomain
|
10
|
+
field :domain
|
11
|
+
|
12
|
+
field :leadset_id
|
13
|
+
belongs_to :profile, class_name: 'Ish::UserProfile', optional: true
|
14
|
+
|
15
|
+
end
|
data/lib/wco/subscription.rb
CHANGED
@@ -6,9 +6,13 @@ class Wco::Subscription
|
|
6
6
|
field :customer_id, type: :string # stripe
|
7
7
|
field :price_id, type: :string # stripe
|
8
8
|
|
9
|
-
|
9
|
+
field :leadset_id
|
10
|
+
|
10
11
|
belongs_to :product, class_name: '::Wco::Product', inverse_of: :subscriptions
|
11
12
|
|
13
|
+
belongs_to :profile, class_name: '::Ish::UserProfile', optional: true, inverse_of: :subscriptions
|
14
|
+
|
15
|
+
|
12
16
|
end
|
13
17
|
|
14
18
|
|
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.263
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- piousbox
|
@@ -171,7 +171,7 @@ files:
|
|
171
171
|
- lib/photo.rb
|
172
172
|
- lib/report.rb
|
173
173
|
- lib/video.rb
|
174
|
-
- lib/wco/
|
174
|
+
- lib/wco/appliance.rb
|
175
175
|
- lib/wco/product.rb
|
176
176
|
- lib/wco/subscription.rb
|
177
177
|
homepage: https://wasya.co
|
@@ -1,15 +0,0 @@
|
|
1
|
-
|
2
|
-
##
|
3
|
-
## @TODO: merge this into a Leadset (sql) _vp_ 2023-08-09
|
4
|
-
##
|
5
|
-
class Wco::Organization
|
6
|
-
include Mongoid::Document
|
7
|
-
include Mongoid::Timestamps
|
8
|
-
|
9
|
-
field :name
|
10
|
-
field :customer_id # stripe
|
11
|
-
|
12
|
-
has_many :profiles, class_name: '::Ish::UserProfile', inverse_of: :organization
|
13
|
-
has_many :subscriptions, class_name: '::Wco::Subscription', inverse_of: :organization
|
14
|
-
|
15
|
-
end
|