solidus_core 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of solidus_core might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/models/concerns/spree/ransackable_attributes.rb +19 -0
- data/app/models/concerns/spree/user_methods.rb +8 -0
- data/app/models/spree/address.rb +3 -0
- data/app/models/spree/base.rb +3 -0
- data/app/models/spree/line_item.rb +3 -0
- data/app/models/spree/option_value.rb +2 -0
- data/app/models/spree/order.rb +3 -0
- data/app/models/spree/permission_sets/order_management.rb +2 -0
- data/app/models/spree/price.rb +2 -0
- data/app/models/spree/product.rb +3 -0
- data/app/models/spree/product_property.rb +2 -0
- data/app/models/spree/promotion.rb +3 -0
- data/app/models/spree/promotion_code.rb +3 -1
- data/app/models/spree/return_authorization.rb +2 -0
- data/app/models/spree/shipment.rb +2 -0
- data/app/models/spree/stock_item.rb +2 -0
- data/app/models/spree/stock_movement.rb +2 -0
- data/app/models/spree/stock_transfer.rb +5 -3
- data/app/models/spree/variant.rb +3 -0
- data/app/models/spree/zone.rb +2 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4c9d8f7e575ee2b1f7282a63b107a3526650269
|
4
|
+
data.tar.gz: ecaa9e9bb8ec49d159675e49f2bbea138fbfe0de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: badb4d1790e571121a237cb462bc9fae924a0793e6d16cdd169d3cb427dcb4f725a2c610602de02a678af6fcd5d2fa4632635abbf50af741a6c54263b70ea838
|
7
|
+
data.tar.gz: 7165bf3a4b9ab49278310e03711d555b7434f5afa15311eba73afce655e3b6d3b3eba7076443a0af98f2aac2ee3192647b240d362326bfa4bcd3cbd8aaef8b77
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Spree::RansackableAttributes
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
included do
|
4
|
+
class_attribute :whitelisted_ransackable_associations
|
5
|
+
class_attribute :whitelisted_ransackable_attributes
|
6
|
+
|
7
|
+
class_attribute :default_ransackable_attributes
|
8
|
+
self.default_ransackable_attributes = %w[id name]
|
9
|
+
|
10
|
+
def self.ransackable_associations(*args)
|
11
|
+
self.whitelisted_ransackable_associations || []
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.ransackable_attributes(*args)
|
15
|
+
self.default_ransackable_attributes | (self.whitelisted_ransackable_attributes || [])
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -25,6 +25,14 @@ module Spree
|
|
25
25
|
|
26
26
|
belongs_to :ship_address, class_name: 'Spree::Address'
|
27
27
|
belongs_to :bill_address, class_name: 'Spree::Address'
|
28
|
+
|
29
|
+
def self.ransackable_associations(auth_object=nil)
|
30
|
+
%w[bill_address ship_address]
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.ransackable_attributes(auth_object=nil)
|
34
|
+
%w[id email]
|
35
|
+
end
|
28
36
|
end
|
29
37
|
|
30
38
|
# has_spree_role? simply needs to return true or false whether a user has a role or not.
|
data/app/models/spree/address.rb
CHANGED
@@ -18,6 +18,9 @@ module Spree
|
|
18
18
|
alias_attribute :first_name, :firstname
|
19
19
|
alias_attribute :last_name, :lastname
|
20
20
|
|
21
|
+
|
22
|
+
self.whitelisted_ransackable_attributes = %w[firstname lastname]
|
23
|
+
|
21
24
|
def self.build_default
|
22
25
|
country = Spree::Country.find(Spree::Config[:default_country_id]) rescue Spree::Country.first
|
23
26
|
new(country: country)
|
data/app/models/spree/base.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
class Spree::Base < ActiveRecord::Base
|
2
2
|
include Spree::Preferences::Preferable
|
3
3
|
serialize :preferences, Hash
|
4
|
+
|
5
|
+
include Spree::RansackableAttributes
|
6
|
+
|
4
7
|
after_initialize do
|
5
8
|
if has_attribute?(:preferences)
|
6
9
|
self.preferences = default_preferences.merge(preferences)
|
@@ -37,6 +37,9 @@ module Spree
|
|
37
37
|
|
38
38
|
attr_accessor :target_shipment
|
39
39
|
|
40
|
+
self.whitelisted_ransackable_associations = ['variant']
|
41
|
+
self.whitelisted_ransackable_attributes = ['variant_id']
|
42
|
+
|
40
43
|
# Sets this line item's price, cost price, and currency from this line
|
41
44
|
# item's variant if they are nil and a variant is present.
|
42
45
|
def copy_price
|
data/app/models/spree/order.rb
CHANGED
@@ -28,6 +28,9 @@ module Spree
|
|
28
28
|
go_to_state :confirm
|
29
29
|
end
|
30
30
|
|
31
|
+
self.whitelisted_ransackable_associations = %w[shipments user promotions bill_address ship_address line_items]
|
32
|
+
self.whitelisted_ransackable_attributes = %w[completed_at created_at email number state payment_state shipment_state total]
|
33
|
+
|
31
34
|
attr_reader :coupon_code
|
32
35
|
attr_accessor :temporary_address, :temporary_credit_card
|
33
36
|
|
@@ -2,6 +2,7 @@ module Spree
|
|
2
2
|
module PermissionSets
|
3
3
|
class OrderManagement < PermissionSets::Base
|
4
4
|
def activate!
|
5
|
+
can :display, Spree::ReimbursementType
|
5
6
|
can :manage, Spree::Order
|
6
7
|
can :manage, Spree::Payment
|
7
8
|
can :manage, Spree::Shipment
|
@@ -9,6 +10,7 @@ module Spree
|
|
9
10
|
can :manage, Spree::LineItem
|
10
11
|
can :manage, Spree::ReturnAuthorization
|
11
12
|
can :manage, Spree::CustomerReturn
|
13
|
+
can :manage, Spree::OrderCancellations
|
12
14
|
end
|
13
15
|
end
|
14
16
|
end
|
data/app/models/spree/price.rb
CHANGED
@@ -11,6 +11,8 @@ module Spree
|
|
11
11
|
extend DisplayMoney
|
12
12
|
money_methods :amount, :price
|
13
13
|
|
14
|
+
self.whitelisted_ransackable_attributes = ['amount']
|
15
|
+
|
14
16
|
# @return [Spree::Money] this price as a Spree::Money object
|
15
17
|
def money
|
16
18
|
Spree::Money.new(amount || 0, { currency: currency })
|
data/app/models/spree/product.rb
CHANGED
@@ -86,6 +86,9 @@ module Spree
|
|
86
86
|
|
87
87
|
alias :options :product_option_types
|
88
88
|
|
89
|
+
self.whitelisted_ransackable_associations = %w[stores variants_including_master master variants]
|
90
|
+
self.whitelisted_ransackable_attributes = %w[slug]
|
91
|
+
|
89
92
|
# @return [Boolean] true if there are any variants
|
90
93
|
def has_variants?
|
91
94
|
variants.any?
|
@@ -41,6 +41,9 @@ module Spree
|
|
41
41
|
end
|
42
42
|
scope :applied, -> { joins(:order_promotions).uniq }
|
43
43
|
|
44
|
+
self.whitelisted_ransackable_associations = ['codes']
|
45
|
+
self.whitelisted_ransackable_attributes = ['path', 'promotion_category_id']
|
46
|
+
|
44
47
|
# temporary code. remove after the column is dropped from the db.
|
45
48
|
def columns
|
46
49
|
super.reject { |column| column.name == "code" }
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class Spree::PromotionCode <
|
1
|
+
class Spree::PromotionCode < Spree::Base
|
2
2
|
belongs_to :promotion, inverse_of: :codes
|
3
3
|
has_many :adjustments
|
4
4
|
|
@@ -7,6 +7,8 @@ class Spree::PromotionCode < ActiveRecord::Base
|
|
7
7
|
|
8
8
|
before_save :downcase_value
|
9
9
|
|
10
|
+
self.whitelisted_ransackable_attributes = ['value']
|
11
|
+
|
10
12
|
# Whether the promotion code has exceeded its usage restrictions
|
11
13
|
#
|
12
14
|
# @return true or false
|
@@ -15,6 +15,8 @@ module Spree
|
|
15
15
|
after_save :conditional_variant_touch, if: :changed?
|
16
16
|
after_touch { variant.touch }
|
17
17
|
|
18
|
+
self.whitelisted_ransackable_attributes = ['count_on_hand', 'stock_location_id']
|
19
|
+
|
18
20
|
# @return [Array<Spree::InventoryUnit>] the backordered inventory units
|
19
21
|
# associated with this stock item
|
20
22
|
def backordered_inventory_units
|
@@ -7,9 +7,9 @@ module Spree
|
|
7
7
|
has_many :stock_movements, :as => :originator
|
8
8
|
has_many :transfer_items, inverse_of: :stock_transfer
|
9
9
|
|
10
|
-
belongs_to :created_by, :class_name => Spree.
|
11
|
-
belongs_to :finalized_by, :class_name => Spree.
|
12
|
-
belongs_to :closed_by, :class_name => Spree.
|
10
|
+
belongs_to :created_by, :class_name => Spree::UserClassHandle.new
|
11
|
+
belongs_to :finalized_by, :class_name => Spree::UserClassHandle.new
|
12
|
+
belongs_to :closed_by, :class_name => Spree::UserClassHandle.new
|
13
13
|
belongs_to :source_location, :class_name => 'Spree::StockLocation'
|
14
14
|
belongs_to :destination_location, :class_name => 'Spree::StockLocation'
|
15
15
|
|
@@ -20,6 +20,8 @@ module Spree
|
|
20
20
|
|
21
21
|
before_destroy :ensure_not_finalized
|
22
22
|
|
23
|
+
self.whitelisted_ransackable_attributes = %w[source_location_id destination_location_id closed_at created_at number]
|
24
|
+
|
23
25
|
def to_param
|
24
26
|
number
|
25
27
|
end
|
data/app/models/spree/variant.rb
CHANGED
@@ -66,6 +66,9 @@ module Spree
|
|
66
66
|
|
67
67
|
scope :in_stock, -> { joins(:stock_items).where('count_on_hand > ? OR track_inventory = ?', 0, false) }
|
68
68
|
|
69
|
+
self.whitelisted_ransackable_associations = %w[option_values product prices default_price]
|
70
|
+
self.whitelisted_ransackable_attributes = %w[weight sku]
|
71
|
+
|
69
72
|
# Returns variants that are not deleted and have a price in the given
|
70
73
|
# currency.
|
71
74
|
#
|
data/app/models/spree/zone.rb
CHANGED
@@ -11,6 +11,8 @@ module Spree
|
|
11
11
|
alias :members :zone_members
|
12
12
|
accepts_nested_attributes_for :zone_members, allow_destroy: true, reject_if: proc { |a| a['zoneable_id'].blank? }
|
13
13
|
|
14
|
+
self.whitelisted_ransackable_attributes = ['description']
|
15
|
+
|
14
16
|
def self.default_tax
|
15
17
|
where(default_tax: true).first
|
16
18
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solidus_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Solidus Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemerchant
|
@@ -382,6 +382,7 @@ files:
|
|
382
382
|
- app/models/concerns/spree/default_price.rb
|
383
383
|
- app/models/concerns/spree/display_money.rb
|
384
384
|
- app/models/concerns/spree/named_type.rb
|
385
|
+
- app/models/concerns/spree/ransackable_attributes.rb
|
385
386
|
- app/models/concerns/spree/user_address.rb
|
386
387
|
- app/models/concerns/spree/user_api_authentication.rb
|
387
388
|
- app/models/concerns/spree/user_methods.rb
|