piggybak 0.7.0 → 0.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
  SHA1:
3
- metadata.gz: 9cdf2d5cc0e37659ae8f4feced76d5962cc06951
4
- data.tar.gz: 4588a015c22ef9592f318cfe73eed056e408661f
3
+ metadata.gz: 4470f4fbdba7afd56c0a7e3613540222c9e86c2a
4
+ data.tar.gz: da084dbabde7d4edaa8c435399961701ccf8a21e
5
5
  SHA512:
6
- metadata.gz: 0922ce19a2e5ee163b94d88b832b8cc859a28d1dbb1fade281a2884ef05a447a786d0878c1e7b974a7b8c41b448ea367f6db4ce324f0c2070e9bd91b876f76ab
7
- data.tar.gz: 12962e94a387f5153892f27a3ab72acbde68ad548ae4c4d90750557345b6e5ad4baeba6030295db95a7f549e2d2a50c1541f3672a109a4415d4bf6016598a2c8
6
+ metadata.gz: 1b07bb758a5d9ecf2f8021ec00d26e747df8dead296a6b8a12506a9f275e1e19794f5f51765ae241f39109a1e152102f6e117b49e3c4f3be36fe9223b5b9d677
7
+ data.tar.gz: 16f9e4f36cd536d3a0847a1c6a9ce73c7ec892fb366828921e6e4b14e59d8d7de24682c1a5f051592b5ce2f250db0b638ebf84af262afea6717f7c3573b0db16
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- piggybak (0.7.0)
4
+ piggybak (0.7.1)
5
5
  activemerchant
6
6
  countries
7
7
  rack-ssl-enforcer
data/README.md CHANGED
@@ -11,7 +11,7 @@ Modular / mountable ecommerce gem. Features:
11
11
 
12
12
  * Fully defined backend RailsAdmin interface for adding orders on the backend
13
13
 
14
- * Piggybak 0.7.0 is compatible with Rails 4, and earlier versions compatible with Rails 3.
14
+ * Piggybak 0.7.1 is compatible with Rails 4.1, 0.7.0 is compatible with Rails 4, and earlier version compatible with Rails 3.
15
15
 
16
16
 
17
17
  Announcements
@@ -74,7 +74,7 @@ module Piggybak
74
74
  return
75
75
  end
76
76
 
77
- @order = Piggybak::Order.find(session[:last_order])
77
+ @order = Piggybak::Order.where(id: session[:last_order]).first
78
78
  end
79
79
 
80
80
  def list
@@ -82,7 +82,7 @@ module Piggybak
82
82
  end
83
83
 
84
84
  def download
85
- @order = Piggybak::Order.find(params[:id])
85
+ @order = Piggybak::Order.where(id: params[:id]).first
86
86
 
87
87
  if can?(:download, @order)
88
88
  render :layout => false
@@ -92,7 +92,7 @@ module Piggybak
92
92
  end
93
93
 
94
94
  def email
95
- order = Piggybak::Order.find(params[:id])
95
+ order = Piggybak::Order.where(id: params[:id]).first
96
96
 
97
97
  if can?(:email, order)
98
98
  Piggybak::Notifier.order_notification(order).deliver
@@ -104,7 +104,7 @@ module Piggybak
104
104
  end
105
105
 
106
106
  def cancel
107
- order = Piggybak::Order.find(params[:id])
107
+ order = Piggybak::Order.where(id: params[:id]).first
108
108
 
109
109
  if can?(:cancel, order)
110
110
  order.recorded_changer = current_user.id
@@ -19,7 +19,7 @@ module Piggybak
19
19
  attr_accessor :is_shipping
20
20
 
21
21
  def set_default_country
22
- self.country ||= Country.find_by_abbr(Piggybak.config.default_country)
22
+ self.country ||= Country.where(abbr: Piggybak.config.default_country).first
23
23
  end
24
24
 
25
25
  def admin_label
@@ -12,7 +12,7 @@ module Piggybak
12
12
  self.errors = []
13
13
  cookie ||= ''
14
14
  cookie.split(';').each do |item|
15
- item_sellable = Piggybak::Sellable.find_by_id(item.split(':')[0])
15
+ item_sellable = Piggybak::Sellable.where(id: item.split(':')[0]).first
16
16
  if item_sellable.present?
17
17
  self.sellables << { :sellable => item_sellable, :quantity => (item.split(':')[1]).to_i }
18
18
  end
@@ -9,7 +9,7 @@ module Piggybak
9
9
  validates :quantity, presence: true
10
10
  validates_numericality_of :quantity, :only_integer => true, :greater_than_or_equal_to => 0
11
11
 
12
- default_scope :order => 'created_at ASC'
12
+ default_scope { order('created_at ASC') }
13
13
 
14
14
  after_create :decrease_inventory, :if => Proc.new { |line_item| line_item.line_item_type == 'sellable' && !line_item.sellable.unlimited_inventory }
15
15
  after_destroy :increase_inventory, :if => Proc.new { |line_item| line_item.line_item_type == 'sellable' && !line_item.sellable.unlimited_inventory }
@@ -46,7 +46,7 @@ module Piggybak
46
46
  return
47
47
  end
48
48
 
49
- sellable = Piggybak::Sellable.find(self.sellable_id)
49
+ sellable = Piggybak::Sellable.where(id: self.sellable_id).first
50
50
 
51
51
  return if sellable.nil?
52
52
 
@@ -85,7 +85,7 @@ module Piggybak
85
85
  def preprocess_payment
86
86
  if self.new_record?
87
87
  self.build_payment if self.payment.nil?
88
- self.payment.payment_method_id ||= Piggybak::PaymentMethod.find_by_active(true).id
88
+ self.payment.payment_method_id ||= Piggybak::PaymentMethod.where(active: true).first.id
89
89
  self.description = "Payment"
90
90
  self.price = 0
91
91
  end
@@ -140,7 +140,7 @@ module Piggybak
140
140
 
141
141
  def update_inventory
142
142
  if self.sellable_id != self.sellable_id_was
143
- old_sellable = Sellable.find(self.sellable_id_was)
143
+ old_sellable = Sellable.where(id: self.sellable_id_was).first
144
144
  old_sellable.update_inventory(self.quantity_was)
145
145
  self.sellable.update_inventory(-1*self.quantity)
146
146
  else
@@ -30,7 +30,7 @@ module Piggybak
30
30
  after_save :record_order_note
31
31
  after_save :deliver_order_confirmation, :if => Proc.new { |order| !order.confirmation_sent }
32
32
 
33
- default_scope :order => 'created_at DESC'
33
+ default_scope { order('created_at ASC') }
34
34
 
35
35
  def deliver_order_confirmation
36
36
  Piggybak::Notifier.order_notification(self).deliver
@@ -5,7 +5,7 @@ module Piggybak
5
5
 
6
6
  belongs_to :order
7
7
  belongs_to :user
8
- default_scope :order => 'created_at ASC'
8
+ default_scope { order('created_at ASC') }
9
9
 
10
10
  def details
11
11
  "<b>#{created_at.strftime("%m-%d-%Y %H:%M")}</b> by #{user ? user.email : 'N/A'}:<br />#{note}"
@@ -26,7 +26,7 @@ module Piggybak
26
26
  end
27
27
  end
28
28
  validates_each :active do |record, attr, value|
29
- if value && PaymentMethod.find_all_by_active(true).select { |p| p != record }.size > 0
29
+ if value && PaymentMethod.where(active: true).select { |p| p != record }.size > 0
30
30
  record.errors.add attr, "You may only have one active payment method."
31
31
  end
32
32
  end
@@ -27,13 +27,13 @@ module Piggybak
27
27
  end
28
28
 
29
29
  def self.available_methods(cart)
30
- active_methods = ShippingMethod.find_all_by_active(true)
30
+ active_methods = ShippingMethod.where(active: true)
31
31
 
32
32
  active_methods.select { |method| method.klass.constantize.available?(method, cart) }
33
33
  end
34
34
 
35
35
  def self.lookup_methods(cart)
36
- active_methods = ShippingMethod.find_all_by_active(true)
36
+ active_methods = ShippingMethod.where(active: true)
37
37
 
38
38
  methods = active_methods.inject([]) do |arr, method|
39
39
  klass = method.klass.constantize
@@ -6,7 +6,7 @@ module Piggybak
6
6
  id = method.metadata.detect { |t| t.key == "state_id" }.value
7
7
 
8
8
  if object.is_a?(Cart) && object.extra_data.has_key?(:state_id) && object.extra_data[:state_id] != ''
9
- state = State.find(object.extra_data[:state_id])
9
+ state = State.where(id: object.extra_data[:state_id]).first
10
10
  return state.id == id.to_i if state
11
11
  elsif object.is_a?(Order) && object.billing_address && object.billing_address.state
12
12
  return object.billing_address.state.id == id.to_i
@@ -1,3 +1,3 @@
1
1
  module Piggybak
2
- VERSION = "0.7.0"
2
+ VERSION = "0.7.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: piggybak
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steph Skardal
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-03-31 00:00:00.000000000 Z
13
+ date: 2014-04-07 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: countries