spree_sample 3.5.0 → 3.6.0.rc1
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.
- checksums.yaml +5 -5
- data/db/samples.rb +2 -2
- data/db/samples/addresses.rb +7 -5
- data/db/samples/adjustments.rb +17 -15
- data/db/samples/assets.rb +105 -92
- data/db/samples/option_types.rb +4 -4
- data/db/samples/option_values.rb +19 -19
- data/db/samples/orders.rb +24 -20
- data/db/samples/payment_methods.rb +4 -4
- data/db/samples/product_option_types.rb +5 -5
- data/db/samples/product_properties.rb +81 -81
- data/db/samples/products.rb +31 -32
- data/db/samples/prototypes.rb +6 -6
- data/db/samples/shipping_methods.rb +14 -14
- data/db/samples/stock.rb +1 -1
- data/db/samples/store_credit_categories.rb +1 -1
- data/db/samples/tax_rates.rb +5 -4
- data/db/samples/taxonomies.rb +1 -1
- data/db/samples/taxons.rb +32 -32
- data/db/samples/variants.rb +54 -56
- data/lib/spree/sample.rb +1 -3
- data/lib/tasks/sample.rake +1 -1
- metadata +7 -7
data/db/samples/orders.rb
CHANGED
@@ -1,36 +1,40 @@
|
|
1
|
-
Spree::Sample.load_sample(
|
1
|
+
Spree::Sample.load_sample('addresses')
|
2
2
|
|
3
3
|
orders = []
|
4
4
|
orders << Spree::Order.where(
|
5
|
-
number:
|
6
|
-
email:
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
number: 'R123456789',
|
6
|
+
email: 'spree@example.com'
|
7
|
+
).first_or_create! do |order|
|
8
|
+
order.item_total = 150.95
|
9
|
+
order.adjustment_total = 150.95
|
10
|
+
order.total = 301.90
|
11
|
+
end
|
11
12
|
|
12
13
|
orders << Spree::Order.where(
|
13
|
-
number:
|
14
|
-
email:
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
14
|
+
number: 'R987654321',
|
15
|
+
email: 'spree@example.com'
|
16
|
+
).first_or_create! do |order|
|
17
|
+
order.item_total = 15.95
|
18
|
+
order.adjustment_total = 15.95
|
19
|
+
order.total = 31.90
|
20
|
+
order.shipping_address = Spree::Address.first
|
21
|
+
order.billing_address = Spree::Address.last
|
22
|
+
end
|
21
23
|
|
22
24
|
unless orders[0].line_items.any?
|
23
25
|
orders[0].line_items.new(
|
24
|
-
variant: Spree::Product.find_by!(name:
|
26
|
+
variant: Spree::Product.find_by!(name: 'Ruby on Rails Tote').master,
|
25
27
|
quantity: 1,
|
26
|
-
price: 15.99
|
28
|
+
price: 15.99
|
29
|
+
).save!
|
27
30
|
end
|
28
31
|
|
29
32
|
unless orders[1].line_items.any?
|
30
33
|
orders[1].line_items.new(
|
31
|
-
variant: Spree::Product.find_by!(name:
|
34
|
+
variant: Spree::Product.find_by!(name: 'Ruby on Rails Bag').master,
|
32
35
|
quantity: 1,
|
33
|
-
price: 22.99
|
36
|
+
price: 22.99
|
37
|
+
).save!
|
34
38
|
end
|
35
39
|
|
36
40
|
orders.each(&:create_proposed_shipments)
|
@@ -38,7 +42,7 @@ orders.each(&:create_proposed_shipments)
|
|
38
42
|
store = Spree::Store.default
|
39
43
|
|
40
44
|
orders.each do |order|
|
41
|
-
order.state =
|
45
|
+
order.state = 'complete'
|
42
46
|
order.store = store
|
43
47
|
order.completed_at = Time.current - 1.day
|
44
48
|
order.save!
|
@@ -1,11 +1,11 @@
|
|
1
1
|
Spree::Gateway::Bogus.where(
|
2
|
-
name:
|
3
|
-
description:
|
2
|
+
name: 'Credit Card',
|
3
|
+
description: 'Bogus payment gateway.',
|
4
4
|
active: true
|
5
5
|
).first_or_create!
|
6
6
|
|
7
7
|
Spree::PaymentMethod::Check.where(
|
8
|
-
name:
|
9
|
-
description:
|
8
|
+
name: 'Check',
|
9
|
+
description: 'Pay by check.',
|
10
10
|
active: true
|
11
11
|
).first_or_create!
|
@@ -1,12 +1,12 @@
|
|
1
|
-
Spree::Sample.load_sample(
|
1
|
+
Spree::Sample.load_sample('products')
|
2
2
|
|
3
|
-
size = Spree::OptionType.find_by!(presentation:
|
4
|
-
color = Spree::OptionType.find_by!(presentation:
|
3
|
+
size = Spree::OptionType.find_by!(presentation: 'Size')
|
4
|
+
color = Spree::OptionType.find_by!(presentation: 'Color')
|
5
5
|
|
6
|
-
ror_baseball_jersey = Spree::Product.find_by!(name:
|
6
|
+
ror_baseball_jersey = Spree::Product.find_by!(name: 'Ruby on Rails Baseball Jersey')
|
7
7
|
ror_baseball_jersey.option_types = [size, color]
|
8
8
|
ror_baseball_jersey.save!
|
9
9
|
|
10
|
-
spree_baseball_jersey = Spree::Product.find_by!(name:
|
10
|
+
spree_baseball_jersey = Spree::Product.find_by!(name: 'Spree Baseball Jersey')
|
11
11
|
spree_baseball_jersey.option_types = [size, color]
|
12
12
|
spree_baseball_jersey.save!
|
@@ -1,113 +1,113 @@
|
|
1
1
|
products =
|
2
2
|
{
|
3
|
-
|
3
|
+
'Ruby on Rails Baseball Jersey' =>
|
4
4
|
{
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
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
13
|
},
|
14
|
-
|
14
|
+
'Ruby on Rails Jr. Spaghetti' =>
|
15
15
|
{
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
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
24
|
},
|
25
|
-
|
25
|
+
'Ruby on Rails Ringer T-Shirt' =>
|
26
26
|
{
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
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
35
|
},
|
36
|
-
|
36
|
+
'Ruby on Rails Tote' =>
|
37
37
|
{
|
38
|
-
|
39
|
-
|
40
|
-
|
38
|
+
'Type' => 'Tote',
|
39
|
+
'Size' => %{15' x 18' x 6'},
|
40
|
+
'Material' => 'Canvas'
|
41
41
|
},
|
42
|
-
|
42
|
+
'Ruby on Rails Bag' =>
|
43
43
|
{
|
44
|
-
|
45
|
-
|
46
|
-
|
44
|
+
'Type' => 'Messenger',
|
45
|
+
'Size' => %{14 1/2' x 12' x 5'},
|
46
|
+
'Material' => '600 Denier Polyester'
|
47
47
|
},
|
48
|
-
|
48
|
+
'Ruby on Rails Mug' =>
|
49
49
|
{
|
50
|
-
|
51
|
-
|
50
|
+
'Type' => 'Mug',
|
51
|
+
'Size' => %{4.5' tall, 3.25' dia.}
|
52
52
|
},
|
53
|
-
|
53
|
+
'Ruby on Rails Stein' =>
|
54
54
|
{
|
55
|
-
|
56
|
-
|
55
|
+
'Type' => 'Stein',
|
56
|
+
'Size' => %{6.75' tall, 3.75' dia. base, 3' dia. rim}
|
57
57
|
},
|
58
|
-
|
58
|
+
'Spree Stein' =>
|
59
59
|
{
|
60
|
-
|
61
|
-
|
60
|
+
'Type' => 'Stein',
|
61
|
+
'Size' => %{6.75' tall, 3.75' dia. base, 3' dia. rim}
|
62
62
|
},
|
63
|
-
|
63
|
+
'Spree Mug' =>
|
64
64
|
{
|
65
|
-
|
66
|
-
|
65
|
+
'Type' => 'Mug',
|
66
|
+
'Size' => %{4.5' tall, 3.25' dia.}
|
67
67
|
},
|
68
|
-
|
68
|
+
'Spree Tote' =>
|
69
69
|
{
|
70
|
-
|
71
|
-
|
70
|
+
'Type' => 'Tote',
|
71
|
+
'Size' => %{15' x 18' x 6'}
|
72
72
|
},
|
73
|
-
|
73
|
+
'Spree Bag' =>
|
74
74
|
{
|
75
|
-
|
76
|
-
|
75
|
+
'Type' => 'Messenger',
|
76
|
+
'Size' => %{14 1/2' x 12' x 5'}
|
77
77
|
},
|
78
|
-
|
78
|
+
'Spree Baseball Jersey' =>
|
79
79
|
{
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
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
88
|
},
|
89
|
-
|
89
|
+
'Spree Jr. Spaghetti' =>
|
90
90
|
{
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
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
99
|
},
|
100
|
-
|
100
|
+
'Spree Ringer T-Shirt' =>
|
101
101
|
{
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
}
|
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
111
|
}
|
112
112
|
|
113
113
|
products.each do |name, properties|
|
data/db/samples/products.rb
CHANGED
@@ -1,108 +1,108 @@
|
|
1
|
-
Spree::Sample.load_sample(
|
2
|
-
Spree::Sample.load_sample(
|
1
|
+
Spree::Sample.load_sample('tax_categories')
|
2
|
+
Spree::Sample.load_sample('shipping_categories')
|
3
3
|
|
4
|
-
clothing = Spree::TaxCategory.find_by!(name:
|
4
|
+
clothing = Spree::TaxCategory.find_by!(name: 'Clothing')
|
5
5
|
|
6
6
|
products = [
|
7
7
|
{
|
8
|
-
name:
|
8
|
+
name: 'Ruby on Rails Tote',
|
9
9
|
tax_category: clothing,
|
10
10
|
price: 15.99,
|
11
|
-
eur_price: 14
|
11
|
+
eur_price: 14
|
12
12
|
},
|
13
13
|
{
|
14
|
-
name:
|
14
|
+
name: 'Ruby on Rails Bag',
|
15
15
|
tax_category: clothing,
|
16
16
|
price: 22.99,
|
17
|
-
eur_price: 19
|
17
|
+
eur_price: 19
|
18
18
|
},
|
19
19
|
{
|
20
|
-
name:
|
20
|
+
name: 'Ruby on Rails Baseball Jersey',
|
21
21
|
tax_category: clothing,
|
22
22
|
price: 19.99,
|
23
23
|
eur_price: 16
|
24
24
|
},
|
25
25
|
{
|
26
|
-
name:
|
26
|
+
name: 'Ruby on Rails Jr. Spaghetti',
|
27
27
|
tax_category: clothing,
|
28
28
|
price: 19.99,
|
29
29
|
eur_price: 16
|
30
30
|
|
31
31
|
},
|
32
32
|
{
|
33
|
-
name:
|
33
|
+
name: 'Ruby on Rails Ringer T-Shirt',
|
34
34
|
tax_category: clothing,
|
35
35
|
price: 19.99,
|
36
36
|
eur_price: 16
|
37
37
|
},
|
38
38
|
{
|
39
|
-
name:
|
39
|
+
name: 'Ruby Baseball Jersey',
|
40
40
|
tax_category: clothing,
|
41
41
|
price: 19.99,
|
42
42
|
eur_price: 16
|
43
43
|
},
|
44
44
|
{
|
45
|
-
name:
|
45
|
+
name: 'Apache Baseball Jersey',
|
46
46
|
tax_category: clothing,
|
47
47
|
price: 19.99,
|
48
48
|
eur_price: 16
|
49
49
|
},
|
50
50
|
{
|
51
|
-
name:
|
51
|
+
name: 'Spree Baseball Jersey',
|
52
52
|
tax_category: clothing,
|
53
53
|
price: 19.99,
|
54
54
|
eur_price: 16
|
55
55
|
},
|
56
56
|
{
|
57
|
-
name:
|
57
|
+
name: 'Spree Jr. Spaghetti',
|
58
58
|
tax_category: clothing,
|
59
59
|
price: 19.99,
|
60
60
|
eur_price: 16
|
61
61
|
},
|
62
62
|
{
|
63
|
-
name:
|
63
|
+
name: 'Spree Ringer T-Shirt',
|
64
64
|
tax_category: clothing,
|
65
65
|
price: 19.99,
|
66
66
|
eur_price: 16
|
67
67
|
},
|
68
68
|
{
|
69
|
-
name:
|
69
|
+
name: 'Spree Tote',
|
70
70
|
tax_category: clothing,
|
71
71
|
price: 15.99,
|
72
|
-
eur_price: 14
|
72
|
+
eur_price: 14
|
73
73
|
},
|
74
74
|
{
|
75
|
-
name:
|
75
|
+
name: 'Spree Bag',
|
76
76
|
tax_category: clothing,
|
77
77
|
price: 22.99,
|
78
78
|
eur_price: 19
|
79
79
|
},
|
80
80
|
{
|
81
|
-
name:
|
81
|
+
name: 'Ruby on Rails Mug',
|
82
82
|
price: 13.99,
|
83
83
|
eur_price: 12
|
84
84
|
},
|
85
85
|
{
|
86
|
-
name:
|
86
|
+
name: 'Ruby on Rails Stein',
|
87
87
|
price: 16.99,
|
88
88
|
eur_price: 14
|
89
89
|
},
|
90
90
|
{
|
91
|
-
name:
|
91
|
+
name: 'Spree Stein',
|
92
92
|
price: 16.99,
|
93
|
-
eur_price: 14
|
93
|
+
eur_price: 14
|
94
94
|
},
|
95
95
|
{
|
96
|
-
name:
|
96
|
+
name: 'Spree Mug',
|
97
97
|
price: 13.99,
|
98
98
|
eur_price: 12
|
99
99
|
}
|
100
100
|
]
|
101
101
|
|
102
|
-
default_shipping_category = Spree::ShippingCategory.find_by!(name:
|
102
|
+
default_shipping_category = Spree::ShippingCategory.find_by!(name: 'Default')
|
103
103
|
|
104
104
|
products.each do |product_attrs|
|
105
|
-
Spree::Config[:currency] =
|
105
|
+
Spree::Config[:currency] = 'USD'
|
106
106
|
eur_price = product_attrs.delete(:eur_price)
|
107
107
|
|
108
108
|
new_product = Spree::Product.where(name: product_attrs[:name],
|
@@ -113,12 +113,11 @@ products.each do |product_attrs|
|
|
113
113
|
product.shipping_category = default_shipping_category
|
114
114
|
end
|
115
115
|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
end
|
116
|
+
next unless new_product
|
117
|
+
Spree::Config[:currency] = 'EUR'
|
118
|
+
new_product.reload
|
119
|
+
new_product.price = eur_price
|
120
|
+
new_product.save
|
122
121
|
end
|
123
122
|
|
124
|
-
Spree::Config[:currency] =
|
123
|
+
Spree::Config[:currency] = 'USD'
|