effective_orders 6.3.2 → 6.4.1

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: dcf54cb263731e52d92dde70fa2035f84ed936cdffedc4e4fb204812270f9ac6
4
- data.tar.gz: 3c12854db2e85a59e269b9e804de2828973b95e361add948012863146a181359
3
+ metadata.gz: 8b2ac16660da3661a37cd0bfddce1f01e0dd08e777b818fc78418dc76d07afaf
4
+ data.tar.gz: 2ed1b6cb0b366715d83832f080c486beb595e9b76cba13b0657513b9d755bfaf
5
5
  SHA512:
6
- metadata.gz: e627ddb5abcd86a77e66ad3ac4d880b83379fc7ed5d45188ffa662675d4fbdecbd6d1af05b4cae63a32334d529fea0a57ca7c14ef7aa9de7b59fa57bcb1de436
7
- data.tar.gz: 32fe71842c0c28eb5c27e205fec73f065eaace30de1480f3ce7e07554306180522d35f02c5c7c08a6a3e63ae67cdb1b8c028f58af2a107fb4e12f8e3f982bbbc
6
+ metadata.gz: 87e3f8815fc4e3782a09656b0336e5e4d772fbf5dcc7576e297ecf56e768bc4b4295a33a80d40c786bb234ce6f2cbefedfcc245fbc216763820c8331feb7add5
7
+ data.tar.gz: efcc30af59f519feeb7bad02c4f0ad163a9d17575fe0ce15aabadaca57fbe7e2bc800361a581912377abb4a25d5dbe61cf02f54d24ae586c45a4b4199bdd08ec
@@ -31,6 +31,9 @@ module ActsAsPurchasable
31
31
  has_many :purchased_orders, -> { where(state: EffectiveOrders::PURCHASED).order(:purchased_at) },
32
32
  through: :order_items, class_name: 'Effective::Order', source: :order
33
33
 
34
+ has_many :deferred_orders, -> { where(state: EffectiveOrders::DEFERRED).order(:created_at) },
35
+ through: :order_items, class_name: 'Effective::Order', source: :order
36
+
34
37
  # Database max integer value is 2147483647. So let's round that down and use a max/min of $20 million (2000000000)
35
38
  validates :price, presence: true
36
39
  validates :price, numericality: { less_than_or_equal_to: 2000000000, message: 'maximum price is $20,000,000' }
@@ -96,6 +99,10 @@ module ActsAsPurchasable
96
99
  purchased_order_id.present?
97
100
  end
98
101
 
102
+ def deferred?
103
+ deferred_orders.any? { |order| order.deferred? }
104
+ end
105
+
99
106
  def purchased_at
100
107
  purchased_order.try(:purchased_at)
101
108
  end
@@ -4,11 +4,13 @@ module EffectiveOrders
4
4
 
5
5
  # Include acts_as_addressable concern and allow any ActiveRecord object to call it
6
6
  initializer 'effective_orders.active_record' do |app|
7
- ActiveSupport.on_load :active_record do
8
- ActiveRecord::Base.extend(ActsAsPurchasable::Base)
9
- ActiveRecord::Base.extend(ActsAsPurchasableParent::Base)
10
- ActiveRecord::Base.extend(ActsAsSubscribable::Base)
11
- ActiveRecord::Base.extend(ActsAsSubscribableBuyer::Base)
7
+ app.config.to_prepare do
8
+ ActiveSupport.on_load :active_record do
9
+ ActiveRecord::Base.extend(ActsAsPurchasable::Base)
10
+ ActiveRecord::Base.extend(ActsAsPurchasableParent::Base)
11
+ ActiveRecord::Base.extend(ActsAsSubscribable::Base)
12
+ ActiveRecord::Base.extend(ActsAsSubscribableBuyer::Base)
13
+ end
12
14
  end
13
15
  end
14
16
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveOrders
2
- VERSION = '6.3.2'.freeze
2
+ VERSION = '6.4.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_orders
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.3.2
4
+ version: 6.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-18 00:00:00.000000000 Z
11
+ date: 2023-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails