21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/squake/calculation_with_pricing.rb', line 21
def self.quote(client:, items:, product:, currency: 'EUR', carbon_unit: 'gram', expand: [])
result = client.call(
path: ENDPOINT,
method: :post,
params: {
items: items.map(&:serialize),
product: product,
currency: currency,
carbon_unit: carbon_unit,
expand: expand,
},
)
raise Squake::APIError.new(response: result) unless result.success?
Squake::Model::Pricing.from_api_response(
T.cast(result.body, T::Hash[Symbol, T.untyped]),
)
end
|