ish_models 0.0.33.260 → 0.0.33.262

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: 6291450aa3af2a529bc54e193556c1463ee7cfaad5161ad2e777cfe39c09b9dd
4
- data.tar.gz: 36613413540c6348a4b752b1c1d3b32c6ff0d4f00023a92e398a45db1bcea500
3
+ metadata.gz: 13bfe2911d03e04ce0b341bb14700028daf46cfa03cbfc27d2b86e9c91332456
4
+ data.tar.gz: 99bfae4d6e056610ecc8b682445456d25b93cbf49c244fab913f1be9fa2b3d16
5
5
  SHA512:
6
- metadata.gz: 786129d1e89cff3d9584f90a031421a2bd491780a47c9cc2043d4ab8f38219bb86f5f14447682f697ad9efb69d43c5afce4ad0bc5a6be5549038c151dd70f8e2
7
- data.tar.gz: f25a822b37ae6f9209318e7c550600792921fa9c82e8561a06563d2f9d3f6f6ddfcd8565063da20d66a6121dd2a8781ac4666e16855795cd589d68dd2c4446bb
6
+ metadata.gz: efa53c7e32b76bb2bbe70c952160decec8e0ccd20eecd050c275708522e07b506975f6bb6673dedf3efd41ac08a4754ef89ac8013c248616bf22320a18e4f2f8
7
+ data.tar.gz: 79ec4e2804c080b5333eb55b8af9939157959671c88e438154f09fe92ad2dbaf7b712136cf4b8708462febb772c0e94ef2da212845160c7615bc0b1695b067f0
data/lib/gallery.rb CHANGED
@@ -28,6 +28,7 @@ class Gallery
28
28
 
29
29
  field :lang, :default => 'en'
30
30
  field :username
31
+ field :lead_id, type: :integer
31
32
 
32
33
  field :slug
33
34
  index({ :slug => -1 }, { :unique => true })
@@ -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/video.rb CHANGED
@@ -30,6 +30,8 @@ class Video
30
30
 
31
31
  field :is_public, :type => Boolean, :default => false
32
32
 
33
+ field :lead_id, type: :integer
34
+
33
35
  field :x, type: Float
34
36
  field :y, type: Float
35
37
  field :z, type: Float
data/lib/wco/product.rb CHANGED
@@ -16,7 +16,7 @@ class Wco::Product
16
16
  has_many :subscriptions, class_name: '::Wco::Subscription', inverse_of: :subscription
17
17
 
18
18
  def self.list
19
- [ [nil,nil] ] + self.all.map { |i| [i.name, i.price_id] }
19
+ [ [nil,nil] ] + self.all.map { |i| [i.name, i.id] }
20
20
  end
21
21
 
22
22
  end
@@ -3,7 +3,16 @@ class Wco::Subscription
3
3
  include Mongoid::Document
4
4
  include Mongoid::Timestamps
5
5
 
6
- # belongs_to :organization, class_name: '::Wco::Organization', inverse_of: :subscriptions
6
+ field :customer_id, type: :string # stripe
7
+ field :price_id, type: :string # stripe
8
+
9
+ field :leadset_id
10
+
7
11
  belongs_to :product, class_name: '::Wco::Product', inverse_of: :subscriptions
8
12
 
13
+ belongs_to :profile, class_name: '::Ish::UserProfile', optional: true, inverse_of: :subscriptions
14
+
15
+
9
16
  end
17
+
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.260
4
+ version: 0.0.33.262
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox