bodega 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.2
|
data/app/models/bodega/order.rb
CHANGED
@@ -4,7 +4,7 @@ module Bodega
|
|
4
4
|
class Order < ActiveRecord::Base
|
5
5
|
self.table_name = :bodega_orders
|
6
6
|
|
7
|
-
attr_accessible :order_products_attributes, :
|
7
|
+
attr_accessible :order_products_attributes, :postal_code, :shipping_rate_code
|
8
8
|
|
9
9
|
before_create :set_identifier
|
10
10
|
before_save :set_shipping_rates, if: :postal_code_changed?
|
@@ -111,10 +111,11 @@ module Bodega
|
|
111
111
|
|
112
112
|
protected
|
113
113
|
def calculate_shipping
|
114
|
-
self.shipping = 0
|
115
114
|
if shipping_rate_code
|
116
115
|
self.shipping_rate_name = shipping_rates[shipping_rate_code][:name]
|
117
116
|
self.shipping = shipping_rates[shipping_rate_code][:price] / 100.0
|
117
|
+
else
|
118
|
+
self.shipping = 0
|
118
119
|
end
|
119
120
|
end
|
120
121
|
|
@@ -139,7 +140,13 @@ module Bodega
|
|
139
140
|
end
|
140
141
|
|
141
142
|
def set_shipping_rates
|
142
|
-
|
143
|
+
if postal_code.present?
|
144
|
+
self.shipping_rates = shipping_method.rates
|
145
|
+
self.shipping_rate_code = shipping_rate_options.values.first
|
146
|
+
calculate_shipping
|
147
|
+
else
|
148
|
+
self.shipping_rates = self.shipping_rate_code = nil
|
149
|
+
end
|
143
150
|
@new_shipping_rates = true
|
144
151
|
end
|
145
152
|
|
@@ -19,8 +19,10 @@
|
|
19
19
|
<% end -%>
|
20
20
|
</tfoot>
|
21
21
|
</table>
|
22
|
-
<%= button_tag t('bodega.update_cart'), id: 'bodega-update', name: :update, value: 1 %>
|
23
22
|
<% if current_order.ready? -%>
|
24
|
-
<%= button_tag t('bodega.
|
23
|
+
<%= button_tag t('bodega.update_cart'), id: 'bodega-update', name: :update, value: 1 %>
|
24
|
+
<%= button_tag t('bodega.check_out'), id: 'bodega-checkout', name: :checkout, value: 1 %>
|
25
|
+
<% else -%>
|
26
|
+
<%= button_tag t('bodega.calculate_shipping'), id: 'bodega-update', name: :update, value: 1 %>
|
25
27
|
<% end -%>
|
26
28
|
<% end =%>
|
data/bodega.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "bodega"
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Flip Sasser"]
|
12
|
-
s.date = "2013-02-
|
12
|
+
s.date = "2013-02-05"
|
13
13
|
s.description = "Bodega adds checkout logic to any model in your app!"
|
14
14
|
s.email = "flip@x451.com"
|
15
15
|
s.extra_rdoc_files = [
|
data/config/locales/en.yml
CHANGED
@@ -8,9 +8,7 @@ en:
|
|
8
8
|
sold_out: "Sorry, this product is sold out."
|
9
9
|
one_in_stock: "There is only one in stock!"
|
10
10
|
x_in_stock: "There are only x in stock!"
|
11
|
-
|
12
|
-
street_2: "Apartment #1B"
|
13
|
-
city: "City"
|
14
|
-
postal_code: "Zip"
|
11
|
+
postal_code: "Enter your zip code"
|
15
12
|
order_processed: "Your order has been processed! Thank you!"
|
16
13
|
order_failed: "There was a problem processing this order. Your account has not been charged."
|
14
|
+
calculate_shipping: "Calculate Shipping"
|
@@ -11,12 +11,7 @@ class CreateBodegaOrders < ActiveRecord::Migration
|
|
11
11
|
t.string :shipping_rate_name, limit: 50
|
12
12
|
t.text :shipping_rates
|
13
13
|
t.string :tracking_number
|
14
|
-
t.string :street_1, limit: 60
|
15
|
-
t.string :street_2, limit: 60
|
16
|
-
t.string :city, limit: 60
|
17
|
-
t.string :state, limit: 3
|
18
14
|
t.string :postal_code, limit: 11
|
19
|
-
t.string :country, limit: 3
|
20
15
|
t.money :shipping
|
21
16
|
t.money :tax
|
22
17
|
t.money :total
|
@@ -35,12 +35,7 @@ module Bodega
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def location_for(location_object)
|
38
|
-
Location.new(
|
39
|
-
city: location_object.city,
|
40
|
-
state: location_object.state,
|
41
|
-
zip: location_object.postal_code,
|
42
|
-
country: location_object.country
|
43
|
-
)
|
38
|
+
Location.new(zip: location_object.postal_code)
|
44
39
|
end
|
45
40
|
|
46
41
|
def origin
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bodega
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -158,7 +158,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
158
158
|
version: '0'
|
159
159
|
segments:
|
160
160
|
- 0
|
161
|
-
hash:
|
161
|
+
hash: 1460082399436927068
|
162
162
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
163
163
|
none: false
|
164
164
|
requirements:
|