spree_sample 1.3.2 → 1.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/db/samples/addresses.rb +28 -0
- data/db/samples/adjustments.rb +40 -0
- data/db/samples/assets.rb +158 -0
- data/db/{sample/spree/products → samples/images}/apache_baseball.png +0 -0
- data/db/{sample/spree/products → samples/images}/ror_bag.jpeg +0 -0
- data/db/{sample/spree/products → samples/images}/ror_baseball.jpeg +0 -0
- data/db/{sample/spree/products → samples/images}/ror_baseball_back.jpeg +0 -0
- data/db/{sample/spree/products → samples/images}/ror_baseball_jersey_back_blue.png +0 -0
- data/db/{sample/spree/products → samples/images}/ror_baseball_jersey_back_green.png +0 -0
- data/db/{sample/spree/products → samples/images}/ror_baseball_jersey_back_red.png +0 -0
- data/db/{sample/spree/products → samples/images}/ror_baseball_jersey_blue.png +0 -0
- data/db/{sample/spree/products → samples/images}/ror_baseball_jersey_green.png +0 -0
- data/db/{sample/spree/products → samples/images}/ror_baseball_jersey_red.png +0 -0
- data/db/{sample/spree/products → samples/images}/ror_jr_spaghetti.jpeg +0 -0
- data/db/{sample/spree/products → samples/images}/ror_mug.jpeg +0 -0
- data/db/{sample/spree/products → samples/images}/ror_mug_back.jpeg +0 -0
- data/db/{sample/spree/products → samples/images}/ror_ringer.jpeg +0 -0
- data/db/{sample/spree/products → samples/images}/ror_ringer_back.jpeg +0 -0
- data/db/{sample/spree/products → samples/images}/ror_stein.jpeg +0 -0
- data/db/{sample/spree/products → samples/images}/ror_stein_back.jpeg +0 -0
- data/db/{sample/spree/products → samples/images}/ror_tote.jpeg +0 -0
- data/db/{sample/spree/products → samples/images}/ror_tote_back.jpeg +0 -0
- data/db/{sample/spree/products → samples/images}/ruby_baseball.png +0 -0
- data/db/{sample/spree/products → samples/images}/spree_bag.jpeg +0 -0
- data/db/{sample/spree/products → samples/images}/spree_jersey.jpeg +0 -0
- data/db/{sample/spree/products → samples/images}/spree_jersey_back.jpeg +0 -0
- data/db/{sample/spree/products → samples/images}/spree_mug.jpeg +0 -0
- data/db/{sample/spree/products → samples/images}/spree_mug_back.jpeg +0 -0
- data/db/{sample/spree/products → samples/images}/spree_ringer_t.jpeg +0 -0
- data/db/{sample/spree/products → samples/images}/spree_ringer_t_back.jpeg +0 -0
- data/db/{sample/spree/products → samples/images}/spree_spaghetti.jpeg +0 -0
- data/db/{sample/spree/products → samples/images}/spree_stein.jpeg +0 -0
- data/db/{sample/spree/products → samples/images}/spree_stein_back.jpeg +0 -0
- data/db/{sample/spree/products → samples/images}/spree_tote_back.jpeg +0 -0
- data/db/{sample/spree/products → samples/images}/spree_tote_front.jpeg +0 -0
- data/db/samples/line_items.rb +16 -0
- data/db/samples/option_types.rb +16 -0
- data/db/samples/option_values.rb +53 -0
- data/db/samples/orders.rb +26 -0
- data/db/samples/payment_methods.rb +43 -0
- data/db/{sample/spree → samples}/payments.rb +1 -4
- data/db/samples/product_option_types.rb +12 -0
- data/db/samples/product_properties.rb +118 -0
- data/db/samples/products.rb +122 -0
- data/db/samples/prototypes.rb +21 -0
- data/db/samples/shipments.rb +18 -0
- data/db/samples/shipping_categories.rb +1 -0
- data/db/samples/shipping_methods.rb +49 -0
- data/db/samples/tax_categories.rb +2 -0
- data/db/samples/tax_rates.rb +10 -0
- data/db/samples/taxonomies.rb +8 -0
- data/db/samples/taxons.rb +121 -0
- data/db/samples/variants.rb +170 -0
- data/db/samples.rb +2 -0
- data/lib/spree/sample.rb +17 -0
- data/lib/spree_sample.rb +24 -0
- data/lib/tasks/sample.rake +17 -4
- metadata +64 -76
- data/db/sample/spree/addresses.yml +0 -27
- data/db/sample/spree/adjustments.yml +0 -26
- data/db/sample/spree/assets.yml +0 -440
- data/db/sample/spree/calculators.yml +0 -26
- data/db/sample/spree/inventory_units.rb +0 -4
- data/db/sample/spree/line_items.yml +0 -40
- data/db/sample/spree/option_types.yml +0 -8
- data/db/sample/spree/option_values.yml +0 -35
- data/db/sample/spree/orders.yml +0 -20
- data/db/sample/spree/payment_methods.yml +0 -29
- data/db/sample/spree/preferences.rb +0 -21
- data/db/sample/spree/prices.yml +0 -224
- data/db/sample/spree/product_option_types.yml +0 -16
- data/db/sample/spree/product_properties.yml +0 -264
- data/db/sample/spree/products.rb +0 -15
- data/db/sample/spree/products.yml +0 -108
- data/db/sample/spree/properties.yml +0 -39
- data/db/sample/spree/prototypes.yml +0 -9
- data/db/sample/spree/shipments.yml +0 -8
- data/db/sample/spree/shipping_categories.yml +0 -2
- data/db/sample/spree/shipping_methods.yml +0 -12
- data/db/sample/spree/tax_categories.yml +0 -6
- data/db/sample/spree/tax_rates.yml +0 -4
- data/db/sample/spree/taxonomies.yml +0 -4
- data/db/sample/spree/taxons.rb +0 -3
- data/db/sample/spree/taxons.yml +0 -100
- data/db/sample/spree/variants.yml +0 -174
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 66ccc4bd3816eea018e1ebd35fb2d7aff860bbd7
|
4
|
+
data.tar.gz: d3dc13ae79d572cac9f37cea71371bb8ed2e00d5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 11dc70d73b9de654592c84e822ff7b9736ae6099c3a66aaa00d19ca042a875ac17fb0f0dcac5fbf66cf18f32bd667c73babc47341209f85f9d54ad84f6daccaa
|
7
|
+
data.tar.gz: 13cdb9e5e22514275c4f6022138a007276e82c635041d4673c37f1773753147280a6175fd820c54c09561a23fd7c338eb2cfd06f95c41759fb1547b450c69364
|
@@ -0,0 +1,28 @@
|
|
1
|
+
united_states = Spree::Country.find_by_name!("United States")
|
2
|
+
new_york = Spree::State.find_by_name!("New York")
|
3
|
+
|
4
|
+
# Billing address
|
5
|
+
Spree::Address.create!({
|
6
|
+
:firstname => Faker::Name.first_name,
|
7
|
+
:lastname => Faker::Name.last_name,
|
8
|
+
:address1 => Faker::Address.street_address,
|
9
|
+
:address2 => Faker::Address.secondary_address,
|
10
|
+
:city => Faker::Address.city,
|
11
|
+
:state => new_york,
|
12
|
+
:zipcode => 16804,
|
13
|
+
:country => united_states,
|
14
|
+
:phone => Faker::PhoneNumber.phone_number
|
15
|
+
}, :without_protection => true)
|
16
|
+
|
17
|
+
#Shipping address
|
18
|
+
Spree::Address.create!({
|
19
|
+
:firstname => Faker::Name.first_name,
|
20
|
+
:lastname => Faker::Name.last_name,
|
21
|
+
:address1 => Faker::Address.street_address,
|
22
|
+
:address2 => Faker::Address.secondary_address,
|
23
|
+
:city => Faker::Address.city,
|
24
|
+
:state => new_york,
|
25
|
+
:zipcode => 16804,
|
26
|
+
:country => united_states,
|
27
|
+
:phone => Faker::PhoneNumber.phone_number
|
28
|
+
}, :without_protection => true)
|
@@ -0,0 +1,40 @@
|
|
1
|
+
Spree::Sample.load_sample("orders")
|
2
|
+
|
3
|
+
first_order = Spree::Order.find_by_number!("R123456789")
|
4
|
+
last_order = Spree::Order.find_by_number!("R987654321")
|
5
|
+
|
6
|
+
first_order.adjustments.create!({
|
7
|
+
:amount => 0,
|
8
|
+
:source => first_order,
|
9
|
+
:originator => Spree::TaxRate.find_by_name!("North America"),
|
10
|
+
:label => "Tax",
|
11
|
+
:locked => false,
|
12
|
+
:mandatory => true
|
13
|
+
}, :without_protection => true)
|
14
|
+
|
15
|
+
last_order.adjustments.create!({
|
16
|
+
:amount => 0,
|
17
|
+
:source => last_order,
|
18
|
+
:originator => Spree::TaxRate.find_by_name!("North America"),
|
19
|
+
:label => "Tax",
|
20
|
+
:locked => false,
|
21
|
+
:mandatory => true
|
22
|
+
}, :without_protection => true)
|
23
|
+
|
24
|
+
first_order.adjustments.create!({
|
25
|
+
:amount => 0,
|
26
|
+
:source => first_order,
|
27
|
+
:originator => Spree::ShippingMethod.find_by_name!("UPS Ground (USD)"),
|
28
|
+
:label => "Shipping",
|
29
|
+
:locked => true,
|
30
|
+
:mandatory => true
|
31
|
+
}, :without_protection => true)
|
32
|
+
|
33
|
+
last_order.adjustments.create!({
|
34
|
+
:amount => 0,
|
35
|
+
:source => last_order,
|
36
|
+
:originator => Spree::ShippingMethod.find_by_name!("UPS Ground (USD)"),
|
37
|
+
:label => "Shipping",
|
38
|
+
:locked => true,
|
39
|
+
:mandatory => true
|
40
|
+
}, :without_protection => true)
|
@@ -0,0 +1,158 @@
|
|
1
|
+
Spree::Sample.load_sample("products")
|
2
|
+
Spree::Sample.load_sample("variants")
|
3
|
+
|
4
|
+
products = {}
|
5
|
+
products[:ror_baseball_jersey] = Spree::Product.find_by_name!("Ruby on Rails Baseball Jersey")
|
6
|
+
products[:ror_tote] = Spree::Product.find_by_name!("Ruby on Rails Tote")
|
7
|
+
products[:ror_bag] = Spree::Product.find_by_name!("Ruby on Rails Bag")
|
8
|
+
products[:ror_jr_spaghetti] = Spree::Product.find_by_name!("Ruby on Rails Jr. Spaghetti")
|
9
|
+
products[:ror_mug] = Spree::Product.find_by_name!("Ruby on Rails Mug")
|
10
|
+
products[:ror_ringer] = Spree::Product.find_by_name!("Ruby on Rails Ringer T-Shirt")
|
11
|
+
products[:ror_stein] = Spree::Product.find_by_name!("Ruby on Rails Stein")
|
12
|
+
products[:spree_baseball_jersey] = Spree::Product.find_by_name!("Spree Baseball Jersey")
|
13
|
+
products[:spree_stein] = Spree::Product.find_by_name!("Spree Stein")
|
14
|
+
products[:spree_jr_spaghetti] = Spree::Product.find_by_name!("Spree Jr. Spaghetti")
|
15
|
+
products[:spree_mug] = Spree::Product.find_by_name!("Spree Mug")
|
16
|
+
products[:spree_ringer] = Spree::Product.find_by_name!("Spree Ringer T-Shirt")
|
17
|
+
products[:spree_tote] = Spree::Product.find_by_name!("Spree Tote")
|
18
|
+
products[:spree_bag] = Spree::Product.find_by_name!("Spree Bag")
|
19
|
+
products[:ruby_baseball_jersey] = Spree::Product.find_by_name!("Ruby Baseball Jersey")
|
20
|
+
products[:apache_baseball_jersey] = Spree::Product.find_by_name!("Apache Baseball Jersey")
|
21
|
+
|
22
|
+
|
23
|
+
def image(name, type="jpeg")
|
24
|
+
images_path = Pathname.new(File.dirname(__FILE__)) + "images"
|
25
|
+
path = images_path + "#{name}.#{type}"
|
26
|
+
return false if !File.exist?(path)
|
27
|
+
File.open(path)
|
28
|
+
end
|
29
|
+
|
30
|
+
images = {
|
31
|
+
products[:ror_tote].master => [
|
32
|
+
{
|
33
|
+
:attachment => image("ror_tote")
|
34
|
+
},
|
35
|
+
{
|
36
|
+
:attachment => image("ror_tote_back")
|
37
|
+
}
|
38
|
+
],
|
39
|
+
products[:ror_bag].master => [
|
40
|
+
{
|
41
|
+
:attachment => image("ror_bag")
|
42
|
+
}
|
43
|
+
],
|
44
|
+
products[:ror_baseball_jersey].master => [
|
45
|
+
{
|
46
|
+
:attachment => image("ror_baseball")
|
47
|
+
},
|
48
|
+
{
|
49
|
+
:attachment => image("ror_baseball_back")
|
50
|
+
}
|
51
|
+
],
|
52
|
+
products[:ror_jr_spaghetti].master => [
|
53
|
+
{
|
54
|
+
:attachment => image("ror_jr_spaghetti")
|
55
|
+
}
|
56
|
+
],
|
57
|
+
products[:ror_mug].master => [
|
58
|
+
{
|
59
|
+
:attachment => image("ror_mug")
|
60
|
+
},
|
61
|
+
{
|
62
|
+
:attachment => image("ror_mug_back")
|
63
|
+
}
|
64
|
+
],
|
65
|
+
products[:ror_ringer].master => [
|
66
|
+
{
|
67
|
+
:attachment => image("ror_ringer")
|
68
|
+
},
|
69
|
+
{
|
70
|
+
:attachment => image("ror_ringer_back")
|
71
|
+
}
|
72
|
+
],
|
73
|
+
products[:ror_stein].master => [
|
74
|
+
{
|
75
|
+
:attachment => image("ror_stein")
|
76
|
+
},
|
77
|
+
{
|
78
|
+
:attachment => image("ror_stein_back")
|
79
|
+
}
|
80
|
+
],
|
81
|
+
products[:apache_baseball_jersey].master => [
|
82
|
+
{
|
83
|
+
:attachment => image("apache_baseball", "png")
|
84
|
+
},
|
85
|
+
],
|
86
|
+
products[:ruby_baseball_jersey].master => [
|
87
|
+
{
|
88
|
+
:attachment => image("ruby_baseball", "png")
|
89
|
+
},
|
90
|
+
],
|
91
|
+
products[:spree_bag].master => [
|
92
|
+
{
|
93
|
+
:attachment => image("spree_bag")
|
94
|
+
},
|
95
|
+
],
|
96
|
+
products[:spree_tote].master => [
|
97
|
+
{
|
98
|
+
:attachment => image("spree_tote_front")
|
99
|
+
},
|
100
|
+
{
|
101
|
+
:attachment => image("spree_tote_back")
|
102
|
+
}
|
103
|
+
],
|
104
|
+
products[:spree_ringer].master => [
|
105
|
+
{
|
106
|
+
:attachment => image("spree_ringer_t")
|
107
|
+
},
|
108
|
+
{
|
109
|
+
:attachment => image("spree_ringer_t_back")
|
110
|
+
}
|
111
|
+
],
|
112
|
+
products[:spree_jr_spaghetti].master => [
|
113
|
+
{
|
114
|
+
:attachment => image("spree_spaghetti")
|
115
|
+
}
|
116
|
+
],
|
117
|
+
products[:spree_baseball_jersey].master => [
|
118
|
+
{
|
119
|
+
:attachment => image("spree_jersey")
|
120
|
+
},
|
121
|
+
{
|
122
|
+
:attachment => image("spree_jersey_back")
|
123
|
+
}
|
124
|
+
],
|
125
|
+
products[:spree_stein].master => [
|
126
|
+
{
|
127
|
+
:attachment => image("spree_stein")
|
128
|
+
},
|
129
|
+
{
|
130
|
+
:attachment => image("spree_stein_back")
|
131
|
+
}
|
132
|
+
],
|
133
|
+
products[:spree_mug].master => [
|
134
|
+
{
|
135
|
+
:attachment => image("spree_mug")
|
136
|
+
},
|
137
|
+
{
|
138
|
+
:attachment => image("spree_mug_back")
|
139
|
+
}
|
140
|
+
],
|
141
|
+
}
|
142
|
+
|
143
|
+
products[:ror_baseball_jersey].variants.each do |variant|
|
144
|
+
color = variant.option_value("tshirt-color").downcase
|
145
|
+
main_image = image("ror_baseball_jersey_#{color}", "png")
|
146
|
+
variant.images.create!(:attachment => main_image)
|
147
|
+
back_image = image("ror_baseball_jersey_back_#{color}", "png")
|
148
|
+
if back_image
|
149
|
+
variant.images.create!(:attachment => back_image)
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
images.each do |variant, attachments|
|
154
|
+
attachments.each do |attachment|
|
155
|
+
variant.images.create!(attachment)
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,16 @@
|
|
1
|
+
Spree::Sample.load_sample("orders")
|
2
|
+
|
3
|
+
first_order = Spree::Order.find_by_number!("R123456789")
|
4
|
+
last_order = Spree::Order.find_by_number!("R987654321")
|
5
|
+
|
6
|
+
first_order.line_items.create!({
|
7
|
+
:variant => Spree::Product.find_by_name!("Ruby on Rails Tote").master,
|
8
|
+
:quantity => 1,
|
9
|
+
:price => 15.99
|
10
|
+
}, :without_protection => true)
|
11
|
+
|
12
|
+
last_order.line_items.create!({
|
13
|
+
:variant => Spree::Product.find_by_name!("Ruby on Rails Bag").master,
|
14
|
+
:quantity => 1,
|
15
|
+
:price => 22.99
|
16
|
+
}, :without_protection => true)
|
@@ -0,0 +1,16 @@
|
|
1
|
+
option_types = [
|
2
|
+
{
|
3
|
+
:name => "tshirt-size",
|
4
|
+
:presentation => "Size",
|
5
|
+
:position => 1
|
6
|
+
},
|
7
|
+
{
|
8
|
+
:name => "tshirt-color",
|
9
|
+
:presentation => "Color",
|
10
|
+
:position => 2
|
11
|
+
}
|
12
|
+
]
|
13
|
+
|
14
|
+
option_types.each do |option_type_attrs|
|
15
|
+
Spree::OptionType.create!(option_type_attrs, :without_protection => true)
|
16
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
Spree::Sample.load_sample("option_types")
|
2
|
+
|
3
|
+
size = Spree::OptionType.find_by_presentation!("Size")
|
4
|
+
color = Spree::OptionType.find_by_presentation!("Color")
|
5
|
+
|
6
|
+
option_values = [
|
7
|
+
{
|
8
|
+
:name => "Small",
|
9
|
+
:presentation => "S",
|
10
|
+
:position => 1,
|
11
|
+
:option_type => size
|
12
|
+
},
|
13
|
+
{
|
14
|
+
:name => "Medium",
|
15
|
+
:presentation => "M",
|
16
|
+
:position => 2,
|
17
|
+
:option_type => size
|
18
|
+
},
|
19
|
+
{
|
20
|
+
:name => "Large",
|
21
|
+
:presentation => "L",
|
22
|
+
:position => 3,
|
23
|
+
:option_type => size
|
24
|
+
},
|
25
|
+
{
|
26
|
+
:name => "Extra Large",
|
27
|
+
:presentation => "XL",
|
28
|
+
:position => 4,
|
29
|
+
:option_type => size
|
30
|
+
},
|
31
|
+
{
|
32
|
+
:name => "Red",
|
33
|
+
:presentation => "Red",
|
34
|
+
:position => 1,
|
35
|
+
:option_type => color,
|
36
|
+
},
|
37
|
+
{
|
38
|
+
:name => "Green",
|
39
|
+
:presentation => "Green",
|
40
|
+
:position => 2,
|
41
|
+
:option_type => color,
|
42
|
+
},
|
43
|
+
{
|
44
|
+
:name => "Blue",
|
45
|
+
:presentation => "Blue",
|
46
|
+
:position => 3,
|
47
|
+
:option_type => color
|
48
|
+
}
|
49
|
+
]
|
50
|
+
|
51
|
+
option_values.each do |option_value_attrs|
|
52
|
+
Spree::OptionValue.create!(option_values, :without_protection => true)
|
53
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
Spree::Sample.load_sample("addresses")
|
2
|
+
|
3
|
+
order = Spree::Order.create!({
|
4
|
+
:number => "R123456789",
|
5
|
+
:email => "spree@example.com",
|
6
|
+
:item_total => 150.95,
|
7
|
+
:adjustment_total => 150.95,
|
8
|
+
:total => 301.90,
|
9
|
+
:shipping_address => Spree::Address.first,
|
10
|
+
:billing_address => Spree::Address.last
|
11
|
+
}, :without_protection => true)
|
12
|
+
order.state = "complete"
|
13
|
+
order.save!
|
14
|
+
|
15
|
+
order = Spree::Order.create!({
|
16
|
+
:number => "R987654321",
|
17
|
+
:email => "spree@example.com",
|
18
|
+
:item_total => 15.95,
|
19
|
+
:adjustment_total => 15.95,
|
20
|
+
:total => 31.90,
|
21
|
+
:shipping_address => Spree::Address.first,
|
22
|
+
:billing_address => Spree::Address.last
|
23
|
+
}, :without_protection => true)
|
24
|
+
order.state = "complete"
|
25
|
+
order.save!
|
26
|
+
|
@@ -0,0 +1,43 @@
|
|
1
|
+
Spree::Gateway::Bogus.create!(
|
2
|
+
{
|
3
|
+
:name => "Credit Card",
|
4
|
+
:description => "Bogus payment gateway for development.",
|
5
|
+
:environment => "development",
|
6
|
+
:active => true
|
7
|
+
}
|
8
|
+
)
|
9
|
+
|
10
|
+
Spree::Gateway::Bogus.create!(
|
11
|
+
{
|
12
|
+
:name => "Credit Card",
|
13
|
+
:description => "Bogus payment gateway for production.",
|
14
|
+
:environment => "production",
|
15
|
+
:active => true
|
16
|
+
}
|
17
|
+
)
|
18
|
+
|
19
|
+
Spree::Gateway::Bogus.create!(
|
20
|
+
{
|
21
|
+
:name => "Credit Card",
|
22
|
+
:description => "Bogus payment gateway for staging.",
|
23
|
+
:environment => "staging",
|
24
|
+
:active => true
|
25
|
+
}
|
26
|
+
)
|
27
|
+
|
28
|
+
Spree::Gateway::Bogus.create!(
|
29
|
+
{
|
30
|
+
:name => "Credit Card",
|
31
|
+
:description => "Bogus payment gateway for test.",
|
32
|
+
:environment => "test",
|
33
|
+
:active => true
|
34
|
+
}
|
35
|
+
)
|
36
|
+
|
37
|
+
Spree::PaymentMethod::Check.create!(
|
38
|
+
{
|
39
|
+
:name => "Check",
|
40
|
+
:description => "Pay by check.",
|
41
|
+
:active => true
|
42
|
+
}
|
43
|
+
)
|
@@ -17,13 +17,10 @@ creditcard = Spree::CreditCard.create({ :cc_type => 'visa', :month => 12, :year
|
|
17
17
|
:gateway_customer_profile_id => 'BGS-1234' }, :without_protection => true)
|
18
18
|
|
19
19
|
Spree::Order.all.each_with_index do |order, index|
|
20
|
-
printf "\rProcessing order #{index}"
|
21
|
-
STDOUT.flush
|
22
20
|
order.update!
|
23
|
-
payment = order.payments.create({ :amount => order.total, :source => creditcard.clone, :payment_method => method }, :without_protection => true)
|
21
|
+
payment = order.payments.create!({ :amount => order.total, :source => creditcard.clone, :payment_method => method }, :without_protection => true)
|
24
22
|
payment.update_attributes_without_callbacks({
|
25
23
|
:state => 'pending',
|
26
24
|
:response_code => '12345'
|
27
25
|
})
|
28
26
|
end
|
29
|
-
puts
|
@@ -0,0 +1,12 @@
|
|
1
|
+
Spree::Sample.load_sample("products")
|
2
|
+
|
3
|
+
size = Spree::OptionType.find_by_presentation!("Size")
|
4
|
+
color = Spree::OptionType.find_by_presentation!("Color")
|
5
|
+
|
6
|
+
ror_baseball_jersey = Spree::Product.find_by_name!("Ruby on Rails Baseball Jersey")
|
7
|
+
ror_baseball_jersey.option_types = [size, color]
|
8
|
+
ror_baseball_jersey.save!
|
9
|
+
|
10
|
+
spree_baseball_jersey = Spree::Product.find_by_name!("Spree Baseball Jersey")
|
11
|
+
spree_baseball_jersey.option_types = [size, color]
|
12
|
+
spree_baseball_jersey.save!
|
@@ -0,0 +1,118 @@
|
|
1
|
+
products =
|
2
|
+
{
|
3
|
+
"Ruby on Rails Baseball Jersey" =>
|
4
|
+
{
|
5
|
+
"Manufacturer" => "Wilson",
|
6
|
+
"Brand" => "Wannabe Sports",
|
7
|
+
"Model" => "JK1002",
|
8
|
+
"Shirt Type" => "Baseball Jersey",
|
9
|
+
"Sleeve Type" => "Long",
|
10
|
+
"Made from" => "100% cotton",
|
11
|
+
"Fit" => "Loose",
|
12
|
+
"Gender" => "Men's"
|
13
|
+
},
|
14
|
+
"Ruby on Rails Jr. Spaghetti" =>
|
15
|
+
{
|
16
|
+
"Manufacturer" => "Jerseys",
|
17
|
+
"Brand" => "Resiliance",
|
18
|
+
"Model" => "TL174",
|
19
|
+
"Shirt Type" => "Jr. Spaghetti T",
|
20
|
+
"Sleeve Type" => "None",
|
21
|
+
"Made from" => "90% Cotton, 10% Nylon",
|
22
|
+
"Fit" => "Form",
|
23
|
+
"Gender" => "Women's"
|
24
|
+
},
|
25
|
+
"Ruby on Rails Ringer T-Shirt" =>
|
26
|
+
{
|
27
|
+
"Manufacturer" => "Jerseys",
|
28
|
+
"Brand" => "Conditioned",
|
29
|
+
"Model" => "TL9002",
|
30
|
+
"Shirt Type" => "Ringer T",
|
31
|
+
"Sleeve Type" => "Short",
|
32
|
+
"Made from" => "100% Vellum",
|
33
|
+
"Fit" => "Loose",
|
34
|
+
"Gender" => "Men's"
|
35
|
+
},
|
36
|
+
"Ruby on Rails Tote" =>
|
37
|
+
{
|
38
|
+
"Type" => "Tote",
|
39
|
+
"Size" => %Q{15" x 18" x 6"},
|
40
|
+
"Material" => "Canvas"
|
41
|
+
},
|
42
|
+
"Ruby on Rails Bag" =>
|
43
|
+
{
|
44
|
+
"Type" => "Messenger",
|
45
|
+
"Size" => %Q{14 1/2" x 12" x 5"},
|
46
|
+
"Material" => "600 Denier Polyester"
|
47
|
+
},
|
48
|
+
"Ruby on Rails Mug" =>
|
49
|
+
{
|
50
|
+
"Type" => "Mug",
|
51
|
+
"Size" => %Q{4.5" tall, 3.25" dia.}
|
52
|
+
},
|
53
|
+
"Ruby on Rails Stein" =>
|
54
|
+
{
|
55
|
+
"Type" => "Stein",
|
56
|
+
"Size" => %Q{6.75" tall, 3.75" dia. base, 3" dia. rim}
|
57
|
+
},
|
58
|
+
"Spree Stein" =>
|
59
|
+
{
|
60
|
+
"Type" => "Stein",
|
61
|
+
"Size" => %Q{6.75" tall, 3.75" dia. base, 3" dia. rim}
|
62
|
+
},
|
63
|
+
"Spree Mug" =>
|
64
|
+
{
|
65
|
+
"Type" => "Mug",
|
66
|
+
"Size" => %Q{4.5" tall, 3.25" dia.}
|
67
|
+
},
|
68
|
+
"Spree Tote" =>
|
69
|
+
{
|
70
|
+
"Type" => "Tote",
|
71
|
+
"Size" => %Q{15" x 18" x 6"}
|
72
|
+
},
|
73
|
+
"Spree Bag" =>
|
74
|
+
{
|
75
|
+
"Type" => "Messenger",
|
76
|
+
"Size" => %Q{14 1/2" x 12" x 5"}
|
77
|
+
},
|
78
|
+
"Spree Baseball Jersey" =>
|
79
|
+
{
|
80
|
+
"Manufacturer" => "Wilson",
|
81
|
+
"Brand" => "Wannabe Sports",
|
82
|
+
"Model" => "JK1002",
|
83
|
+
"Shirt Type" => "Baseball Jersey",
|
84
|
+
"Sleeve Type" => "Long",
|
85
|
+
"Made from" => "100% cotton",
|
86
|
+
"Fit" => "Loose",
|
87
|
+
"Gender" => "Men's"
|
88
|
+
},
|
89
|
+
"Spree Jr. Spaghetti" =>
|
90
|
+
{
|
91
|
+
"Manufacturer" => "Jerseys",
|
92
|
+
"Brand" => "Resiliance",
|
93
|
+
"Model" => "TL174",
|
94
|
+
"Shirt Type" => "Jr. Spaghetti T",
|
95
|
+
"Sleeve Type" => "None",
|
96
|
+
"Made from" => "90% Cotton, 10% Nylon",
|
97
|
+
"Fit" => "Form",
|
98
|
+
"Gender" => "Women's"
|
99
|
+
},
|
100
|
+
"Spree Ringer T-Shirt" =>
|
101
|
+
{
|
102
|
+
"Manufacturer" => "Jerseys",
|
103
|
+
"Brand" => "Conditioned",
|
104
|
+
"Model" => "TL9002",
|
105
|
+
"Shirt Type" => "Ringer T",
|
106
|
+
"Sleeve Type" => "Short",
|
107
|
+
"Made from" => "100% Vellum",
|
108
|
+
"Fit" => "Loose",
|
109
|
+
"Gender" => "Men's"
|
110
|
+
},
|
111
|
+
}
|
112
|
+
|
113
|
+
products.each do |name, properties|
|
114
|
+
product = Spree::Product.find_by_name(name)
|
115
|
+
properties.each do |prop_name, prop_value|
|
116
|
+
product.set_property(prop_name, prop_value)
|
117
|
+
end
|
118
|
+
end
|