comee_core 0.2.51 → 0.2.52

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
  SHA256:
3
- metadata.gz: 3cefcb81eb41e5db7078a2de7c478cf2cf477bd747272e684a6acb7590f4df22
4
- data.tar.gz: 355d9461d9208c214a99819e78242923d37027ec909e70e59d47021ce30700b1
3
+ metadata.gz: 77d65a7b04edc641f78ca618e99b2012c6af5bad03f540ebf3e9792f8ba9e4f8
4
+ data.tar.gz: a29faf7e98063e8cdf085edda635e59b5e93656ea65f88c82da658cbba79f9d4
5
5
  SHA512:
6
- metadata.gz: dfa1546039693c3138a202c59391fc169c579b465c9ede57808f9c61f7995324108cd25cbb79d7527bcfcd95e9b0205e2fa9c2687c5b34a6a07a3998fa4a26de
7
- data.tar.gz: 5f9ea82e05e6467269bc8cf9fd5815c87dad8668df654ad8a5a0ce17bd94daa77e48415349c718f304de4212f82b94538c10f553dba4a96bed42a29a4134e93e
6
+ metadata.gz: cd1e0cd56613288784e43ea0fbf439ed27164035413d0147466b683e8d7d4be92242b2bf77388317df78e94ece7d34a0865f760399885c1478c5b50225c7d7ed
7
+ data.tar.gz: e6724f1710e3c5cf6197b89f5aa31c44039ab9b50a50a0568ef8fc13dcba5a22c66b9fb167f6e6475290f89b6f625cc17a1b70e98717a6a6d7ef9bdc0ce0ae8b
@@ -0,0 +1,18 @@
1
+ module Comee
2
+ module Core
3
+ class NotificationMailer < ApplicationMailer
4
+ def notify
5
+ user = params[:user]
6
+
7
+ mail(
8
+ from: email_address_with_name(user.email, user.name),
9
+ to: params[:recipients],
10
+ subject: params[:subject],
11
+ body: params[:email_body],
12
+ content_type: "text/html",
13
+ delivery_method_options: user.delivery_options
14
+ )
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,13 @@
1
+ module Comee
2
+ module Core
3
+ class EmailSetting < ApplicationRecord
4
+ belongs_to :user
5
+
6
+ encrypts :smtp_password
7
+
8
+ validates :smtp_address, :smtp_port, :smtp_user, :smtp_password, :authentication, :open_timeout, :read_timeout,
9
+ presence: true
10
+ validates :open_timeout, :read_timeout, numericality: {greater_than: 0}
11
+ end
12
+ end
13
+ end
@@ -3,6 +3,7 @@ module Comee
3
3
  class Pod < ApplicationRecord
4
4
  enum :status, {draft: 0, confirmed: 1, signed: 2}
5
5
  has_many :shipment_instruction_items
6
+ has_many :pickup_schedules
6
7
  has_many :delivery_notes
7
8
  has_many :invoices
8
9
 
@@ -2,12 +2,27 @@ module Comee
2
2
  module Core
3
3
  class User < ApplicationRecord
4
4
  enum :user_type, {supplier: 0, admin: 1, client: 2, clerk: 3, order_manager: 4}
5
+ has_one :email_setting
5
6
 
6
7
  has_secure_password
7
8
  has_many :notifications, as: :recipient, dependent: :destroy
8
9
 
9
10
  validates :name, :email, :user_type, presence: true
10
11
  validates :email, uniqueness: true
12
+
13
+ def delivery_options
14
+ setting = email_setting
15
+ {
16
+ address: setting.smtp_address,
17
+ port: setting.smtp_port,
18
+ user_name: setting.smtp_user,
19
+ password: setting.smtp_password,
20
+ authentication: setting.authentication,
21
+ enable_starttls_auto: setting.starttls_auto,
22
+ open_timeout: setting.open_timeout,
23
+ read_timeout: setting.read_timeout
24
+ }
25
+ end
11
26
  end
12
27
  end
13
28
  end
@@ -0,0 +1,20 @@
1
+ class CreateComeeCoreEmailSettings < ActiveRecord::Migration[7.1]
2
+ def change
3
+ create_table :comee_core_email_settings do |t|
4
+ t.references :user,
5
+ null: false,
6
+ index: {name: "user_on_cces_indx"},
7
+ foreign_key: {to_table: :comee_core_users}
8
+ t.string :smtp_address, null: false
9
+ t.string :smtp_port, null: false
10
+ t.string :smtp_user, null: false
11
+ t.string :smtp_password, null: false
12
+ t.string :authentication, null: false, default: "plain"
13
+ t.boolean :starttls_auto, null: false, default: true
14
+ t.integer :open_timeout, null: false, default: 5
15
+ t.integer :read_timeout, null: false, default: 5
16
+
17
+ t.timestamps
18
+ end
19
+ end
20
+ end
@@ -1,5 +1,5 @@
1
1
  module Comee
2
2
  module Core
3
- VERSION = "0.2.51".freeze
3
+ VERSION = "0.2.52".freeze
4
4
  end
5
5
  end
@@ -0,0 +1,13 @@
1
+ FactoryBot.define do
2
+ factory :email_setting, class: "Comee::Core::EmailSetting" do
3
+ user
4
+ smtp_address { "smtp.gmail.com" }
5
+ smtp_port { "587" }
6
+ smtp_user { Faker::Internet.username }
7
+ smtp_password { Faker::Internet.password }
8
+ authentication { "plain" }
9
+ starttls_auto { true }
10
+ open_timeout { 5 }
11
+ read_timeout { 5 }
12
+ end
13
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comee_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.51
4
+ version: 0.2.52
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-06 00:00:00.000000000 Z
11
+ date: 2024-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers
@@ -296,6 +296,7 @@ files:
296
296
  - app/controllers/concerns/comee/core/pagination.rb
297
297
  - app/jobs/comee_core/application_job.rb
298
298
  - app/mailers/comee/core/application_mailer.rb
299
+ - app/mailers/comee/core/notification_mailer.rb
299
300
  - app/mailers/comee/core/supplier_mailer.rb
300
301
  - app/models/comee/core/additional_item.rb
301
302
  - app/models/comee/core/agent.rb
@@ -313,6 +314,7 @@ files:
313
314
  - app/models/comee/core/customs_detail.rb
314
315
  - app/models/comee/core/delivery_note.rb
315
316
  - app/models/comee/core/edi_order.rb
317
+ - app/models/comee/core/email_setting.rb
316
318
  - app/models/comee/core/external_rfq.rb
317
319
  - app/models/comee/core/fulfillment_center.rb
318
320
  - app/models/comee/core/inventory.rb
@@ -445,6 +447,7 @@ files:
445
447
  - db/migrate/20240328132454_create_comee_core_supplier_invoices.rb
446
448
  - db/migrate/20240328132713_create_comee_core_payment_orders.rb
447
449
  - db/migrate/20240328132921_create_comee_core_supplier_payments.rb
450
+ - db/migrate/20240407083617_create_comee_core_email_settings.rb
448
451
  - lib/comee/core.rb
449
452
  - lib/comee/core/engine.rb
450
453
  - lib/comee/core/version.rb
@@ -465,6 +468,7 @@ files:
465
468
  - spec/factories/comee/core/customs_details.rb
466
469
  - spec/factories/comee/core/delivery_notes.rb
467
470
  - spec/factories/comee/core/edi_orders.rb
471
+ - spec/factories/comee/core/email_settings.rb
468
472
  - spec/factories/comee/core/external_rfqs.rb
469
473
  - spec/factories/comee/core/fulfillment_centers.rb
470
474
  - spec/factories/comee/core/inventories.rb
@@ -524,7 +528,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
524
528
  - !ruby/object:Gem::Version
525
529
  version: '0'
526
530
  requirements: []
527
- rubygems_version: 3.5.6
531
+ rubygems_version: 3.5.7
528
532
  signing_key:
529
533
  specification_version: 4
530
534
  summary: An engine for the COMee ERP.