comable-sample 0.6.0 → 0.7.0.beta1

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: 049d710cbe50d515b34e12a35c04947f119490dc
4
- data.tar.gz: 4c54a4581270f9749db86649c6ffbe538fb24f39
3
+ metadata.gz: 2bc591e3627e35bcaf46eef16ed68a7f32155aa0
4
+ data.tar.gz: 83045f680034505713d3befa767f0b4a3ac525fb
5
5
  SHA512:
6
- metadata.gz: a7e63b0cb95b4956266e7ec3f55363bafae4a712bb817980b0ed3588d1ce5f122b9aaea6928f936bf5e7f2349e91920b0a200398808050115880a3503b0717cc
7
- data.tar.gz: cf3028ef1fc413877b496b1aad372555673029b4618be2850bffc8b6a7def71bf6508985f005360de91b848a3be860affe0ad0016612fb9f439f427540bfdbef
6
+ metadata.gz: 4bf91575863a01b236b6a08ad0ba29f7d7e1350a5cb7b73c6bb9dc23b8328cbd1de55023883c9cfeed3dde22cd715535659c73a2a2a85e3c5f92c02ff45cce1f
7
+ data.tar.gz: 1428e400f0e36f61f7485135da90122314a0fcd6d4617ceb868954b3e3824dd776739973519cb85eaec200db70efb7328ec9a7b80722ee6008368baf2cafaaa8
data/db/samples/orders.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  Comable::Sample.import('products')
2
- Comable::Sample.import('stocks')
2
+ Comable::Sample.import('variants')
3
3
  Comable::Sample.import('addresses')
4
4
 
5
5
  bill_address = Comable::Address.first
@@ -17,7 +17,7 @@ orders_attributes = [
17
17
  total_price: 500 + suede_dress.price,
18
18
  order_items_attributes: [
19
19
  {
20
- stock: suede_dress.stocks.first,
20
+ variant: suede_dress.variants.first,
21
21
  quantity: 1
22
22
  }
23
23
  ]
@@ -31,11 +31,11 @@ orders_attributes = [
31
31
  total_price: 500 + (suede_dress.price * 2) + (girly_coat.price * 3),
32
32
  order_items_attributes: [
33
33
  {
34
- stock: suede_dress.stocks.first,
34
+ variant: suede_dress.variants.first,
35
35
  quantity: 2
36
36
  },
37
37
  {
38
- stock: girly_coat.stocks.first,
38
+ variant: girly_coat.variants.first,
39
39
  quantity: 3
40
40
  }
41
41
  ]
@@ -29,5 +29,5 @@ next_id = (Comable::Product.maximum(:id) || 0).next
29
29
 
30
30
  products_attributes.each.with_index(next_id) do |attributes, index|
31
31
  code = format('%05d', index)
32
- Comable::Product.create!(attributes.merge(code: code))
32
+ Comable::Product.create!(attributes.merge(code: code, published_at: Date.today))
33
33
  end
@@ -0,0 +1,76 @@
1
+ Comable::Sample.import('products')
2
+
3
+ suede_dress = Comable::Product.where(name: Comable::Sample.t(:suede_dress)).first!
4
+ girly_coat = Comable::Product.where(name: Comable::Sample.t(:girly_coat)).first!
5
+ fur_gloves = Comable::Product.where(name: Comable::Sample.t(:fur_gloves)).first!
6
+ leather_boots = Comable::Product.where(name: Comable::Sample.t(:leather_boots)).first!
7
+
8
+ default_stock_attributes = {
9
+ quantity: 10
10
+ }
11
+
12
+ variants_attributes = [
13
+ {
14
+ product: suede_dress,
15
+ options: [name: Comable::Sample.t(:size), value: 'S'] + [name: Comable::Sample.t(:color), value: Comable::Sample.t(:navy)],
16
+ stock_attributes: default_stock_attributes,
17
+ sku: 'SUEDE-DRESS-SN'
18
+ },
19
+ {
20
+ product: suede_dress,
21
+ options: [name: Comable::Sample.t(:size), value: 'M'] + [name: Comable::Sample.t(:color), value: Comable::Sample.t(:navy)],
22
+ stock_attributes: default_stock_attributes,
23
+ sku: 'SUEDE-DRESS-MN'
24
+ },
25
+ {
26
+ product: girly_coat,
27
+ options: [name: Comable::Sample.t(:size), value: 'S'] + [name: Comable::Sample.t(:color), value: Comable::Sample.t(:beige)],
28
+ stock_attributes: default_stock_attributes,
29
+ sku: 'GIRLY-COAT-SB'
30
+ },
31
+ {
32
+ product: girly_coat,
33
+ options: [name: Comable::Sample.t(:size), value: 'M'] + [name: Comable::Sample.t(:color), value: Comable::Sample.t(:beige)],
34
+ stock_attributes: default_stock_attributes,
35
+ sku: 'GIRLY-COAT-MB'
36
+ },
37
+ {
38
+ product: girly_coat,
39
+ options: [name: Comable::Sample.t(:size), value: 'S'] + [name: Comable::Sample.t(:color), value: Comable::Sample.t(:navy)],
40
+ stock_attributes: default_stock_attributes,
41
+ sku: 'GIRLY-COAT-SN'
42
+ },
43
+ {
44
+ product: girly_coat,
45
+ options: [name: Comable::Sample.t(:size), value: 'M'] + [name: Comable::Sample.t(:color), value: Comable::Sample.t(:navy)],
46
+ stock_attributes: default_stock_attributes,
47
+ sku: 'GIRLY-COAT-MN'
48
+ },
49
+ {
50
+ product: fur_gloves,
51
+ stock_attributes: default_stock_attributes,
52
+ sku: 'FUR-GLOVES'
53
+ },
54
+ {
55
+ product: leather_boots,
56
+ options: [name: Comable::Sample.t(:size), value: 'S'],
57
+ stock_attributes: { quantity: 0 },
58
+ sku: 'LEATHER-BOOTS-S'
59
+ },
60
+ {
61
+ product: leather_boots,
62
+ options: [name: Comable::Sample.t(:size), value: 'M'],
63
+ stock_attributes: { quantity: 1 },
64
+ sku: 'LEATHER-BOOTS-M'
65
+ },
66
+ {
67
+ product: leather_boots,
68
+ options: [name: Comable::Sample.t(:size), value: 'L'],
69
+ stock_attributes: default_stock_attributes,
70
+ sku: 'LEATHER-BOOTS-L'
71
+ }
72
+ ]
73
+
74
+ variants_attributes.each do |attributes|
75
+ Comable::Variant.create!(attributes)
76
+ end
@@ -33,7 +33,7 @@ module Comable
33
33
  def definitions
34
34
  Dir["#{default_dir}/*.rb"].map do |filepath|
35
35
  File.basename(filepath, '.rb')
36
- end
36
+ end.sort
37
37
  end
38
38
 
39
39
  def default_dir
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comable-sample
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - YOSHIDA Hiroki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-16 00:00:00.000000000 Z
11
+ date: 2015-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: comable-core
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.6.0
19
+ version: 0.7.0.beta1
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: 0.6.0
26
+ version: 0.7.0.beta1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: ffaker
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 2.0.0
33
+ version: '2.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 2.0.0
40
+ version: '2.0'
41
41
  description: Provide sample data for Comable.
42
42
  email:
43
43
  - hyoshida@appirits.com
@@ -63,7 +63,7 @@ files:
63
63
  - db/samples/products.rb
64
64
  - db/samples/shipment_methods.rb
65
65
  - db/samples/shipments.rb
66
- - db/samples/stocks.rb
66
+ - db/samples/variants.rb
67
67
  - lib/comable/sample.rb
68
68
  - lib/comable/sample/address.rb
69
69
  - lib/comable/sample/engine.rb
@@ -85,9 +85,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
85
85
  version: '0'
86
86
  required_rubygems_version: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - ">="
88
+ - - ">"
89
89
  - !ruby/object:Gem::Version
90
- version: '0'
90
+ version: 1.3.1
91
91
  requirements: []
92
92
  rubyforge_project:
93
93
  rubygems_version: 2.2.2
data/db/samples/stocks.rb DELETED
@@ -1,78 +0,0 @@
1
- Comable::Sample.import('products')
2
-
3
- suede_dress = Comable::Product.where(name: Comable::Sample.t(:suede_dress)).first!
4
- girly_coat = Comable::Product.where(name: Comable::Sample.t(:girly_coat)).first!
5
- fur_gloves = Comable::Product.where(name: Comable::Sample.t(:fur_gloves)).first!
6
- leather_boots = Comable::Product.where(name: Comable::Sample.t(:leather_boots)).first!
7
-
8
- suede_dress.update_attributes!(sku_h_item_name: Comable::Sample.t(:size), sku_v_item_name: Comable::Sample.t(:color))
9
- girly_coat.update_attributes!(sku_h_item_name: Comable::Sample.t(:size), sku_v_item_name: Comable::Sample.t(:color))
10
- leather_boots.update_attributes!(sku_h_item_name: Comable::Sample.t(:size))
11
-
12
- default_stock_attributes = {
13
- quantity: 10
14
- }
15
-
16
- stocks_attributes = [
17
- {
18
- product: suede_dress,
19
- code: "#{suede_dress.code}-SN",
20
- sku_h_choice_name: 'S',
21
- sku_v_choice_name: Comable::Sample.t(:navy)
22
- },
23
- {
24
- product: suede_dress,
25
- code: "#{suede_dress.code}-MN",
26
- sku_h_choice_name: 'M',
27
- sku_v_choice_name: Comable::Sample.t(:navy)
28
- },
29
- {
30
- product: girly_coat,
31
- code: "#{girly_coat.code}-SB",
32
- sku_h_choice_name: 'S',
33
- sku_v_choice_name: Comable::Sample.t(:beige)
34
- },
35
- {
36
- product: girly_coat,
37
- code: "#{girly_coat.code}-MB",
38
- sku_h_choice_name: 'M',
39
- sku_v_choice_name: Comable::Sample.t(:beige)
40
- },
41
- {
42
- product: girly_coat,
43
- code: "#{girly_coat.code}-SN",
44
- sku_h_choice_name: 'S',
45
- sku_v_choice_name: Comable::Sample.t(:navy)
46
- },
47
- {
48
- product: girly_coat,
49
- code: "#{girly_coat.code}-MN",
50
- sku_h_choice_name: 'M',
51
- sku_v_choice_name: Comable::Sample.t(:navy)
52
- },
53
- {
54
- product: fur_gloves,
55
- code: fur_gloves.code
56
- },
57
- {
58
- product: leather_boots,
59
- code: "#{leather_boots.code}-S",
60
- sku_h_choice_name: 'S',
61
- quantity: 0
62
- },
63
- {
64
- product: leather_boots,
65
- code: "#{leather_boots.code}-M",
66
- sku_h_choice_name: 'M',
67
- quantity: 1
68
- },
69
- {
70
- product: leather_boots,
71
- code: "#{leather_boots.code}-L",
72
- sku_h_choice_name: 'L'
73
- }
74
- ]
75
-
76
- stocks_attributes.each do |attributes|
77
- Comable::Stock.create!(default_stock_attributes.merge(attributes))
78
- end