solidus_me 2.1.0 → 2.2.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ac9a87c3290b27f9bfdfe1b768e6d3f67acd254f379770941bc9aa8ffbce1a4e
4
- data.tar.gz: c77ce18ca59222256a0d568e431510263d261fd75a6efc879fc1584efc804c36
3
+ metadata.gz: d2e9f293638ff0c3b7d0c57b87aeec56046f7f846cea50a1b6b3fef334df7a44
4
+ data.tar.gz: 5100ecb5e3b430fdb67ba3d76ae28eb1f96cbb092b8f966660134203da115a9b
5
5
  SHA512:
6
- metadata.gz: '08a3e3ebd005462fa3f2659c3c43cf3249bf3ab1ba9349f97cb8d8ab2a11a933350da3d97b702a1ab8e19dce83ae2e5a7597a6cde70f6eb3701a4488c5139e73'
7
- data.tar.gz: 05e0b596611864ba74d461001321ae7436b973c6d873f74a96467545435e513946e662ccea5506e2e7c485f4e461f46c2f90f40a2b50df6e0997044dddbcbd87
6
+ metadata.gz: 17401a6ce413265b73362cae515fca208b9f811eac36e50abe8b415996fa224547ee371607515ffefc3fb6e62f2a771dd8afd682903552f21b50febc71abf018
7
+ data.tar.gz: 8045ae66d039acc94ddfea8ff8261019657b1b31eb41fa2cad26b92fbe29676d806bb546add6433c8465cb113bbec1607a811b01ddcfa8272e8c30c3107e82da
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "bundler/gem_tasks"
4
- require "solidus_dev_support/rake_tasks"
5
- SolidusDevSupport::RakeTasks.install
4
+ # require "solidus_dev_support/rake_tasks"
5
+ # SolidusDevSupport::RakeTasks.install
6
6
 
7
7
  task default: "extension:specs"
@@ -23,15 +23,24 @@ module SolidusMe
23
23
  private
24
24
 
25
25
  def get_rates_from_melhor_envio(package)
26
- weight = package.contents.map { |content| content.weight }.sum
27
26
  price = package.contents.map { |content| content.price }.sum
27
+ weight = package.weight
28
+
29
+ variants = package.contents.map { |content| content.variant }
30
+ height_cm = height(variants)
31
+ width_cm = width(variants)
32
+ length_cm = length(variants)
33
+
28
34
  zipcode = package.order.ship_address.zipcode
29
35
  services = @me_account.services.blank? ? ["SEDEX", "PAC", "Mini Envios", ".Package", ".Com"] : @me_account.services
30
36
 
31
37
  rates = @me_client.rates(
32
38
  from: @me_account.postal_code_from,
33
39
  to: zipcode,
34
- weight_kg: (weight / 1000),
40
+ weight_kg: (weight / 1000.00),
41
+ height_cm: height_cm,
42
+ width_cm: width_cm,
43
+ length_cm: length_cm,
35
44
  contents_value_brl: price
36
45
  )
37
46
  rates.select { |rate| rate.price > 0 && services.include?(rate.service_name) }
@@ -67,5 +76,17 @@ module SolidusMe
67
76
  delivery_range: {"min" => 5, "max" => 5}
68
77
  )
69
78
  end
79
+
80
+ def height variants
81
+ variants.pluck(:height, :width, :depth).map(&:max).compact.max
82
+ end
83
+
84
+ def width variants
85
+ variants.pluck(:height, :width, :depth).map { |dimensions| dimensions.sort[1] }.compact.max
86
+ end
87
+
88
+ def length variants
89
+ variants.pluck(:height, :width, :depth).map(&:min).compact.sum
90
+ end
70
91
  end
71
92
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidusMe
4
- VERSION = "2.1.0"
4
+ VERSION = "2.2.0"
5
5
  end
data/solidus_me.gemspec CHANGED
@@ -10,12 +10,12 @@ Gem::Specification.new do |spec|
10
10
 
11
11
  spec.summary = "Gem para integração com a API do Melhor Envio"
12
12
  spec.description = "Gem para integração com a API do Melhor Envio"
13
- spec.homepage = "https://github.com/solidusio-contrib/solidus_me#readme"
13
+ spec.homepage = "https://github.com/ulysses-bull/solidus_me#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/solidusio-contrib/solidus_me"
18
- spec.metadata["changelog_uri"] = "https://github.com/solidusio-contrib/solidus_me/blob/master/CHANGELOG.md"
17
+ spec.metadata["source_code_uri"] = "https://github.com/ulysses-bull/solidus_me"
18
+ spec.metadata["changelog_uri"] = "https://github.com/ulysses-bull/solidus_me/blob/master/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_me
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hamilton Tumenas Borges
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-23 00:00:00.000000000 Z
11
+ date: 2024-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: solidus_core
@@ -132,14 +132,14 @@ files:
132
132
  - lib/solidus_me/testing_support/factories.rb
133
133
  - lib/solidus_me/version.rb
134
134
  - solidus_me.gemspec
135
- homepage: https://github.com/solidusio-contrib/solidus_me#readme
135
+ homepage: https://github.com/ulysses-bull/solidus_me#readme
136
136
  licenses:
137
137
  - BSD-3-Clause
138
138
  metadata:
139
- homepage_uri: https://github.com/solidusio-contrib/solidus_me#readme
140
- source_code_uri: https://github.com/solidusio-contrib/solidus_me
141
- changelog_uri: https://github.com/solidusio-contrib/solidus_me/blob/master/CHANGELOG.md
142
- post_install_message:
139
+ homepage_uri: https://github.com/ulysses-bull/solidus_me#readme
140
+ source_code_uri: https://github.com/ulysses-bull/solidus_me
141
+ changelog_uri: https://github.com/ulysses-bull/solidus_me/blob/master/CHANGELOG.md
142
+ post_install_message:
143
143
  rdoc_options: []
144
144
  require_paths:
145
145
  - lib
@@ -157,8 +157,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
157
  - !ruby/object:Gem::Version
158
158
  version: '0'
159
159
  requirements: []
160
- rubygems_version: 3.4.20
161
- signing_key:
160
+ rubygems_version: 3.5.3
161
+ signing_key:
162
162
  specification_version: 4
163
163
  summary: Gem para integração com a API do Melhor Envio
164
164
  test_files: []