piggybak 0.6.4 → 0.6.5

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- piggybak (0.6.4)
4
+ piggybak (0.6.5)
5
5
  activemerchant
6
6
  countries
7
7
  devise
data/README.md CHANGED
@@ -71,6 +71,8 @@ TODO
71
71
 
72
72
  * Add copy from billing above shipping address section button in admin
73
73
 
74
+ * Re-add order logging / masking payment parameters
75
+
74
76
  Copyright
75
77
  ========
76
78
 
@@ -137,7 +137,7 @@ module Piggybak
137
137
  end
138
138
 
139
139
  def self.sorted_line_item_types
140
- Piggybak::Config.line_item_types.sort { |a, b| a[1][:sort] <=> b[1][:sort] }.collect { |a| a[0] }
140
+ Piggybak::Config.line_item_types.sort { |a, b| (a[1][:sort] || 100) <=> (b[1][:sort] || 100) }.collect { |a| a[0] }
141
141
  end
142
142
  end
143
143
  end
@@ -160,7 +160,6 @@ module Piggybak
160
160
  else
161
161
  if self.to_be_cancelled
162
162
  self.status = "cancelled"
163
- # TODO: line items scope doesn't work here, maybe on new items? Fix if possible.
164
163
  elsif line_items.select { |li| li.line_item_type == "shipment" }.any? && line_items.select { |li| li.line_item_type == "shipment" }.all? { |s| s.shipment.status == "shipped" }
165
164
  self.status = "shipped"
166
165
  elsif line_items.select { |li| li.line_item_type == "shipment" }.any? && line_items.select { |li| li.line_item_type == "shipment" }.all? { |s| s.shipment.status == "processing" }
@@ -3,19 +3,12 @@ module Piggybak
3
3
  extend ActiveSupport::Concern
4
4
 
5
5
  module ClassMethods
6
-
7
6
  def acts_as_sellable
8
-
9
- has_one :piggybak_sellable, :as => "item", :class_name => "::Piggybak::Sellable"
10
-
7
+ has_one :piggybak_sellable, :as => "item", :class_name => "::Piggybak::Sellable", :inverse_of => :item
11
8
  accepts_nested_attributes_for :piggybak_sellable, :allow_destroy => true
12
-
13
9
  end
14
-
15
10
  end
16
11
  end
17
12
  end
18
13
 
19
14
  ::ActiveRecord::Base.send :include, Piggybak::ActsAsSellable
20
-
21
-
data/lib/piggybak.rb CHANGED
@@ -51,8 +51,6 @@ module Piggybak
51
51
  end
52
52
  Piggybak::Order.class_eval do
53
53
  define_method "#{k}_charge" do
54
- # Scope doesn't work here for lookup of unsaved elements
55
- # TODO: Figure out if we can fix, or specify behavior
56
54
  charge = 0
57
55
  self.line_items.each do |li|
58
56
  next if li._destroy || li.line_item_type.to_sym != k
@@ -112,7 +110,18 @@ module Piggybak
112
110
  end
113
111
 
114
112
  config.model Piggybak::Sellable do
113
+ label "Sellable"
114
+ object_label_method :admin_label
115
115
  visible false
116
+ edit do
117
+ field :sku
118
+ field :description
119
+ field :price
120
+ field :active
121
+ field :unlimited_inventory do
122
+ help "If true, backorders on this variant will be allowed, regardless of quantity on hand."
123
+ end
124
+ end
116
125
  end
117
126
 
118
127
  config.model Piggybak::Order do
@@ -1,3 +1,3 @@
1
1
  module Piggybak
2
- VERSION = "0.6.4"
2
+ VERSION = "0.6.5"
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.6.4
4
+ version: 0.6.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-10-19 00:00:00.000000000 Z
14
+ date: 2012-10-22 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
@@ -208,7 +208,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
208
208
  version: '0'
209
209
  segments:
210
210
  - 0
211
- hash: 32961448645574721
211
+ hash: 1894853370905249501
212
212
  required_rubygems_version: !ruby/object:Gem::Requirement
213
213
  none: false
214
214
  requirements:
@@ -217,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
217
217
  version: '0'
218
218
  segments:
219
219
  - 0
220
- hash: 32961448645574721
220
+ hash: 1894853370905249501
221
221
  requirements: []
222
222
  rubyforge_project:
223
223
  rubygems_version: 1.8.23