squake 0.5.1 → 0.6.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: 8777e0847a6851455fbf62736f46f685c18a393e33a1586f1f879ceee4fdc4ba
4
- data.tar.gz: b6c5bb698721fdce1b2d51e552ac3d1c82fac4f8330098667b4f6a17f20b0bd2
3
+ metadata.gz: 9998b15ce76aa8dbc8be90d10591fcc590a6371f49ff5f18782ce77081ff1420
4
+ data.tar.gz: 68b42dec21a0f57f64b1fd12b1a206496cd7b0e2c2aefccb75d3890914865f2a
5
5
  SHA512:
6
- metadata.gz: 5c701fef3eb69146d564477e923f551328f6e5898161e58fc65ed659ed7e2c5796d02f432359fb19b1a7ea611524de3ff0daa7dbe891f963b6c1c70f62feffd7
7
- data.tar.gz: 55f77258422c2f3fc525a63d2815fd3e68edf5480145e2629d4738489e42df9eafb43bb4f4de81c0ad8c9593482992eca2afbf039488ef225c2be2ee414a676d
6
+ metadata.gz: 20b305cc676a3fce372ca814206a4299b173ae9560115f582dd957abd2387b3d8defd44f254ec5a835a94e1eb6e366fe7c23ecb9bf5c71edc360ee92268ebb05
7
+ data.tar.gz: ef97791c2cfb0bddde5cc0e15eca9e5d2055d24daceffee4e77473d3595bb4fa5f1ee5eeb6430580b7da2efdc0a610763f5d75bcee65010d727a04774706ade0
data/README.md CHANGED
@@ -123,11 +123,12 @@ end
123
123
 
124
124
  ```ruby
125
125
  Squake::Pricing.quote(
126
- client: squake_client, # optional
127
- carbon_quantity: 1000, # required
128
- carbon_unit: 'kilogram', # optional, default: 'gram', other options: 'kilogram', 'tonne'
129
- product_id: 'some_product_id', # required
130
- expand: [], # optional, default: [], allowed values: 'product', 'price' to enrich the response
126
+ client: squake_client, # optional
127
+ carbon_quantity: 1000, # required
128
+ carbon_unit: 'kilogram', # optional, default: 'gram', other options: 'kilogram', 'tonne'
129
+ product_id: 'some_product_id', # required
130
+ expand: [], # optional, default: [], allowed values: 'product', 'price' to enrich the response
131
+ payment_link_return_url: 'https://squake.earth', # optional, default: nil
131
132
  )
132
133
 
133
134
  if context.success?
@@ -159,12 +160,13 @@ end
159
160
 
160
161
  ```ruby
161
162
  context = Squake::CalculationWithPricing.quote(
162
- items: items, # required
163
- product: 'product-id', # required
164
- currency: 'EUR', # optional, default: 'EUR'
165
- carbon_unit: 'gram', # optional, default: 'gram', other options: 'kilogram', 'tonne'
166
- expand: [], # optional, default: [], allowed values: 'items', 'product', 'price' to enrich the response
167
- client: client, # optional
163
+ items: items, # required
164
+ product: 'product-id', # required
165
+ currency: 'EUR', # optional, default: 'EUR'
166
+ carbon_unit: 'gram', # optional, default: 'gram', other options: 'kilogram', 'tonne'
167
+ expand: [], # optional, default: [], allowed values: 'items', 'product', 'price' to enrich the response
168
+ payment_link_return_url: 'https://squake.earth', # optional, default: nil
169
+ client: client, # optional
168
170
  )
169
171
 
170
172
  if context.success?
@@ -15,12 +15,14 @@ module Squake
15
15
  currency: String,
16
16
  carbon_unit: String,
17
17
  expand: T::Array[String],
18
+ payment_link_return_url: T.nilable(String),
18
19
  client: Squake::Client,
19
20
  request_id: T.nilable(String),
20
21
  ).returns(Squake::Return[Squake::Model::Pricing])
21
22
  end
22
23
  def self.quote(
23
- items:, product:, currency: 'EUR', carbon_unit: 'gram', expand: [], client: Squake::Client.new, request_id: nil
24
+ items:, product:, currency: 'EUR', carbon_unit: 'gram',
25
+ expand: [], payment_link_return_url: nil, client: Squake::Client.new, request_id: nil
24
26
  )
25
27
  # @TODO: add typed objects for all possible items. Until then, we allow either a Hash or a T::Struct
26
28
  items = items.map do |item|
@@ -37,6 +39,7 @@ module Squake
37
39
  currency: currency,
38
40
  carbon_unit: carbon_unit,
39
41
  expand: expand,
42
+ payment_link_return_url: payment_link_return_url,
40
43
  },
41
44
  )
42
45
 
@@ -16,13 +16,14 @@ module Squake
16
16
  carbon_quantity: T.nilable(Numeric),
17
17
  carbon_unit: T.nilable(String),
18
18
  expand: T::Array[String],
19
+ payment_link_return_url: T.nilable(String),
19
20
  client: Squake::Client,
20
21
  request_id: T.nilable(String),
21
22
  ).returns(Squake::Return[Squake::Model::Pricing])
22
23
  end
23
- def self.quote(
24
+ def self.quote( # rubocop:disable Metrics/ParameterLists
24
25
  product_id:, fixed_total: nil, currency: 'EUR', carbon_quantity: nil, carbon_unit: 'gram',
25
- expand: [], client: Squake::Client.new, request_id: nil
26
+ expand: [], payment_link_return_url: nil, client: Squake::Client.new, request_id: nil
26
27
  )
27
28
 
28
29
  result = client.call(
@@ -36,6 +37,7 @@ module Squake
36
37
  carbon_quantity: carbon_quantity,
37
38
  carbon_unit: carbon_unit,
38
39
  expand: expand,
40
+ payment_link_return_url: payment_link_return_url,
39
41
  },
40
42
  )
41
43
 
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Squake
5
- VERSION = '0.5.1'
5
+ VERSION = '0.6.0'
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: squake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - SQUAKE
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-21 00:00:00.000000000 Z
11
+ date: 2023-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-http