spree_core 3.7.0 → 3.7.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: 29650107328af4517005d07604fcb0bbb1b320f3b230cf525ea5b5185c6ba9ad
4
- data.tar.gz: bb2bd5a002a4ea76220267ffce213bee8ada0b1729ff5aaae8b84f52e132905c
3
+ metadata.gz: e0dd0bbc96d64d482272852915dfdbb1ddebc7a6cc219bd6401a6f589072a0fe
4
+ data.tar.gz: 6daeb36116e792adae64e718e5026d3242f17cba858e0b14bd9b7fd1eca35a4f
5
5
  SHA512:
6
- metadata.gz: 455068e019649a50acc0f6a362be017c5255631526f788824be75fa69c3579bcbd53d4338edd454142ec8011ae7a17832f4eed2cb7b52fe0c7424746187b635d
7
- data.tar.gz: e3071c8e8a693ebad94d06e1bc73b15ffcdcefd809cb052577f3bfc2cfa05a097c423577ff50b093a46ad0d025976f6ab880056edb27b377ffd7282c08cd693e
6
+ metadata.gz: ed5e760973d8dd27db03b90eab449a026b69bbe2fb2693ad2f0e5f9f80d1d725c734f90c80caf90c491da71efb1f2d7934b2c8868faf9541a6a2c6c0c1e75048
7
+ data.tar.gz: 12bf3f8c265308aeae44d6953ab2b70ed7387038227948522cb6f7588744b618f1ccecabfc90c100e04fe8a1eb4b2e3d076aeb2096fe1bf6d9421eaaa3278652
@@ -5,6 +5,7 @@ module Spree
5
5
  @scope = scope
6
6
 
7
7
  @ids = String(params.dig(:filter, :ids)).split(',')
8
+ @skus = String(params.dig(:filter, :skus)).split(',')
8
9
  @price = String(params.dig(:filter, :price)).split(',')
9
10
  @currency = params[:currency] || current_currency
10
11
  @taxons = String(params.dig(:filter, :taxons)).split(',')
@@ -14,6 +15,7 @@ module Spree
14
15
 
15
16
  def execute
16
17
  products = by_ids(scope)
18
+ products = by_skus(products)
17
19
  products = by_price(products)
18
20
  products = by_taxons(products)
19
21
  products = by_name(products)
@@ -24,12 +26,16 @@ module Spree
24
26
 
25
27
  private
26
28
 
27
- attr_reader :ids, :price, :currency, :taxons, :name, :options, :scope
29
+ attr_reader :ids, :skus, :price, :currency, :taxons, :name, :options, :scope
28
30
 
29
31
  def ids?
30
32
  ids.present?
31
33
  end
32
34
 
35
+ def skus?
36
+ skus.present?
37
+ end
38
+
33
39
  def price?
34
40
  price.present?
35
41
  end
@@ -56,6 +62,12 @@ module Spree
56
62
  products.where(id: ids)
57
63
  end
58
64
 
65
+ def by_skus(products)
66
+ return products unless skus?
67
+
68
+ products.joins(:variants_including_master).distinct.where(spree_variants: { sku: skus })
69
+ end
70
+
59
71
  def by_price(products)
60
72
  return products unless price?
61
73
 
@@ -103,15 +103,15 @@ module Spree
103
103
  belongs_to :store, class_name: 'Spree::Store'
104
104
 
105
105
  with_options dependent: :destroy do
106
- has_many :state_changes, as: :stateful
107
- has_many :line_items, -> { order(:created_at) }, inverse_of: :order
108
- has_many :payments
109
- has_many :return_authorizations, inverse_of: :order
110
- has_many :adjustments, -> { order(:created_at) }, as: :adjustable
106
+ has_many :state_changes, as: :stateful, class_name: 'Spree::StateChange'
107
+ has_many :line_items, -> { order(:created_at) }, inverse_of: :order, class_name: 'Spree::LineItem'
108
+ has_many :payments, class_name: 'Spree::Payment'
109
+ has_many :return_authorizations, inverse_of: :order, class_name: 'Spree::ReturnAuthorization'
110
+ has_many :adjustments, -> { order(:created_at) }, as: :adjustable, class_name: 'Spree::Adjustment'
111
111
  end
112
- has_many :reimbursements, inverse_of: :order
112
+ has_many :reimbursements, inverse_of: :order, class_name: 'Spree::Reimbursement'
113
113
  has_many :line_item_adjustments, through: :line_items, source: :adjustments
114
- has_many :inventory_units, inverse_of: :order
114
+ has_many :inventory_units, inverse_of: :order, class_name: 'Spree::InventoryUnit'
115
115
  has_many :variants, through: :line_items
116
116
  has_many :products, through: :variants
117
117
  has_many :refunds, through: :payments
@@ -124,7 +124,7 @@ module Spree
124
124
  has_many :order_promotions, class_name: 'Spree::OrderPromotion'
125
125
  has_many :promotions, through: :order_promotions, class_name: 'Spree::Promotion'
126
126
 
127
- has_many :shipments, dependent: :destroy, inverse_of: :order do
127
+ has_many :shipments, class_name: 'Spree::Shipment', dependent: :destroy, inverse_of: :order do
128
128
  def states
129
129
  pluck(:state).uniq
130
130
  end
@@ -1,5 +1,5 @@
1
1
  module Spree
2
- class PaymentMethod::Check < PaymentMethod
2
+ class PaymentMethod::Check < ::Spree::PaymentMethod
3
3
  def actions
4
4
  %w{capture void}
5
5
  end
@@ -1,5 +1,5 @@
1
1
  module Spree
2
- class PaymentMethod::StoreCredit < PaymentMethod
2
+ class PaymentMethod::StoreCredit < ::Spree::PaymentMethod
3
3
  def payment_source_class
4
4
  ::Spree::StoreCredit
5
5
  end
@@ -11,7 +11,7 @@ module Spree
11
11
 
12
12
  def shipments
13
13
  packages.map do |package|
14
- package.to_shipment.tap { |s| s.address = order.ship_address }
14
+ package.to_shipment.tap { |s| s.address_id = order.ship_address_id }
15
15
  end
16
16
  end
17
17
 
@@ -9,10 +9,10 @@ module Spree
9
9
  @order.line_items.map do |line_item|
10
10
  # They go through multiple splits, avoid loading the
11
11
  # association to order until needed.
12
- InventoryUnit.new(
12
+ Spree::InventoryUnit.new(
13
13
  pending: true,
14
- line_item: line_item,
15
- variant: line_item.variant,
14
+ line_item_id: line_item.id,
15
+ variant_id: line_item.variant_id,
16
16
  quantity: line_item.quantity,
17
17
  order_id: @order.id
18
18
  )
@@ -1,5 +1,5 @@
1
1
  module Spree
2
2
  def self.version
3
- '3.7.0'
3
+ '3.7.1'
4
4
  end
5
5
  end
data/spree_core.gemspec CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
26
26
  s.add_dependency 'carmen', '~> 1.0.0'
27
27
  s.add_dependency 'cancancan', '~> 2.0'
28
28
  s.add_dependency 'deface', '~> 1.0'
29
- s.add_dependency 'ffaker', '~> 2.2'
29
+ s.add_dependency 'ffaker', '~> 2.9'
30
30
  s.add_dependency 'friendly_id', '~> 5.2.1'
31
31
  s.add_dependency 'highline', '~> 2.0.0' # Necessary for the install generator
32
32
  s.add_dependency 'kaminari', '~> 1.0.1'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.0
4
+ version: 3.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Schofield
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-04 00:00:00.000000000 Z
11
+ date: 2019-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemerchant
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '2.2'
103
+ version: '2.9'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '2.2'
110
+ version: '2.9'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: friendly_id
113
113
  requirement: !ruby/object:Gem::Requirement