squake 0.2.3 → 0.2.4

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: ee6305b25a05791eab5def5da0136c3d3ce4c9f21d2a08335376e48ae258ce38
4
- data.tar.gz: 5627d8bcb46e2ae7cc3b22f5452f81e57c0c68f6185ddef0252c055b8b08d9a9
3
+ metadata.gz: fbe25ba449a2b7838a20ae80a5bcd9106bfe21a2f2626185a9eb901dc9e2f58a
4
+ data.tar.gz: 18b8e92dabac3f0f0657a27b6adadd9616530421c640c4b6a584f1d454e16596
5
5
  SHA512:
6
- metadata.gz: cfdd7561a7e8fd2a517a3da273bde5bf7f8e4a6ffc4135c7d0333845072e980f1f933967dab6435f647c0cc211f5fa1d5a401be7e68f9094236e51671b73f0b6
7
- data.tar.gz: 914e22650297a827546698deaf3510a99aedf7608cc84539976cc8e19cfeb4fdf7deb9ddc596144de2c1e26fb0269f48708b425609e4b6cd8f4c90b970058034
6
+ metadata.gz: b302c402858193ee25d25ed3ed610362b1bb00ce477956c9c6f7e440b312e758b9eddd6861841f5fb8059eb0300728d85707b44964d2f10614a4f20429c3bf4c
7
+ data.tar.gz: ee363ceeb88006801dfcc7a6be2535ac82357e001cd3e71c6b4d86e722f71719b84fcc536897cb1505374cd7a2226f17764ddc2e7bff678c0cef62ac234473ae
@@ -11,12 +11,17 @@ module Squake
11
11
  sig do
12
12
  params(
13
13
  client: Squake::Client,
14
- items: T::Array[Squake::Model::Items::BaseType],
14
+ items: T::Array[T.any(Squake::Model::Items::BaseType, T::Hash[T.any(String, Symbol), T.untyped])],
15
15
  carbon_unit: String,
16
16
  expand: T::Array[String],
17
17
  ).returns(Squake::Model::Carbon)
18
18
  end
19
19
  def self.create(client:, items:, carbon_unit: 'gram', expand: [])
20
+ # @TODO: add typed objects for all possible items. Until then, we allow either a Hash or a T::Struct
21
+ items = items.map do |item|
22
+ item.is_a?(T::Struct) ? item.serialize : item
23
+ end
24
+
20
25
  result = client.call(
21
26
  path: ENDPOINT,
22
27
  method: :post,
@@ -20,7 +20,7 @@ module Squake
20
20
  end
21
21
  def self.quote(client:, items:, product:, currency: 'EUR', carbon_unit: 'gram', expand: [])
22
22
  # @TODO: add typed objects for all possible items. Until then, we allow either a Hash or a T::Struct
23
- items.map! do |item|
23
+ items = items.map do |item|
24
24
  item.is_a?(T::Struct) ? item.serialize : item
25
25
  end
26
26
 
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Squake
5
- VERSION = '0.2.3'
5
+ VERSION = '0.2.4'
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: squake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - SQUAKE