patch_ruby 1.12.0 → 1.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +1 -1
- data/lib/patch_ruby/api/estimates_api.rb +2 -2
- data/lib/patch_ruby/api_client.rb +1 -1
- data/lib/patch_ruby/models/create_bitcoin_estimate_request.rb +13 -1
- data/lib/patch_ruby/models/create_ethereum_estimate_request.rb +13 -1
- data/lib/patch_ruby/models/create_flight_estimate_request.rb +2 -0
- data/lib/patch_ruby/models/create_mass_estimate_request.rb +2 -0
- data/lib/patch_ruby/models/create_shipping_estimate_request.rb +2 -0
- data/lib/patch_ruby/models/create_vehicle_estimate_request.rb +2 -0
- data/lib/patch_ruby/version.rb +1 -1
- data/spec/integration/estimates_spec.rb +16 -2
- data/spec/integration/orders_spec.rb +2 -2
- data/spec/models/create_mass_estimate_request_spec.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: 3e0f99b9d07fa162edae9b17a6391f12bd47b8ebe600c554d9a563453b8e0e7a
|
4
|
+
data.tar.gz: 541bc276ca90a671cc9e823d3a9c0320faf1dcaaf95c78ad28599a5bc9956ea6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 753deee059cd95468bb42ae4f0b3d1658e2a7bbbc0447d9f3565921232a7551848876dab16afcd4e720381d618e37cfa2d108cc02085858bf604afd62c7612ed
|
7
|
+
data.tar.gz: 882c8eb7b5ca22f529d216627cbde573f188d2878ee230140d13ce6e5c7cea10d8959331355ffe33fc9327ef2979a4aab5c18e8532e66d70dc28822236fe2b2f
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
7
|
|
8
|
+
## [1.13.0] - 2021-09-10
|
9
|
+
|
10
|
+
### Added
|
11
|
+
|
12
|
+
- Adds ability to create Bitcoin and Ethereum estimates using the daily balance held.
|
13
|
+
|
8
14
|
## [1.12.0] - 2021-09-08
|
9
15
|
|
10
16
|
### Added
|
data/Gemfile.lock
CHANGED
@@ -96,7 +96,7 @@ module Patch
|
|
96
96
|
return data, status_code, headers
|
97
97
|
end
|
98
98
|
|
99
|
-
# Create an ethereum estimate
|
99
|
+
# Create an ethereum estimate
|
100
100
|
# Creates an ethereum estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters, linked to the estimate.
|
101
101
|
# @param create_ethereum_estimate_request [CreateEthereumEstimateRequest]
|
102
102
|
# @param [Hash] opts the optional parameters
|
@@ -107,7 +107,7 @@ module Patch
|
|
107
107
|
data
|
108
108
|
end
|
109
109
|
|
110
|
-
# Create an ethereum estimate
|
110
|
+
# Create an ethereum estimate
|
111
111
|
# Creates an ethereum estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters, linked to the estimate.
|
112
112
|
# @param create_ethereum_estimate_request [CreateEthereumEstimateRequest]
|
113
113
|
# @param [Hash] opts the optional parameters
|
@@ -31,7 +31,7 @@ module Patch
|
|
31
31
|
# @option config [Configuration] Configuration for initializing the object, default to Configuration.default
|
32
32
|
def initialize(config = Configuration.default)
|
33
33
|
@config = config
|
34
|
-
@user_agent = "patch-ruby/1.
|
34
|
+
@user_agent = "patch-ruby/1.13.0"
|
35
35
|
@default_headers = {
|
36
36
|
'Content-Type' => 'application/json',
|
37
37
|
'User-Agent' => @user_agent
|
@@ -19,6 +19,8 @@ module Patch
|
|
19
19
|
|
20
20
|
attr_accessor :transaction_value_btc_sats
|
21
21
|
|
22
|
+
attr_accessor :average_daily_balance_btc_sats
|
23
|
+
|
22
24
|
attr_accessor :project_id
|
23
25
|
|
24
26
|
attr_accessor :create_order
|
@@ -28,6 +30,7 @@ module Patch
|
|
28
30
|
{
|
29
31
|
:'timestamp' => :'timestamp',
|
30
32
|
:'transaction_value_btc_sats' => :'transaction_value_btc_sats',
|
33
|
+
:'average_daily_balance_btc_sats' => :'average_daily_balance_btc_sats',
|
31
34
|
:'project_id' => :'project_id',
|
32
35
|
:'create_order' => :'create_order'
|
33
36
|
}
|
@@ -43,6 +46,7 @@ module Patch
|
|
43
46
|
{
|
44
47
|
:'timestamp' => :'Time',
|
45
48
|
:'transaction_value_btc_sats' => :'Integer',
|
49
|
+
:'average_daily_balance_btc_sats' => :'Integer',
|
46
50
|
:'project_id' => :'String',
|
47
51
|
:'create_order' => :'Boolean'
|
48
52
|
}
|
@@ -53,6 +57,7 @@ module Patch
|
|
53
57
|
Set.new([
|
54
58
|
:'timestamp',
|
55
59
|
:'transaction_value_btc_sats',
|
60
|
+
:'average_daily_balance_btc_sats',
|
56
61
|
:'project_id',
|
57
62
|
:'create_order'
|
58
63
|
])
|
@@ -93,12 +98,18 @@ module Patch
|
|
93
98
|
self.transaction_value_btc_sats = attributes[:'transaction_value_btc_sats']
|
94
99
|
end
|
95
100
|
|
101
|
+
if attributes.key?(:'average_daily_balance_btc_sats')
|
102
|
+
self.average_daily_balance_btc_sats = attributes[:'average_daily_balance_btc_sats']
|
103
|
+
end
|
104
|
+
|
96
105
|
if attributes.key?(:'project_id')
|
97
106
|
self.project_id = attributes[:'project_id']
|
98
107
|
end
|
99
108
|
|
100
109
|
if attributes.key?(:'create_order')
|
101
110
|
self.create_order = attributes[:'create_order']
|
111
|
+
else
|
112
|
+
self.create_order = false
|
102
113
|
end
|
103
114
|
end
|
104
115
|
|
@@ -122,6 +133,7 @@ module Patch
|
|
122
133
|
self.class == o.class &&
|
123
134
|
timestamp == o.timestamp &&
|
124
135
|
transaction_value_btc_sats == o.transaction_value_btc_sats &&
|
136
|
+
average_daily_balance_btc_sats == o.average_daily_balance_btc_sats &&
|
125
137
|
project_id == o.project_id &&
|
126
138
|
create_order == o.create_order
|
127
139
|
end
|
@@ -135,7 +147,7 @@ module Patch
|
|
135
147
|
# Calculates hash code according to all attributes.
|
136
148
|
# @return [Integer] Hash code
|
137
149
|
def hash
|
138
|
-
[timestamp, transaction_value_btc_sats, project_id, create_order].hash
|
150
|
+
[timestamp, transaction_value_btc_sats, average_daily_balance_btc_sats, project_id, create_order].hash
|
139
151
|
end
|
140
152
|
|
141
153
|
# Builds the object from hash
|
@@ -21,6 +21,8 @@ module Patch
|
|
21
21
|
|
22
22
|
attr_accessor :transaction_value_eth_gwei
|
23
23
|
|
24
|
+
attr_accessor :average_daily_balance_eth_gwei
|
25
|
+
|
24
26
|
attr_accessor :project_id
|
25
27
|
|
26
28
|
attr_accessor :create_order
|
@@ -31,6 +33,7 @@ module Patch
|
|
31
33
|
:'timestamp' => :'timestamp',
|
32
34
|
:'gas_used' => :'gas_used',
|
33
35
|
:'transaction_value_eth_gwei' => :'transaction_value_eth_gwei',
|
36
|
+
:'average_daily_balance_eth_gwei' => :'average_daily_balance_eth_gwei',
|
34
37
|
:'project_id' => :'project_id',
|
35
38
|
:'create_order' => :'create_order'
|
36
39
|
}
|
@@ -47,6 +50,7 @@ module Patch
|
|
47
50
|
:'timestamp' => :'String',
|
48
51
|
:'gas_used' => :'Integer',
|
49
52
|
:'transaction_value_eth_gwei' => :'Integer',
|
53
|
+
:'average_daily_balance_eth_gwei' => :'Integer',
|
50
54
|
:'project_id' => :'String',
|
51
55
|
:'create_order' => :'Boolean'
|
52
56
|
}
|
@@ -58,6 +62,7 @@ module Patch
|
|
58
62
|
:'timestamp',
|
59
63
|
:'gas_used',
|
60
64
|
:'transaction_value_eth_gwei',
|
65
|
+
:'average_daily_balance_eth_gwei',
|
61
66
|
:'project_id',
|
62
67
|
:'create_order'
|
63
68
|
])
|
@@ -102,12 +107,18 @@ module Patch
|
|
102
107
|
self.transaction_value_eth_gwei = attributes[:'transaction_value_eth_gwei']
|
103
108
|
end
|
104
109
|
|
110
|
+
if attributes.key?(:'average_daily_balance_eth_gwei')
|
111
|
+
self.average_daily_balance_eth_gwei = attributes[:'average_daily_balance_eth_gwei']
|
112
|
+
end
|
113
|
+
|
105
114
|
if attributes.key?(:'project_id')
|
106
115
|
self.project_id = attributes[:'project_id']
|
107
116
|
end
|
108
117
|
|
109
118
|
if attributes.key?(:'create_order')
|
110
119
|
self.create_order = attributes[:'create_order']
|
120
|
+
else
|
121
|
+
self.create_order = false
|
111
122
|
end
|
112
123
|
end
|
113
124
|
|
@@ -132,6 +143,7 @@ module Patch
|
|
132
143
|
timestamp == o.timestamp &&
|
133
144
|
gas_used == o.gas_used &&
|
134
145
|
transaction_value_eth_gwei == o.transaction_value_eth_gwei &&
|
146
|
+
average_daily_balance_eth_gwei == o.average_daily_balance_eth_gwei &&
|
135
147
|
project_id == o.project_id &&
|
136
148
|
create_order == o.create_order
|
137
149
|
end
|
@@ -145,7 +157,7 @@ module Patch
|
|
145
157
|
# Calculates hash code according to all attributes.
|
146
158
|
# @return [Integer] Hash code
|
147
159
|
def hash
|
148
|
-
[timestamp, gas_used, transaction_value_eth_gwei, project_id, create_order].hash
|
160
|
+
[timestamp, gas_used, transaction_value_eth_gwei, average_daily_balance_eth_gwei, project_id, create_order].hash
|
149
161
|
end
|
150
162
|
|
151
163
|
# Builds the object from hash
|
data/lib/patch_ruby/version.rb
CHANGED
@@ -56,11 +56,12 @@ RSpec.describe 'Estimates Integration' do
|
|
56
56
|
make: make,
|
57
57
|
model: model,
|
58
58
|
year: year,
|
59
|
-
create_order:
|
59
|
+
create_order: true
|
60
60
|
)
|
61
61
|
|
62
62
|
expect(vehicle_estimate.data.type).to eq 'vehicle'
|
63
63
|
expect(vehicle_estimate.data.mass_g).to eq 5_500
|
64
|
+
expect(vehicle_estimate.data.order.mass_g).to eq 5_500
|
64
65
|
end
|
65
66
|
|
66
67
|
it 'supports creating vehicle estimates with partial information' do
|
@@ -91,7 +92,7 @@ RSpec.describe 'Estimates Integration' do
|
|
91
92
|
|
92
93
|
|
93
94
|
it 'supports creating bitcoin estimates with partial information' do
|
94
|
-
bitcoin_estimate = Patch::Estimate.create_bitcoin_estimate(
|
95
|
+
bitcoin_estimate = Patch::Estimate.create_bitcoin_estimate()
|
95
96
|
|
96
97
|
expect(bitcoin_estimate.data.type).to eq 'bitcoin'
|
97
98
|
expect(bitcoin_estimate.data.mass_g).to be >= 2_000
|
@@ -123,6 +124,19 @@ RSpec.describe 'Estimates Integration' do
|
|
123
124
|
expect(bitcoin_estimate_1.data.mass_g).to be > bitcoin_estimate_2.data.mass_g # Bitcoin was emitting less in July 2021 than in June
|
124
125
|
end
|
125
126
|
|
127
|
+
it 'supports creating bitcoin estimates with a average_daily_balance_btc_sats' do
|
128
|
+
bitcoin_estimate_1 = Patch::Estimate.create_bitcoin_estimate(
|
129
|
+
average_daily_balance_btc_sats: 1000000
|
130
|
+
)
|
131
|
+
|
132
|
+
bitcoin_estimate_2 = Patch::Estimate.create_bitcoin_estimate(
|
133
|
+
average_daily_balance_btc_sats: 10000000
|
134
|
+
)
|
135
|
+
|
136
|
+
expect(bitcoin_estimate_1.data.type).to eq 'bitcoin'
|
137
|
+
expect(bitcoin_estimate_1.data.mass_g).to be < bitcoin_estimate_2.data.mass_g
|
138
|
+
end
|
139
|
+
|
126
140
|
it 'supports creating ethereum estimates with a gas amount' do
|
127
141
|
ethereum_estimate = Patch::Estimate.create_ethereum_estimate(
|
128
142
|
gas_used: 100
|
@@ -87,13 +87,13 @@ RSpec.describe 'Orders Integration' do
|
|
87
87
|
end
|
88
88
|
|
89
89
|
it 'supports place and cancel for orders created via an estimate' do
|
90
|
-
create_estimate_to_place_response = Patch::Estimate.create_mass_estimate(mass_g: 100)
|
90
|
+
create_estimate_to_place_response = Patch::Estimate.create_mass_estimate(mass_g: 100, create_order: true)
|
91
91
|
order_to_place_id = create_estimate_to_place_response.data.order.id
|
92
92
|
|
93
93
|
place_order_response = Patch::Order.place_order(order_to_place_id)
|
94
94
|
expect(place_order_response.data.state).to eq 'placed'
|
95
95
|
|
96
|
-
create_estimate_to_cancel_response = Patch::Estimate.create_mass_estimate(mass_g: 100)
|
96
|
+
create_estimate_to_cancel_response = Patch::Estimate.create_mass_estimate(mass_g: 100, create_order: true)
|
97
97
|
order_to_cancel_id = create_estimate_to_cancel_response.data.order.id
|
98
98
|
|
99
99
|
cancel_order_response = Patch::Order.cancel_order(order_to_cancel_id)
|
@@ -29,7 +29,7 @@ describe 'CreateMassEstimateRequest' do
|
|
29
29
|
|
30
30
|
it_behaves_like "a generated class" do
|
31
31
|
let(:instance) { @instance }
|
32
|
-
let(:instance_hash) { { project_id: @instance.project_id, mass_g: @instance.mass_g } }
|
32
|
+
let(:instance_hash) { { project_id: @instance.project_id, mass_g: @instance.mass_g, create_order: @instance.create_order } }
|
33
33
|
let(:nullable_properties) { Set.new([:create_order]) }
|
34
34
|
end
|
35
35
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: patch_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patch Technology
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-09-
|
11
|
+
date: 2021-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|