solidus_tec_estimator 0.0.3 → 1.0.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
  SHA256:
3
- metadata.gz: 7e767590fc01f411d98c20069d71a1ed850c8dd32682e59d8d3c33c1cc397179
4
- data.tar.gz: 44d790f17cb9e358db130f4ce66b2dd4512144b5524fde2f743887a57fe1591d
3
+ metadata.gz: e5e7cd13f4896e9a372dd9f05843b4740b416130570780457e1ee61bebde2c1a
4
+ data.tar.gz: 3194224d288d40fd74bf0f9ce1558f84219c92739ed506840b75c93be07334a4
5
5
  SHA512:
6
- metadata.gz: d8bf77f7f25fd6af4032075c76b0e5370b00432555730a7ead5710070752f06a084782edbecdddd449b98a7dbe26d266c129c7bfb4debd23face30361fcb02ea
7
- data.tar.gz: 252cd3f1e914d7e00fb954b30bd3dd4453f86eb756cd41ce4c5684b442d82db4a0d353e4f751fdcc5b7181f212f8251d97301d740e499caa05609eb3e728e4a3
6
+ metadata.gz: 4fa22eb8ecc2a66ee4431e6ad34db0adbe12b7e9ceea0d528f73800ca6a3dda880dd1379e1df1840e420afa3bc5e9a40f43479586b81a23029843592acc64956
7
+ data.tar.gz: 3b7ad8dd88b055ff69d5c643cf47fb54feda8ec98769f651a3414e842e1fd662f529e55f1e7e9726289fd1996d0cbf167b74a7ed0bd8aa85f299a72f09e01c7c
data/README.md CHANGED
@@ -1,8 +1,5 @@
1
1
  # Solidus Tec Estimator
2
2
 
3
- [![CircleCI](https://circleci.com/gh/solidusio-contrib/solidus_tec_estimator.svg?style=shield)](https://circleci.com/gh/solidusio-contrib/solidus_tec_estimator)
4
- [![codecov](https://codecov.io/gh/solidusio-contrib/solidus_tec_estimator/branch/main/graph/badge.svg)](https://codecov.io/gh/solidusio-contrib/solidus_tec_estimator)
5
-
6
3
  <!-- Explain what your extension does. -->
7
4
 
8
5
  ## Installation
@@ -18,56 +15,3 @@ Bundle your dependencies and run the installation generator:
18
15
  ```shell
19
16
  bin/rails generate solidus_tec_estimator:install
20
17
  ```
21
-
22
- ## Usage
23
-
24
- <!-- Explain how to use your extension once it's been installed. -->
25
-
26
- ## Development
27
-
28
- ### Testing the extension
29
-
30
- First bundle your dependencies, then run `bin/rake`. `bin/rake` will default to building the dummy
31
- app if it does not exist, then it will run specs. The dummy app can be regenerated by using
32
- `bin/rake extension:test_app`.
33
-
34
- ```shell
35
- bin/rake
36
- ```
37
-
38
- To run [Rubocop](https://github.com/bbatsov/rubocop) static code analysis run
39
-
40
- ```shell
41
- bundle exec rubocop
42
- ```
43
-
44
- When testing your application's integration with this extension you may use its factories.
45
- You can load Solidus core factories along with this extension's factories using this statement:
46
-
47
- ```ruby
48
- SolidusDevSupport::TestingSupport::Factories.load_for(SolidusTecEstimator::Engine)
49
- ```
50
-
51
- ### Running the sandbox
52
-
53
- To run this extension in a sandboxed Solidus application, you can run `bin/sandbox`. The path for
54
- the sandbox app is `./sandbox` and `bin/rails` will forward any Rails commands to
55
- `sandbox/bin/rails`.
56
-
57
- Here's an example:
58
-
59
- ```
60
- $ bin/rails server
61
- => Booting Puma
62
- => Rails 6.0.2.1 application starting in development
63
- * Listening on tcp://127.0.0.1:3000
64
- Use Ctrl-C to stop
65
- ```
66
-
67
- ### Releasing new versions
68
-
69
- Please refer to the [dedicated page](https://github.com/solidusio/solidus/wiki/How-to-release-extensions) in the Solidus wiki.
70
-
71
- ## License
72
-
73
- Copyright (c) 2024 ulysses, released under the New BSD License.
@@ -38,21 +38,22 @@ module SolidusTecEstimator
38
38
  shipping_method.provider_id = SolidusTecEstimator::Provider.find_by(class_name: self.class.to_s).id
39
39
  end
40
40
 
41
- if Time.now < Time.now.change({hour: 16}) && Time.now.on_weekday?
42
- min_delivery_time = (Time.now + 30.minutes)
43
- max_delivery_time = (Time.now + 2.hours)
44
- elsif Time.now > Time.now.change({hour: 16}) && Time.now.next_day.on_weekday?
45
- min_delivery_time = Time.now.next_day.change({hour: 8})
46
- max_delivery_time = Time.now.next_day.change({hour: 10})
41
+ time_now = Time.now.in_time_zone('America/Sao_Paulo')
42
+ if time_now < time_now.change({hour: 16}) && time_now.on_weekday?
43
+ min_delivery_time = (time_now + 30.minutes)
44
+ max_delivery_time = (time_now + 2.hours)
45
+ elsif time_now > time_now.change({hour: 16}) && time_now.next_day.on_weekday?
46
+ min_delivery_time = time_now.next_day.change({hour: 8})
47
+ max_delivery_time = time_now.next_day.change({hour: 10})
47
48
  else
48
- min_delivery_time = Time.now.next_weekday.change({hour: 8})
49
- max_delivery_time = Time.now.next_weekday.change({hour: 10})
49
+ min_delivery_time = time_now.next_weekday.change({hour: 8})
50
+ max_delivery_time = time_now.next_weekday.change({hour: 10})
50
51
  end
51
52
 
52
53
  Spree::ShippingRate.new(
53
54
  shipment: package.shipment,
54
55
  shipping_method: shipping_method,
55
- cost: 0,
56
+ cost: shipping_method.calculator.compute(package),
56
57
  min_delivery_time: min_delivery_time,
57
58
  max_delivery_time: max_delivery_time
58
59
  )
@@ -1,3 +1,3 @@
1
1
  module SolidusTecEstimator
2
- VERSION = '0.0.3'
2
+ VERSION = '1.0.1'
3
3
  end
@@ -10,12 +10,12 @@ Gem::Specification.new do |spec|
10
10
 
11
11
  spec.summary = ''
12
12
  spec.description = ''
13
- spec.homepage = 'https://github.com/ulysses-bull/solidus_tec_estimator#readme'
13
+ spec.homepage = 'https://github.com/todasessascoisas/solidus_tec_estimator#readme'
14
14
  spec.license = 'BSD-3-Clause'
15
15
 
16
16
  spec.metadata['homepage_uri'] = spec.homepage
17
- spec.metadata['source_code_uri'] = 'https://github.com/ulysses-bull/solidus_tec_estimator'
18
- spec.metadata['changelog_uri'] = 'https://github.com/ulysses-bull/solidus_tec_estimator'
17
+ spec.metadata['source_code_uri'] = 'https://github.com/todasessascoisas/solidus_tec_estimator'
18
+ spec.metadata['changelog_uri'] = 'https://github.com/todasessascoisas/solidus_tec_estimator/blob/main/CHANGELOG.md'
19
19
 
20
20
  spec.required_ruby_version = Gem::Requirement.new('>= 2.5', '< 4')
21
21
 
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: 0.0.3
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ulysses
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-08-13 00:00:00.000000000 Z
11
+ date: 2024-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: solidus_core
@@ -103,13 +103,13 @@ files:
103
103
  - solidus_tec_estimator.gemspec
104
104
  - test/fixtures/solidus_tec_estimator/providers.yml
105
105
  - test/models/solidus_tec_estimator/provider_test.rb
106
- homepage: https://github.com/ulysses-bull/solidus_tec_estimator#readme
106
+ homepage: https://github.com/todasessascoisas/solidus_tec_estimator#readme
107
107
  licenses:
108
108
  - BSD-3-Clause
109
109
  metadata:
110
- homepage_uri: https://github.com/ulysses-bull/solidus_tec_estimator#readme
111
- source_code_uri: https://github.com/ulysses-bull/solidus_tec_estimator
112
- changelog_uri: https://github.com/ulysses-bull/solidus_tec_estimator
110
+ homepage_uri: https://github.com/todasessascoisas/solidus_tec_estimator#readme
111
+ source_code_uri: https://github.com/todasessascoisas/solidus_tec_estimator
112
+ changelog_uri: https://github.com/todasessascoisas/solidus_tec_estimator/blob/main/CHANGELOG.md
113
113
  post_install_message:
114
114
  rdoc_options: []
115
115
  require_paths: