comable-core 0.7.0.beta1 → 0.7.0.beta2

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.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +7 -2
  3. data/app/controllers/concerns/comable/permitted_attributes.rb +1 -0
  4. data/app/helpers/comable/application_helper.rb +4 -0
  5. data/app/models/comable/inventory/adjuster.rb +40 -0
  6. data/app/models/comable/inventory/coordinator.rb +56 -0
  7. data/app/models/comable/inventory/package.rb +47 -0
  8. data/app/models/comable/inventory/packer.rb +25 -0
  9. data/app/models/comable/inventory/unit.rb +22 -0
  10. data/app/models/comable/navigation.rb +2 -0
  11. data/app/models/comable/navigation_item.rb +29 -6
  12. data/app/models/comable/order/associations.rb +2 -2
  13. data/app/models/comable/order/deprecated_methods.rb +27 -0
  14. data/app/models/comable/order/validations.rb +1 -1
  15. data/app/models/comable/order.rb +25 -11
  16. data/app/models/comable/order_item.rb +12 -40
  17. data/app/models/comable/page.rb +3 -3
  18. data/app/models/comable/payment_method.rb +2 -0
  19. data/app/models/comable/product.rb +16 -12
  20. data/app/models/comable/shipment.rb +26 -5
  21. data/app/models/comable/shipment_item.rb +47 -0
  22. data/app/models/comable/shipment_method.rb +1 -0
  23. data/app/models/comable/stock.rb +13 -9
  24. data/app/models/comable/stock_location.rb +29 -0
  25. data/app/models/comable/theme.rb +2 -0
  26. data/app/models/comable/tracker.rb +3 -2
  27. data/app/models/comable/user.rb +1 -0
  28. data/app/models/comable/variant/quantifier.rb +27 -0
  29. data/app/models/comable/variant.rb +25 -12
  30. data/app/models/concerns/comable/cart_owner.rb +1 -5
  31. data/app/models/concerns/comable/checkout.rb +4 -7
  32. data/app/models/concerns/comable/linkable.rb +11 -22
  33. data/app/models/concerns/comable/product/search.rb +1 -1
  34. data/app/views/comable/order_mailer/complete.text.erb +2 -3
  35. data/config/locales/en.yml +14 -0
  36. data/config/locales/ja.yml +14 -0
  37. data/db/migrate/20150918065115_add_property_to_comable_products.rb +5 -0
  38. data/db/migrate/20150924010143_create_comable_stock_locations.rb +11 -0
  39. data/db/migrate/20150924102640_add_stock_location_id_to_comable_stocks.rb +10 -0
  40. data/db/migrate/20150924111838_add_stock_location_id_to_comable_shipments.rb +7 -0
  41. data/db/migrate/20150924114017_set_default_stock_location.rb +28 -0
  42. data/db/migrate/20151012143215_create_comable_shipment_items.rb +11 -0
  43. data/db/migrate/20151013082845_remove_null_option_of_shipment_method_id_on_comable_shipments.rb +10 -0
  44. data/db/migrate/20151013194926_add_guest_token_index_to_comable_orders.rb +5 -0
  45. metadata +20 -3
@@ -0,0 +1,7 @@
1
+ class AddStockLocationIdToComableShipments < ActiveRecord::Migration
2
+ def change
3
+ change_table :comable_shipments do |t|
4
+ t.references :stock_location
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,28 @@
1
+ class SetDefaultStockLocation < ActiveRecord::Migration
2
+ def change
3
+ reversible do |dir|
4
+ dir.up { set_default_stock_location }
5
+ end
6
+ end
7
+
8
+ private
9
+
10
+ def set_default_stock_location
11
+ default_stock_location_on(Comable::Shipment)
12
+ default_stock_location_on(Comable::Stock)
13
+ end
14
+
15
+ def default_stock_location_on(model)
16
+ records = model.where(stock_location_id: nil)
17
+ return unless records.exists?
18
+ stock_location = find_or_create_default_stock_location
19
+ records.update_all(stock_location_id: stock_location.id)
20
+ end
21
+
22
+ def find_or_create_default_stock_location
23
+ Comable::StockLocation.where(default: true).first_or_initialize do |stock_location|
24
+ stock_location.name = Comable.t(:default)
25
+ stock_location.save!
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,11 @@
1
+ class CreateComableShipmentItems < ActiveRecord::Migration
2
+ def change
3
+ create_table :comable_shipment_items do |t|
4
+ t.references :shipment, null: false
5
+ t.references :stock, null: false
6
+ t.timestamps null: false
7
+ end
8
+
9
+ add_index :comable_shipment_items, :shipment_id
10
+ end
11
+ end
@@ -0,0 +1,10 @@
1
+ class RemoveNullOptionOfShipmentMethodIdOnComableShipments < ActiveRecord::Migration
2
+ def change
3
+ reversible do |dir|
4
+ change_table :comable_shipments do |t|
5
+ dir.up { t.change :shipment_method_id, :integer, null: true }
6
+ dir.down { t.change :shipment_method_id, :integer, null: false }
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,5 @@
1
+ class AddGuestTokenIndexToComableOrders < ActiveRecord::Migration
2
+ def change
3
+ add_index :comable_orders, :guest_token
4
+ end
5
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comable-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0.beta1
4
+ version: 0.7.0.beta2
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-09-25 00:00:00.000000000 Z
11
+ date: 2015-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -288,6 +288,11 @@ files:
288
288
  - app/models/comable/address.rb
289
289
  - app/models/comable/category.rb
290
290
  - app/models/comable/image.rb
291
+ - app/models/comable/inventory/adjuster.rb
292
+ - app/models/comable/inventory/coordinator.rb
293
+ - app/models/comable/inventory/package.rb
294
+ - app/models/comable/inventory/packer.rb
295
+ - app/models/comable/inventory/unit.rb
291
296
  - app/models/comable/navigation.rb
292
297
  - app/models/comable/navigation_item.rb
293
298
  - app/models/comable/option_type.rb
@@ -295,6 +300,7 @@ files:
295
300
  - app/models/comable/order.rb
296
301
  - app/models/comable/order/associations.rb
297
302
  - app/models/comable/order/callbacks.rb
303
+ - app/models/comable/order/deprecated_methods.rb
298
304
  - app/models/comable/order/morrisable.rb
299
305
  - app/models/comable/order/scopes.rb
300
306
  - app/models/comable/order/validations.rb
@@ -306,14 +312,17 @@ files:
306
312
  - app/models/comable/product.rb
307
313
  - app/models/comable/product/csvable.rb
308
314
  - app/models/comable/shipment.rb
315
+ - app/models/comable/shipment_item.rb
309
316
  - app/models/comable/shipment_method.rb
310
317
  - app/models/comable/stock.rb
311
318
  - app/models/comable/stock/csvable.rb
319
+ - app/models/comable/stock_location.rb
312
320
  - app/models/comable/store.rb
313
321
  - app/models/comable/theme.rb
314
322
  - app/models/comable/tracker.rb
315
323
  - app/models/comable/user.rb
316
324
  - app/models/comable/variant.rb
325
+ - app/models/comable/variant/quantifier.rb
317
326
  - app/models/concerns/comable/cart_owner.rb
318
327
  - app/models/concerns/comable/checkout.rb
319
328
  - app/models/concerns/comable/importable.rb
@@ -356,6 +365,14 @@ files:
356
365
  - db/migrate/20150823073250_create_comable_variants_option_values.rb
357
366
  - db/migrate/20150823073809_change_comable_products_and_comable_stocks.rb
358
367
  - db/migrate/20150823102819_change_comable_order_items.rb
368
+ - db/migrate/20150918065115_add_property_to_comable_products.rb
369
+ - db/migrate/20150924010143_create_comable_stock_locations.rb
370
+ - db/migrate/20150924102640_add_stock_location_id_to_comable_stocks.rb
371
+ - db/migrate/20150924111838_add_stock_location_id_to_comable_shipments.rb
372
+ - db/migrate/20150924114017_set_default_stock_location.rb
373
+ - db/migrate/20151012143215_create_comable_shipment_items.rb
374
+ - db/migrate/20151013082845_remove_null_option_of_shipment_method_id_on_comable_shipments.rb
375
+ - db/migrate/20151013194926_add_guest_token_index_to_comable_orders.rb
359
376
  - db/seeds.rb
360
377
  - db/seeds/comable/users.rb
361
378
  - lib/comable/core.rb
@@ -391,7 +408,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
391
408
  version: 1.3.1
392
409
  requirements: []
393
410
  rubyforge_project:
394
- rubygems_version: 2.2.2
411
+ rubygems_version: 2.4.5
395
412
  signing_key:
396
413
  specification_version: 4
397
414
  summary: Provide core functions for Comable.