solidus_tec_estimator 1.0.5 → 2.0.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
  SHA256:
3
- metadata.gz: 6c6cd4f4ae5132949061a5e6fc1e5a7f454623e3cf5afc9618fd08c2c8f413a6
4
- data.tar.gz: b3e71b92b291a2ed5bc8d2a10210d1185de0601b0d5ab8b2a421b91487d9fb03
3
+ metadata.gz: b5e4dc99244ea1042793e9040e0e9e7e21aba0e95299c20c0723a2795cc2298a
4
+ data.tar.gz: 39eee3390a6e1536306f79fb3a6a4882b9c4de073a64cf8ba9fc5f3cfa0e892f
5
5
  SHA512:
6
- metadata.gz: cceb0966d0b47f28e7a342536fd43b7394a38349d070adca7087f1e67a6a548d11f4af73435904b99e2a64a752f4da912ab7f2d0bcc0409d10837daee693d810
7
- data.tar.gz: 84cb73efd1f1c1f770243a16f0abc0cdc50b3ad4c36f87dd2212264381a995a90b24e3f224caf3737d9b4dd26dbe828d7d8c85cc3ec46ba44cf80c32c1d5680d
6
+ metadata.gz: e2b9ce9dffb0e046b438a060b92133a278e7e32d36ec56dc189b7a1acbbe0602b5cefbb15daf073302dd3d3710909f4bd7817dfd96ec3603a322c5cff19ca8c3
7
+ data.tar.gz: e51d4827b3e2e57344ea1eaa7941bb582754946355d60c4097f9b53bf4a17a5a9ad387102c69b8de10cd692b99dcd7a52c47783dec6cfde63560ebbdb8cb0bc2
@@ -58,23 +58,26 @@ module SolidusTecEstimator
58
58
  shipping_method: shipping_method,
59
59
  cost: shipping_method.calculator.compute(package),
60
60
  min_delivery_time: min_delivery_time,
61
- max_delivery_time: max_delivery_time
61
+ max_delivery_time: max_delivery_time,
62
+ estimate_prose: create_estimate_prose(max_delivery_time),
63
+ expires_in: Time.now + 2.hours
62
64
  )
63
65
  end
64
66
 
65
67
  def cep_de_sjbv?
66
68
  sjbv_ceps = Cep.where(localidade: "São João da Boa Vista").pluck(:codigo_postal).map(&:to_i)
69
+ return false if sjbv_ceps.empty?
67
70
  zipcode = package.order.ship_address.zipcode.gsub(/\D/, "").to_i
68
71
  zipcode >= sjbv_ceps.min && zipcode <= sjbv_ceps.max
69
72
  end
70
73
 
71
- def self.calculate_delivery_time rate
72
- if rate.max_delivery_time.today?
74
+ def create_estimate_prose delivery_time
75
+ if delivery_time.today?
73
76
  "Chegará em até 2 horas"
74
- elsif rate.max_delivery_time.tomorrow?
77
+ elsif delivery_time.tomorrow?
75
78
  "Chegará amanhã até às 10h"
76
79
  else
77
- "Chegará em #{ActionController::Base.helpers.pluralize((rate.max_delivery_time.to_datetime.end_of_day - DateTime.now).to_i, "dia", plural: "dias")}"
80
+ "Chegará em #{ActionController::Base.helpers.pluralize((delivery_time.to_datetime.end_of_day - DateTime.now).to_i, "dia", plural: "dias")}"
78
81
  end
79
82
  end
80
83
 
@@ -1,3 +1,3 @@
1
1
  module SolidusTecEstimator
2
- VERSION = '1.0.5'
2
+ VERSION = '2.0.0'
3
3
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "solidus_brazilian_adaptations"
4
+
3
5
  require 'solidus_tec_estimator/configuration'
4
6
  require 'solidus_tec_estimator/version'
5
7
  require 'solidus_tec_estimator/engine'
@@ -31,6 +31,7 @@ Gem::Specification.new do |spec|
31
31
 
32
32
  spec.add_dependency 'solidus_core', ['>= 2.0.0', '< 5']
33
33
  spec.add_dependency 'solidus_support', '~> 0.5'
34
+ spec.add_dependency "solidus_brazilian_adaptations"
34
35
 
35
36
  spec.add_development_dependency 'solidus_dev_support', '~> 2.9'
36
37
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_tec_estimator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ulysses
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-09-12 00:00:00.000000000 Z
11
+ date: 2024-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: solidus_core
@@ -44,6 +44,20 @@ dependencies:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0.5'
47
+ - !ruby/object:Gem::Dependency
48
+ name: solidus_brazilian_adaptations
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
47
61
  - !ruby/object:Gem::Dependency
48
62
  name: solidus_dev_support
49
63
  requirement: !ruby/object:Gem::Requirement
@@ -93,7 +107,6 @@ files:
93
107
  - config/routes.rb
94
108
  - db/migrate/20240806142636_create_solidus_tec_estimator_providers.rb
95
109
  - db/migrate/20240806165855_add_provider_id_to_shipping_method.rb
96
- - db/migrate/20240806202950_recreate_min_and_max_delivery_time.rb
97
110
  - lib/generators/solidus_tec_estimator/install/install_generator.rb
98
111
  - lib/generators/solidus_tec_estimator/install/templates/initializer.rb
99
112
  - lib/solidus_tec_estimator.rb
@@ -1,9 +0,0 @@
1
- class RecreateMinAndMaxDeliveryTime < ActiveRecord::Migration[7.1]
2
- def change
3
- remove_column :spree_shipping_rates, :min_delivery_time, if_exists: true
4
- remove_column :spree_shipping_rates, :max_delivery_time, if_exists: true
5
-
6
- add_column :spree_shipping_rates, :min_delivery_time, :datetime
7
- add_column :spree_shipping_rates, :max_delivery_time, :datetime
8
- end
9
- end