spree_sample 2.0.13 → 2.1.0

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: 681f668cfb17ec7db808d69c072a17e779a717ad
4
- data.tar.gz: 7c37f7ea21504c48bd81391bf0756bfd9c1e1a8b
3
+ metadata.gz: 91b9c6fb078e152ea04cce3cc38eca6335df2087
4
+ data.tar.gz: 490c6000db0e64bce2ca6bb1b873db2b4ef98973
5
5
  SHA512:
6
- metadata.gz: 4286d943cde71f373871d9f04ba0bcf9a2e9803245da7571a307cb4d4511c83cc8fc33192b7dbf92c2f6ba8207e41cb9fb770f0e59388a7337970937b475899b
7
- data.tar.gz: 2d34930be987f633f216da25577110aac0e46cba8d3b597bff05f4c52d1e87c51252530a32753aa21df11050a584e6439ad25562577bd771a0539867c6f948c2
6
+ metadata.gz: ca2d5fda940a853f259a684a2dae0a9d396bfa6b64b24751f4dca87cbd7318a201d948365505176390abd7a9a4a50ef5c4c6420f7c3584ad2192599d3aa27d6e
7
+ data.tar.gz: 044a879b9c7f98edb0faab57ef8569976197c5525de6642e2e5a637b8082adf7b22f191a26dd79ed4fb710c094024d992ae81c8e8767173e908f756bb2986a1e
@@ -2,7 +2,7 @@ united_states = Spree::Country.find_by_name!("United States")
2
2
  new_york = Spree::State.find_by_name!("New York")
3
3
 
4
4
  # Billing address
5
- Spree::Address.create!({
5
+ Spree::Address.create!(
6
6
  :firstname => Faker::Name.first_name,
7
7
  :lastname => Faker::Name.last_name,
8
8
  :address1 => Faker::Address.street_address,
@@ -11,11 +11,10 @@ Spree::Address.create!({
11
11
  :state => new_york,
12
12
  :zipcode => 16804,
13
13
  :country => united_states,
14
- :phone => Faker::PhoneNumber.phone_number
15
- }, :without_protection => true)
14
+ :phone => Faker::PhoneNumber.phone_number)
16
15
 
17
16
  #Shipping address
18
- Spree::Address.create!({
17
+ Spree::Address.create!(
19
18
  :firstname => Faker::Name.first_name,
20
19
  :lastname => Faker::Name.last_name,
21
20
  :address1 => Faker::Address.street_address,
@@ -24,5 +23,4 @@ Spree::Address.create!({
24
23
  :state => new_york,
25
24
  :zipcode => 16804,
26
25
  :country => united_states,
27
- :phone => Faker::PhoneNumber.phone_number
28
- }, :without_protection => true)
26
+ :phone => Faker::PhoneNumber.phone_number)
@@ -3,38 +3,34 @@ Spree::Sample.load_sample("orders")
3
3
  first_order = Spree::Order.find_by_number!("R123456789")
4
4
  last_order = Spree::Order.find_by_number!("R987654321")
5
5
 
6
- first_order.adjustments.create!({
6
+ first_order.adjustments.create!(
7
7
  :amount => 0,
8
8
  :source => first_order,
9
9
  :originator => Spree::TaxRate.find_by_name!("North America"),
10
10
  :label => "Tax",
11
11
  :state => "open",
12
- :mandatory => true
13
- }, :without_protection => true)
12
+ :mandatory => true)
14
13
 
15
- last_order.adjustments.create!({
14
+ last_order.adjustments.create!(
16
15
  :amount => 0,
17
16
  :source => last_order,
18
17
  :originator => Spree::TaxRate.find_by_name!("North America"),
19
18
  :label => "Tax",
20
19
  :state => "open",
21
- :mandatory => true
22
- }, :without_protection => true)
20
+ :mandatory => true)
23
21
 
24
- first_order.adjustments.create!({
22
+ first_order.adjustments.create!(
25
23
  :amount => 0,
26
24
  :source => first_order,
27
25
  :originator => Spree::ShippingMethod.find_by_name!("UPS Ground (USD)"),
28
26
  :label => "Shipping",
29
27
  :state => "finalized",
30
- :mandatory => true
31
- }, :without_protection => true)
28
+ :mandatory => true)
32
29
 
33
- last_order.adjustments.create!({
30
+ last_order.adjustments.create!(
34
31
  :amount => 0,
35
32
  :source => last_order,
36
33
  :originator => Spree::ShippingMethod.find_by_name!("UPS Ground (USD)"),
37
34
  :label => "Shipping",
38
35
  :state => "finalized",
39
- :mandatory => true
40
- }, :without_protection => true)
36
+ :mandatory => true)
@@ -1,4 +1,4 @@
1
- option_types = [
1
+ Spree::OptionType.create!([
2
2
  {
3
3
  :name => "tshirt-size",
4
4
  :presentation => "Size",
@@ -9,8 +9,4 @@ option_types = [
9
9
  :presentation => "Color",
10
10
  :position => 2
11
11
  }
12
- ]
13
-
14
- option_types.each do |option_type_attrs|
15
- Spree::OptionType.create!(option_type_attrs, :without_protection => true)
16
- end
12
+ ])
@@ -3,7 +3,7 @@ Spree::Sample.load_sample("option_types")
3
3
  size = Spree::OptionType.find_by_presentation!("Size")
4
4
  color = Spree::OptionType.find_by_presentation!("Color")
5
5
 
6
- option_values = [
6
+ Spree::OptionValue.create!([
7
7
  {
8
8
  :name => "Small",
9
9
  :presentation => "S",
@@ -46,8 +46,4 @@ option_values = [
46
46
  :position => 3,
47
47
  :option_type => color
48
48
  }
49
- ]
50
-
51
- option_values.each do |option_value_attrs|
52
- Spree::OptionValue.create!(option_value_attrs, :without_protection => true)
53
- end
49
+ ])
data/db/samples/orders.rb CHANGED
@@ -1,37 +1,33 @@
1
1
  Spree::Sample.load_sample("addresses")
2
2
 
3
3
  orders = []
4
- orders << Spree::Order.create!({
4
+ orders << Spree::Order.create!(
5
5
  :number => "R123456789",
6
6
  :email => "spree@example.com",
7
7
  :item_total => 150.95,
8
8
  :adjustment_total => 150.95,
9
9
  :total => 301.90,
10
10
  :shipping_address => Spree::Address.first,
11
- :billing_address => Spree::Address.last
12
- }, :without_protection => true)
11
+ :billing_address => Spree::Address.last)
13
12
 
14
- orders << Spree::Order.create!({
13
+ orders << Spree::Order.create!(
15
14
  :number => "R987654321",
16
15
  :email => "spree@example.com",
17
16
  :item_total => 15.95,
18
17
  :adjustment_total => 15.95,
19
18
  :total => 31.90,
20
19
  :shipping_address => Spree::Address.first,
21
- :billing_address => Spree::Address.last
22
- }, :without_protection => true)
20
+ :billing_address => Spree::Address.last)
23
21
 
24
- orders[0].line_items.create!({
22
+ orders[0].line_items.create!(
25
23
  :variant => Spree::Product.find_by_name!("Ruby on Rails Tote").master,
26
24
  :quantity => 1,
27
- :price => 15.99
28
- }, :without_protection => true)
25
+ :price => 15.99)
29
26
 
30
- orders[1].line_items.create!({
27
+ orders[1].line_items.create!(
31
28
  :variant => Spree::Product.find_by_name!("Ruby on Rails Bag").master,
32
29
  :quantity => 1,
33
- :price => 22.99
34
- }, :without_protection => true)
30
+ :price => 22.99)
35
31
 
36
32
  orders.each(&:create_proposed_shipments)
37
33
 
@@ -12,15 +12,12 @@ end
12
12
  # reference it as such. Make it explicit here that this table has been renamed.
13
13
  Spree::CreditCard.table_name = 'spree_credit_cards'
14
14
 
15
- creditcard = Spree::CreditCard.create({ :cc_type => 'visa', :month => 12, :year => 2014, :last_digits => '1111',
16
- :first_name => 'Sean', :last_name => 'Schofield',
17
- :gateway_customer_profile_id => 'BGS-1234' }, :without_protection => true)
15
+ creditcard = Spree::CreditCard.create(:cc_type => 'visa', :month => 12, :year => 2014, :last_digits => '1111',
16
+ :first_name => 'Sean', :last_name => 'Schofield',
17
+ :gateway_customer_profile_id => 'BGS-1234')
18
18
 
19
19
  Spree::Order.all.each_with_index do |order, index|
20
20
  order.update!
21
- payment = order.payments.create!({ :amount => order.total, :source => creditcard.clone, :payment_method => method }, :without_protection => true)
22
- payment.update_attributes_without_callbacks({
23
- :state => 'pending',
24
- :response_code => '12345'
25
- })
21
+ payment = order.payments.create!(:amount => order.total, :source => creditcard.clone, :payment_method => method)
22
+ payment.update_attributes_without_callbacks(:state => 'pending', :response_code => '12345')
26
23
  end
@@ -2,7 +2,7 @@ Spree::Sample.load_sample("tax_categories")
2
2
  Spree::Sample.load_sample("shipping_categories")
3
3
 
4
4
  clothing = Spree::TaxCategory.find_by_name!("Clothing")
5
- shipping_category = Spree::ShippingCategory.find_by_name!("Default")
5
+ shipping_category = Spree::ShippingCategory.find_by_name!("Default Shipping")
6
6
 
7
7
  default_attrs = {
8
8
  :description => Faker::Lorem.paragraph,
@@ -125,10 +125,12 @@ products.each do |product_attrs|
125
125
  eur_price = product_attrs.delete(:eur_price)
126
126
  Spree::Config[:currency] = "USD"
127
127
 
128
- product = Spree::Product.create!(default_attrs.merge(product_attrs), :without_protection => true)
128
+ default_shipping_category = Spree::ShippingCategory.find_by_name!("Default Shipping")
129
+ product = Spree::Product.create!(default_attrs.merge(product_attrs))
129
130
  Spree::Config[:currency] = "EUR"
130
131
  product.reload
131
132
  product.price = eur_price
133
+ product.shipping_category = default_shipping_category
132
134
  product.save!
133
135
  end
134
136
 
@@ -1 +1 @@
1
- Spree::ShippingCategory.create!(:name => "Default")
1
+ Spree::ShippingCategory.create!(:name => "Default Shipping")
@@ -7,37 +7,37 @@ rescue ActiveRecord::RecordNotFound
7
7
  end
8
8
 
9
9
  europe_vat = Spree::Zone.find_by_name!("EU_VAT")
10
- shipping_category = Spree::ShippingCategory.find_by_name!("Default")
10
+ shipping_category = Spree::ShippingCategory.find_or_create_by!(name: 'Default')
11
11
 
12
12
  shipping_methods = [
13
13
  {
14
14
  :name => "UPS Ground (USD)",
15
15
  :zones => [north_america],
16
- :calculator => Spree::Calculator::Shipping::FlatRate.create!,
16
+ :calculator => Spree::Calculator::FlatRate.create!,
17
17
  :shipping_categories => [shipping_category]
18
18
  },
19
19
  {
20
20
  :name => "UPS Two Day (USD)",
21
21
  :zones => [north_america],
22
- :calculator => Spree::Calculator::Shipping::FlatRate.create!,
22
+ :calculator => Spree::Calculator::FlatRate.create!,
23
23
  :shipping_categories => [shipping_category]
24
24
  },
25
25
  {
26
26
  :name => "UPS One Day (USD)",
27
27
  :zones => [north_america],
28
- :calculator => Spree::Calculator::Shipping::FlatRate.create!,
28
+ :calculator => Spree::Calculator::FlatRate.create!,
29
29
  :shipping_categories => [shipping_category]
30
30
  },
31
31
  {
32
32
  :name => "UPS Ground (EUR)",
33
33
  :zones => [europe_vat],
34
- :calculator => Spree::Calculator::Shipping::FlatRate.create!,
34
+ :calculator => Spree::Calculator::FlatRate.create!,
35
35
  :shipping_categories => [shipping_category]
36
36
  }
37
37
  ]
38
38
 
39
39
  shipping_methods.each do |shipping_method_attrs|
40
- Spree::ShippingMethod.create!(shipping_method_attrs, :without_protection => true)
40
+ Spree::ShippingMethod.create!(shipping_method_attrs)
41
41
  end
42
42
 
43
43
  {
@@ -1,10 +1,9 @@
1
1
  north_america = Spree::Zone.find_by_name!("North America")
2
2
  clothing = Spree::TaxCategory.find_by_name!("Clothing")
3
- tax_rate = Spree::TaxRate.create({
3
+ tax_rate = Spree::TaxRate.create(
4
4
  :name => "North America",
5
5
  :zone => north_america,
6
6
  :amount => 0.05,
7
- :tax_category => clothing},
8
- :without_protection => true)
7
+ :tax_category => clothing)
9
8
  tax_rate.calculator = Spree::Calculator::DefaultTax.create!
10
9
  tax_rate.save!
data/db/samples/taxons.rb CHANGED
@@ -94,52 +94,28 @@ taxons = [
94
94
  {
95
95
  :name => "Ruby",
96
96
  :taxonomy => brands,
97
- :parent => "Brand",
98
- :products => [
99
- products[:ruby_baseball_jersey]
100
- ]
97
+ :parent => "Brand"
101
98
  },
102
99
  {
103
100
  :name => "Apache",
104
101
  :taxonomy => brands,
105
- :parent => "Brand",
106
- :products => [
107
- products[:apache_baseball_jersey]
108
- ]
102
+ :parent => "Brand"
109
103
  },
110
104
  {
111
105
  :name => "Spree",
112
106
  :taxonomy => brands,
113
- :parent => "Brand",
114
- :products => [
115
- products[:spree_stein],
116
- products[:spree_mug],
117
- products[:spree_ringer],
118
- products[:spree_baseball_jersey],
119
- products[:spree_tote],
120
- products[:spree_bag],
121
- products[:spree_jr_spaghetti],
122
- ]
107
+ :parent => "Brand"
123
108
  },
124
109
  {
125
110
  :name => "Rails",
126
111
  :taxonomy => brands,
127
- :parent => "Brand",
128
- :products => [
129
- products[:ror_tote],
130
- products[:ror_bag],
131
- products[:ror_mug],
132
- products[:ror_stein],
133
- products[:ror_baseball_jersey],
134
- products[:ror_jr_spaghetti],
135
- products[:ror_ringer],
136
- ]
112
+ :parent => "Brand"
137
113
  },
138
114
  ]
139
115
 
140
116
  taxons.each do |taxon_attrs|
141
117
  if taxon_attrs[:parent]
142
118
  taxon_attrs[:parent] = Spree::Taxon.find_by_name!(taxon_attrs[:parent])
143
- Spree::Taxon.create!(taxon_attrs, :without_protection => true)
119
+ Spree::Taxon.create!(taxon_attrs)
144
120
  end
145
121
  end
@@ -157,9 +157,7 @@ masters = {
157
157
  }
158
158
  }
159
159
 
160
- variants.each do |variant_attrs|
161
- Spree::Variant.create!(variant_attrs, :without_protection => true)
162
- end
160
+ Spree::Variant.create!(variants)
163
161
 
164
162
  masters.each do |product, variant_attrs|
165
163
  product.master.update_attributes!(variant_attrs)
data/lib/spree_sample.rb CHANGED
@@ -24,7 +24,6 @@ module SpreeSample
24
24
  Spree::Sample.load_sample("assets")
25
25
 
26
26
  Spree::Sample.load_sample("orders")
27
- Spree::Sample.load_sample("line_items")
28
27
  Spree::Sample.load_sample("adjustments")
29
28
  Spree::Sample.load_sample("payments")
30
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_sample
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.13
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Schofield
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-20 00:00:00.000000000 Z
11
+ date: 2013-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: spree_core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 2.0.13
19
+ version: 2.1.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 2.0.13
26
+ version: 2.1.0
27
27
  description: Required dependency for Spree
28
28
  email: sean@spreecommerce.com
29
29
  executables: []
@@ -31,7 +31,9 @@ extensions: []
31
31
  extra_rdoc_files: []
32
32
  files:
33
33
  - LICENSE
34
- - db/samples.rb
34
+ - lib/spree/sample.rb
35
+ - lib/spree_sample.rb
36
+ - lib/tasks/sample.rake
35
37
  - db/samples/addresses.rb
36
38
  - db/samples/adjustments.rb
37
39
  - db/samples/assets.rb
@@ -67,7 +69,6 @@ files:
67
69
  - db/samples/images/spree_stein_back.jpeg
68
70
  - db/samples/images/spree_tote_back.jpeg
69
71
  - db/samples/images/spree_tote_front.jpeg
70
- - db/samples/line_items.rb
71
72
  - db/samples/option_types.rb
72
73
  - db/samples/option_values.rb
73
74
  - db/samples/orders.rb
@@ -85,9 +86,7 @@ files:
85
86
  - db/samples/taxonomies.rb
86
87
  - db/samples/taxons.rb
87
88
  - db/samples/variants.rb
88
- - lib/spree/sample.rb
89
- - lib/spree_sample.rb
90
- - lib/tasks/sample.rake
89
+ - db/samples.rb
91
90
  homepage: http://spreecommerce.com
92
91
  licenses:
93
92
  - BSD-3
@@ -98,18 +97,18 @@ require_paths:
98
97
  - lib
99
98
  required_ruby_version: !ruby/object:Gem::Requirement
100
99
  requirements:
101
- - - ">="
100
+ - - '>='
102
101
  - !ruby/object:Gem::Version
103
102
  version: 1.9.3
104
103
  required_rubygems_version: !ruby/object:Gem::Requirement
105
104
  requirements:
106
- - - ">="
105
+ - - '>='
107
106
  - !ruby/object:Gem::Version
108
107
  version: '0'
109
108
  requirements:
110
109
  - none
111
110
  rubyforge_project:
112
- rubygems_version: 2.2.2
111
+ rubygems_version: 2.1.0
113
112
  signing_key:
114
113
  specification_version: 4
115
114
  summary: Sample data (including images) for use with Spree.
@@ -1 +0,0 @@
1
- Spree::Sample.load_sample("orders")