comable_core 0.4.0 → 0.4.1

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: b3586df9a1e1a2267feb7f84f1658f21f92909b2
4
- data.tar.gz: 94e817e742c94849a8eb08ebf7f8de9c983c3a33
3
+ metadata.gz: d3c189f71e2286afacd9d9607498850ab4173f88
4
+ data.tar.gz: 99d3320d9c08295fd80cc41e964ebeb18b957707
5
5
  SHA512:
6
- metadata.gz: 6b03e1b7ff2c55f92048da4ab2fa08fb7c503ea2e6d70da22eebf8b1cc8f98c6c2bfb11241811c76fce533cad8cdc1dc190bf158290f58cbda72555902498132
7
- data.tar.gz: 7c24b354ae4934ba2670851b2390e18f1c292f9675cde73ac251bf0799e1d49b81f1d551926db6afed7dd6cc5074dae95c9542b76b0fc245b4a1e989cb36f75d
6
+ metadata.gz: c975609caf19b813fd71634e78e484da97f03982b0ebc27ce68699fdfa03f155db2222e8fb03d6f7d8d36748c8d6dcb6b2ce8ef444e018b2657d4365d081df1a
7
+ data.tar.gz: 987b35810b75b2a058553510b271bd4b7e1e884a2673ab7d2cd79e85f224fa32dce162adf48d8a2b4d10741e85fb6b341729947da5661792d4733159cd6a1ee9
@@ -6,7 +6,7 @@ module Comable
6
6
 
7
7
  def complete(order)
8
8
  @order = order
9
- mail(from: current_store.email_sender, to: order.email, subject: subject_for(order))
9
+ mail(from: current_store.email, to: order.email, subject: subject_for(order))
10
10
  end
11
11
 
12
12
  private
@@ -17,15 +17,15 @@ module Comable
17
17
  end
18
18
 
19
19
  def same_as?(address)
20
- attributes_without_id == address.attributes_without_id
20
+ contents == address.contents
21
21
  end
22
22
 
23
23
  def clone
24
- self.class.new(attributes_without_id)
24
+ self.class.new(contents)
25
25
  end
26
26
 
27
- def attributes_without_id
28
- attributes.except('id', 'user_id')
27
+ def contents
28
+ attributes.except('id', 'user_id', 'created_at', 'updated_at')
29
29
  end
30
30
 
31
31
  def full_name
@@ -4,7 +4,6 @@ module Comable
4
4
  validates :fee, presence: true, numericality: { greater_than_or_equal_to: 0 }
5
5
  validates :traking_url, length: { maximum: 255 }
6
6
 
7
- scope :activated, -> { where(activate_flag: true) }
8
- scope :deactivated, -> { where(activate_flag: false) }
7
+ scope :activated, -> { where(activated_flag: true) }
9
8
  end
10
9
  end
@@ -3,7 +3,7 @@ module Comable
3
3
  validates :name, length: { maximum: 255 }
4
4
  validates :meta_keywords, length: { maximum: 255 }
5
5
  validates :meta_description, length: { maximum: 255 }
6
- validates :email_sender, length: { maximum: 255 }
6
+ validates :email, length: { maximum: 255 }
7
7
 
8
8
  class << self
9
9
  def instance
@@ -15,8 +15,8 @@ module Comable
15
15
  end
16
16
  end
17
17
 
18
- def email_activate?
19
- email_activate_flag && email_sender.present?
18
+ def can_send_mail?
19
+ email.present?
20
20
  end
21
21
  end
22
22
  end
@@ -7,7 +7,7 @@ module Comable
7
7
  validates :code, presence: true
8
8
  validates :place, presence: true, length: { maximum: 255 }
9
9
 
10
- scope :activated, -> { where(activate_flag: true) }
10
+ scope :activated, -> { where(activated_flag: true) }
11
11
 
12
12
  enumerize :place, in: %i(
13
13
  everywhere
@@ -13,6 +13,10 @@ module Comable
13
13
  accepts_nested_attributes_for :bill_address
14
14
  accepts_nested_attributes_for :ship_address
15
15
 
16
+ scope :this_month, -> { where(created_at: Time.now.beginning_of_month..Time.now.end_of_month) }
17
+ scope :this_week, -> { where(created_at: Time.now.beginning_of_week..Time.now.end_of_week) }
18
+ scope :last_week, -> { where(created_at: 1.week.ago.beginning_of_week..1.week.ago.end_of_week) }
19
+
16
20
  validates :email, presence: true, length: { maximum: 255 }
17
21
 
18
22
  devise(*Comable::Config.devise_strategies[:user])
@@ -143,6 +143,7 @@ en:
143
143
  tracker_code_help_additional: '<code>order.order_items</code> is Array. And you can retrieve the following information from each element.'
144
144
  list_of_usable_variables: 'Available variables are as follows.'
145
145
  mote_infomation_for_syntax: 'For more information about the syntax please refer to the following page:'
146
+ help_of_store_email: 'This field will be used as sender of mail that send to customers. The mail will not be sent when the field is empty.'
146
147
  nav:
147
148
  dashboard: 'Dashboard'
148
149
  order: 'Orders'
@@ -304,12 +305,11 @@ en:
304
305
  name: 'Name'
305
306
  meta_keywords: 'Meta keywords'
306
307
  meta_description: 'Meta description'
307
- email_sender: 'Email sender'
308
- email_activate_flag: 'Email activated'
308
+ email: 'Email'
309
309
  comable/shipment_method:
310
310
  name: 'Name'
311
311
  fee: 'Fee'
312
- activate_flag: 'Activated'
312
+ activated_flag: 'Activated'
313
313
  traking_url: 'Tracking URL'
314
314
  comable/payment_method:
315
315
  name: 'Name'
@@ -317,7 +317,7 @@ en:
317
317
  fee: 'Fee'
318
318
  enable_price: 'Enable price range'
319
319
  comable/tracker:
320
- activate_flag: 'Activated'
320
+ activated_flag: 'Activated'
321
321
  name: 'Name'
322
322
  tracker_id: 'Tracker ID'
323
323
  code: 'Code'
@@ -143,6 +143,7 @@ ja:
143
143
  tracker_code_help_additional: '<code>order.order_items</code> は配列で、各要素から次の情報を取り出すことができます。'
144
144
  list_of_usable_variables: '利用可能な変数は次の通りです。'
145
145
  mote_infomation_for_syntax: '構文についての詳しい情報は次のページをご覧ください:'
146
+ help_of_store_email: 'この項目は顧客に送信するメールの送信元として利用されます。未入力の場合はメールが送信されません。'
146
147
  nav:
147
148
  dashboard: ダッシュボード
148
149
  order: 注文管理
@@ -304,12 +305,11 @@ ja:
304
305
  name: ストア名
305
306
  meta_keywords: メタキーワード
306
307
  meta_description: メタディスクリプション
307
- email_sender: 送信元メールアドレス
308
- email_activate_flag: メール送信を有効にする
308
+ email: メールアドレス
309
309
  comable/shipment_method:
310
310
  name: 発送方法名
311
311
  fee: 手数料
312
- activate_flag: この発送方法を有効にする
312
+ activated_flag: この発送方法を有効にする
313
313
  traking_url: トラッキングURL
314
314
  comable/payment_method:
315
315
  name: 決済方法名
@@ -317,7 +317,7 @@ ja:
317
317
  fee: '手数料'
318
318
  enable_price: 利用可能な価格範囲
319
319
  comable/tracker:
320
- activate_flag: 'このトラッキング情報を有効にする'
320
+ activated_flag: 'このトラッキング情報を有効にする'
321
321
  name: 'トラッキング名'
322
322
  tracker_id: 'トラッキングID'
323
323
  code: 'トラッキングコード'
@@ -7,8 +7,9 @@ class CreateComableProducts < ActiveRecord::Migration
7
7
  t.text :caption
8
8
  t.string :sku_h_item_name
9
9
  t.string :sku_v_item_name
10
+ t.timestamps null: false
10
11
  end
11
12
 
12
- add_index :comable_products, :code, unique: true, name: :comable_products_idx_01
13
+ add_index :comable_products, :code, unique: true
13
14
  end
14
15
  end
@@ -34,6 +34,8 @@ class CreateComableUsers < ActiveRecord::Migration
34
34
  ## Others
35
35
  t.references :bill_address
36
36
  t.references :ship_address
37
+
38
+ t.timestamps null: false
37
39
  end
38
40
 
39
41
  add_index :comable_users, :email, unique: true
@@ -6,8 +6,9 @@ class CreateComableStocks < ActiveRecord::Migration
6
6
  t.integer :quantity, null: false, default: 0
7
7
  t.string :sku_h_choice_name
8
8
  t.string :sku_v_choice_name
9
+ t.timestamps null: false
9
10
  end
10
11
 
11
- add_index :comable_stocks, :code, unique: true, name: :comable_stocks_idx_01
12
+ add_index :comable_stocks, :code, unique: true
12
13
  end
13
14
  end
@@ -12,8 +12,9 @@ class CreateComableOrders < ActiveRecord::Migration
12
12
  t.references :ship_address
13
13
  t.string :state
14
14
  t.datetime :completed_at
15
+ t.timestamps null: false
15
16
  end
16
17
 
17
- add_index :comable_orders, :code, unique: true, name: :comable_orders_idx_01
18
+ add_index :comable_orders, :code, unique: true
18
19
  end
19
20
  end
@@ -11,8 +11,9 @@ class CreateComableOrderItems < ActiveRecord::Migration
11
11
  t.string :sku_h_choice_name
12
12
  t.string :sku_v_choice_name
13
13
  t.integer :quantity, default: 1, null: false
14
+ t.timestamps null: false
14
15
  end
15
16
 
16
- add_index :comable_order_items, [:order_id, :stock_id], unique: true, name: :comable_order_items_idx_01
17
+ add_index :comable_order_items, [:order_id, :stock_id], unique: true
17
18
  end
18
19
  end
@@ -7,6 +7,7 @@ class CreateComablePaymentMethods < ActiveRecord::Migration
7
7
  t.integer :fee, null: false
8
8
  t.integer :enable_price_from
9
9
  t.integer :enable_price_to
10
+ t.timestamps null: false
10
11
  end
11
12
  end
12
13
  end
@@ -1,10 +1,11 @@
1
1
  class CreateComableShipmentMethods < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :comable_shipment_methods do |t|
4
- t.boolean :activate_flag, null: false, default: true
4
+ t.boolean :activated_flag, null: false, default: true
5
5
  t.string :name, null: false
6
6
  t.integer :fee, null: false
7
7
  t.string :traking_url
8
+ t.timestamps null: false
8
9
  end
9
10
  end
10
11
  end
@@ -4,8 +4,8 @@ class CreateComableStores < ActiveRecord::Migration
4
4
  t.string :name
5
5
  t.string :meta_keywords
6
6
  t.string :meta_description
7
- t.string :email_sender
8
- t.boolean :email_activate_flag, null: false, default: true
7
+ t.string :email
8
+ t.timestamps null: false
9
9
  end
10
10
  end
11
11
  end
@@ -11,6 +11,7 @@ class CreateComableAddresses < ActiveRecord::Migration
11
11
  t.string :detail
12
12
  t.string :phone_number, null: false, limit: 18
13
13
  t.datetime :last_used_at
14
+ t.timestamps null: false
14
15
  end
15
16
  end
16
17
  end
@@ -4,6 +4,7 @@ class CreateComableCategories < ActiveRecord::Migration
4
4
  t.string :name, null: false
5
5
  t.string :ancestry, index: true
6
6
  t.integer :position
7
+ t.timestamps null: false
7
8
  end
8
9
  end
9
10
  end
@@ -3,6 +3,7 @@ class CreateComableImages < ActiveRecord::Migration
3
3
  create_table :comable_images do |t|
4
4
  t.references :product, null: false, index: true
5
5
  t.string :file, null: false
6
+ t.timestamps null: false
6
7
  end
7
8
  end
8
9
  end
@@ -7,6 +7,7 @@ class CreateComableShipments < ActiveRecord::Migration
7
7
  t.string :state, null: false
8
8
  t.string :tracking_number
9
9
  t.datetime :completed_at
10
+ t.timestamps null: false
10
11
  end
11
12
  end
12
13
  end
@@ -6,6 +6,7 @@ class CreateComablePayments < ActiveRecord::Migration
6
6
  t.integer :fee, null: false
7
7
  t.string :state, null: false
8
8
  t.datetime :completed_at
9
+ t.timestamps null: false
9
10
  end
10
11
  end
11
12
  end
@@ -1,12 +1,13 @@
1
1
  class CreateComableTrackers < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :comable_trackers do |t|
4
- # TODO: Rename the column: activate_flag => activated
5
- t.boolean :activate_flag, null: false, default: true
4
+ # TODO: Rename the column: activated_flag => activated
5
+ t.boolean :activated_flag, null: false, default: true
6
6
  t.string :name, null: false
7
7
  t.string :tracker_id
8
8
  t.text :code, null: false
9
9
  t.string :place, null: false
10
+ t.timestamps null: false
10
11
  end
11
12
  end
12
13
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comable_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - YOSHIDA Hiroki
@@ -298,7 +298,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
298
298
  version: '0'
299
299
  requirements: []
300
300
  rubyforge_project:
301
- rubygems_version: 2.2.2
301
+ rubygems_version: 2.4.5
302
302
  signing_key:
303
303
  specification_version: 4
304
304
  summary: Provide core functions for Comable.