squake 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -11
- data/lib/squake/calculation_with_pricing.rb +4 -1
- data/lib/squake/pricing.rb +4 -2
- data/lib/squake/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9998b15ce76aa8dbc8be90d10591fcc590a6371f49ff5f18782ce77081ff1420
|
4
|
+
data.tar.gz: 68b42dec21a0f57f64b1fd12b1a206496cd7b0e2c2aefccb75d3890914865f2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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,
|
127
|
-
carbon_quantity: 1000,
|
128
|
-
carbon_unit: 'kilogram',
|
129
|
-
product_id: 'some_product_id',
|
130
|
-
expand: [],
|
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,
|
163
|
-
product: 'product-id',
|
164
|
-
currency: 'EUR',
|
165
|
-
carbon_unit: 'gram',
|
166
|
-
expand: [],
|
167
|
-
|
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',
|
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
|
|
data/lib/squake/pricing.rb
CHANGED
@@ -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
|
|
data/lib/squake/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2023-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-http
|