patch_ruby 1.10.2 → 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 +24 -0
- data/Gemfile.lock +1 -1
- data/lib/patch_ruby/api/estimates_api.rb +22 -14
- data/lib/patch_ruby/api/orders_api.rb +7 -2
- data/lib/patch_ruby/api/preferences_api.rb +6 -2
- data/lib/patch_ruby/api/projects_api.rb +2 -0
- data/lib/patch_ruby/api_client.rb +1 -1
- data/lib/patch_ruby/models/create_bitcoin_estimate_request.rb +14 -2
- data/lib/patch_ruby/models/create_ethereum_estimate_request.rb +13 -1
- data/lib/patch_ruby/models/create_flight_estimate_request.rb +60 -16
- 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/models/order.rb +11 -1
- data/lib/patch_ruby/version.rb +1 -1
- data/spec/integration/estimates_spec.rb +31 -2
- data/spec/integration/orders_spec.rb +3 -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,30 @@ 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
|
+
|
14
|
+
## [1.12.0] - 2021-09-08
|
15
|
+
|
16
|
+
### Added
|
17
|
+
|
18
|
+
- Adds a `created_at` attribute in all order responses
|
19
|
+
|
20
|
+
## [1.11.1] - 2021-09-07
|
21
|
+
|
22
|
+
### Changed
|
23
|
+
|
24
|
+
- Body parameters are validated before being sent to the API. This gives developers faster feedback as they develop their applications.
|
25
|
+
|
26
|
+
## [1.11.0] - 2021-09-07
|
27
|
+
|
28
|
+
### Added
|
29
|
+
|
30
|
+
- Adds support for airports, aircracts, cabin class and passenger count in flight estimates
|
31
|
+
|
8
32
|
## [1.10.2] - 2021-09-01
|
9
33
|
|
10
34
|
### Fixed
|
data/Gemfile.lock
CHANGED
@@ -35,8 +35,9 @@ module Patch
|
|
35
35
|
# @param create_bitcoin_estimate_request [CreateBitcoinEstimateRequest]
|
36
36
|
# @param [Hash] opts the optional parameters
|
37
37
|
# @return [EstimateResponse]
|
38
|
-
def create_bitcoin_estimate(create_bitcoin_estimate_request, opts = {})
|
39
|
-
|
38
|
+
def create_bitcoin_estimate(create_bitcoin_estimate_request = {}, opts = {})
|
39
|
+
_create_bitcoin_estimate_request = Patch::CreateBitcoinEstimateRequest.new(create_bitcoin_estimate_request)
|
40
|
+
data, _status_code, _headers = create_bitcoin_estimate_with_http_info(_create_bitcoin_estimate_request, opts)
|
40
41
|
data
|
41
42
|
end
|
42
43
|
|
@@ -95,17 +96,18 @@ module Patch
|
|
95
96
|
return data, status_code, headers
|
96
97
|
end
|
97
98
|
|
98
|
-
# Create an ethereum estimate
|
99
|
+
# Create an ethereum estimate
|
99
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.
|
100
101
|
# @param create_ethereum_estimate_request [CreateEthereumEstimateRequest]
|
101
102
|
# @param [Hash] opts the optional parameters
|
102
103
|
# @return [EstimateResponse]
|
103
|
-
def create_ethereum_estimate(create_ethereum_estimate_request, opts = {})
|
104
|
-
|
104
|
+
def create_ethereum_estimate(create_ethereum_estimate_request = {}, opts = {})
|
105
|
+
_create_ethereum_estimate_request = Patch::CreateEthereumEstimateRequest.new(create_ethereum_estimate_request)
|
106
|
+
data, _status_code, _headers = create_ethereum_estimate_with_http_info(_create_ethereum_estimate_request, opts)
|
105
107
|
data
|
106
108
|
end
|
107
109
|
|
108
|
-
# Create an ethereum estimate
|
110
|
+
# Create an ethereum estimate
|
109
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.
|
110
112
|
# @param create_ethereum_estimate_request [CreateEthereumEstimateRequest]
|
111
113
|
# @param [Hash] opts the optional parameters
|
@@ -165,8 +167,9 @@ module Patch
|
|
165
167
|
# @param create_flight_estimate_request [CreateFlightEstimateRequest]
|
166
168
|
# @param [Hash] opts the optional parameters
|
167
169
|
# @return [EstimateResponse]
|
168
|
-
def create_flight_estimate(create_flight_estimate_request, opts = {})
|
169
|
-
|
170
|
+
def create_flight_estimate(create_flight_estimate_request = {}, opts = {})
|
171
|
+
_create_flight_estimate_request = Patch::CreateFlightEstimateRequest.new(create_flight_estimate_request)
|
172
|
+
data, _status_code, _headers = create_flight_estimate_with_http_info(_create_flight_estimate_request, opts)
|
170
173
|
data
|
171
174
|
end
|
172
175
|
|
@@ -230,8 +233,9 @@ module Patch
|
|
230
233
|
# @param create_mass_estimate_request [CreateMassEstimateRequest]
|
231
234
|
# @param [Hash] opts the optional parameters
|
232
235
|
# @return [EstimateResponse]
|
233
|
-
def create_mass_estimate(create_mass_estimate_request, opts = {})
|
234
|
-
|
236
|
+
def create_mass_estimate(create_mass_estimate_request = {}, opts = {})
|
237
|
+
_create_mass_estimate_request = Patch::CreateMassEstimateRequest.new(create_mass_estimate_request)
|
238
|
+
data, _status_code, _headers = create_mass_estimate_with_http_info(_create_mass_estimate_request, opts)
|
235
239
|
data
|
236
240
|
end
|
237
241
|
|
@@ -295,8 +299,9 @@ module Patch
|
|
295
299
|
# @param create_shipping_estimate_request [CreateShippingEstimateRequest]
|
296
300
|
# @param [Hash] opts the optional parameters
|
297
301
|
# @return [EstimateResponse]
|
298
|
-
def create_shipping_estimate(create_shipping_estimate_request, opts = {})
|
299
|
-
|
302
|
+
def create_shipping_estimate(create_shipping_estimate_request = {}, opts = {})
|
303
|
+
_create_shipping_estimate_request = Patch::CreateShippingEstimateRequest.new(create_shipping_estimate_request)
|
304
|
+
data, _status_code, _headers = create_shipping_estimate_with_http_info(_create_shipping_estimate_request, opts)
|
300
305
|
data
|
301
306
|
end
|
302
307
|
|
@@ -360,8 +365,9 @@ module Patch
|
|
360
365
|
# @param create_vehicle_estimate_request [CreateVehicleEstimateRequest]
|
361
366
|
# @param [Hash] opts the optional parameters
|
362
367
|
# @return [EstimateResponse]
|
363
|
-
def create_vehicle_estimate(create_vehicle_estimate_request, opts = {})
|
364
|
-
|
368
|
+
def create_vehicle_estimate(create_vehicle_estimate_request = {}, opts = {})
|
369
|
+
_create_vehicle_estimate_request = Patch::CreateVehicleEstimateRequest.new(create_vehicle_estimate_request)
|
370
|
+
data, _status_code, _headers = create_vehicle_estimate_with_http_info(_create_vehicle_estimate_request, opts)
|
365
371
|
data
|
366
372
|
end
|
367
373
|
|
@@ -426,6 +432,7 @@ module Patch
|
|
426
432
|
# @param [Hash] opts the optional parameters
|
427
433
|
# @return [EstimateResponse]
|
428
434
|
def retrieve_estimate(id, opts = {})
|
435
|
+
|
429
436
|
data, _status_code, _headers = retrieve_estimate_with_http_info(id, opts)
|
430
437
|
data
|
431
438
|
end
|
@@ -489,6 +496,7 @@ module Patch
|
|
489
496
|
# @option opts [Integer] :page
|
490
497
|
# @return [EstimateListResponse]
|
491
498
|
def retrieve_estimates(opts = {})
|
499
|
+
|
492
500
|
data, _status_code, _headers = retrieve_estimates_with_http_info(opts)
|
493
501
|
data
|
494
502
|
end
|
@@ -33,6 +33,7 @@ module Patch
|
|
33
33
|
# @param [Hash] opts the optional parameters
|
34
34
|
# @return [OrderResponse]
|
35
35
|
def cancel_order(id, opts = {})
|
36
|
+
|
36
37
|
data, _status_code, _headers = cancel_order_with_http_info(id, opts)
|
37
38
|
data
|
38
39
|
end
|
@@ -95,8 +96,9 @@ module Patch
|
|
95
96
|
# @param create_order_request [CreateOrderRequest]
|
96
97
|
# @param [Hash] opts the optional parameters
|
97
98
|
# @return [OrderResponse]
|
98
|
-
def create_order(create_order_request, opts = {})
|
99
|
-
|
99
|
+
def create_order(create_order_request = {}, opts = {})
|
100
|
+
_create_order_request = Patch::CreateOrderRequest.new(create_order_request)
|
101
|
+
data, _status_code, _headers = create_order_with_http_info(_create_order_request, opts)
|
100
102
|
data
|
101
103
|
end
|
102
104
|
|
@@ -161,6 +163,7 @@ module Patch
|
|
161
163
|
# @param [Hash] opts the optional parameters
|
162
164
|
# @return [OrderResponse]
|
163
165
|
def place_order(id, opts = {})
|
166
|
+
|
164
167
|
data, _status_code, _headers = place_order_with_http_info(id, opts)
|
165
168
|
data
|
166
169
|
end
|
@@ -224,6 +227,7 @@ module Patch
|
|
224
227
|
# @param [Hash] opts the optional parameters
|
225
228
|
# @return [OrderResponse]
|
226
229
|
def retrieve_order(id, opts = {})
|
230
|
+
|
227
231
|
data, _status_code, _headers = retrieve_order_with_http_info(id, opts)
|
228
232
|
data
|
229
233
|
end
|
@@ -290,6 +294,7 @@ module Patch
|
|
290
294
|
# @option opts [String] :metadata_example2
|
291
295
|
# @return [OrderListResponse]
|
292
296
|
def retrieve_orders(opts = {})
|
297
|
+
|
293
298
|
data, _status_code, _headers = retrieve_orders_with_http_info(opts)
|
294
299
|
data
|
295
300
|
end
|
@@ -31,8 +31,9 @@ module Patch
|
|
31
31
|
# @param create_preference_request [CreatePreferenceRequest]
|
32
32
|
# @param [Hash] opts the optional parameters
|
33
33
|
# @return [PreferenceResponse]
|
34
|
-
def create_preference(create_preference_request, opts = {})
|
35
|
-
|
34
|
+
def create_preference(create_preference_request = {}, opts = {})
|
35
|
+
_create_preference_request = Patch::CreatePreferenceRequest.new(create_preference_request)
|
36
|
+
data, _status_code, _headers = create_preference_with_http_info(_create_preference_request, opts)
|
36
37
|
data
|
37
38
|
end
|
38
39
|
|
@@ -97,6 +98,7 @@ module Patch
|
|
97
98
|
# @param [Hash] opts the optional parameters
|
98
99
|
# @return [PreferenceResponse]
|
99
100
|
def delete_preference(id, opts = {})
|
101
|
+
|
100
102
|
data, _status_code, _headers = delete_preference_with_http_info(id, opts)
|
101
103
|
data
|
102
104
|
end
|
@@ -160,6 +162,7 @@ module Patch
|
|
160
162
|
# @param [Hash] opts the optional parameters
|
161
163
|
# @return [PreferenceResponse]
|
162
164
|
def retrieve_preference(id, opts = {})
|
165
|
+
|
163
166
|
data, _status_code, _headers = retrieve_preference_with_http_info(id, opts)
|
164
167
|
data
|
165
168
|
end
|
@@ -223,6 +226,7 @@ module Patch
|
|
223
226
|
# @option opts [Integer] :page
|
224
227
|
# @return [PreferenceListResponse]
|
225
228
|
def retrieve_preferences(opts = {})
|
229
|
+
|
226
230
|
data, _status_code, _headers = retrieve_preferences_with_http_info(opts)
|
227
231
|
data
|
228
232
|
end
|
@@ -30,6 +30,7 @@ module Patch
|
|
30
30
|
# @param [Hash] opts the optional parameters
|
31
31
|
# @return [ProjectResponse]
|
32
32
|
def retrieve_project(id, opts = {})
|
33
|
+
|
33
34
|
data, _status_code, _headers = retrieve_project_with_http_info(id, opts)
|
34
35
|
data
|
35
36
|
end
|
@@ -96,6 +97,7 @@ module Patch
|
|
96
97
|
# @option opts [Integer] :minimum_available_mass
|
97
98
|
# @return [ProjectListResponse]
|
98
99
|
def retrieve_projects(opts = {})
|
100
|
+
|
99
101
|
data, _status_code, _headers = retrieve_projects_with_http_info(opts)
|
100
102
|
data
|
101
103
|
end
|
@@ -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
|
}
|
@@ -41,8 +44,9 @@ module Patch
|
|
41
44
|
# Attribute type mapping.
|
42
45
|
def self.openapi_types
|
43
46
|
{
|
44
|
-
:'timestamp' => :'
|
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
|
@@ -17,6 +17,16 @@ module Patch
|
|
17
17
|
class CreateFlightEstimateRequest
|
18
18
|
attr_accessor :distance_m
|
19
19
|
|
20
|
+
attr_accessor :origin_airport
|
21
|
+
|
22
|
+
attr_accessor :destination_airport
|
23
|
+
|
24
|
+
attr_accessor :aircraft_code
|
25
|
+
|
26
|
+
attr_accessor :cabin_class
|
27
|
+
|
28
|
+
attr_accessor :passenger_count
|
29
|
+
|
20
30
|
attr_accessor :project_id
|
21
31
|
|
22
32
|
attr_accessor :create_order
|
@@ -25,6 +35,11 @@ module Patch
|
|
25
35
|
def self.attribute_map
|
26
36
|
{
|
27
37
|
:'distance_m' => :'distance_m',
|
38
|
+
:'origin_airport' => :'origin_airport',
|
39
|
+
:'destination_airport' => :'destination_airport',
|
40
|
+
:'aircraft_code' => :'aircraft_code',
|
41
|
+
:'cabin_class' => :'cabin_class',
|
42
|
+
:'passenger_count' => :'passenger_count',
|
28
43
|
:'project_id' => :'project_id',
|
29
44
|
:'create_order' => :'create_order'
|
30
45
|
}
|
@@ -39,6 +54,11 @@ module Patch
|
|
39
54
|
def self.openapi_types
|
40
55
|
{
|
41
56
|
:'distance_m' => :'Integer',
|
57
|
+
:'origin_airport' => :'String',
|
58
|
+
:'destination_airport' => :'String',
|
59
|
+
:'aircraft_code' => :'String',
|
60
|
+
:'cabin_class' => :'String',
|
61
|
+
:'passenger_count' => :'Integer',
|
42
62
|
:'project_id' => :'String',
|
43
63
|
:'create_order' => :'Boolean'
|
44
64
|
}
|
@@ -47,6 +67,12 @@ module Patch
|
|
47
67
|
# List of attributes with nullable: true
|
48
68
|
def self.openapi_nullable
|
49
69
|
Set.new([
|
70
|
+
:'distance_m',
|
71
|
+
:'origin_airport',
|
72
|
+
:'destination_airport',
|
73
|
+
:'aircraft_code',
|
74
|
+
:'cabin_class',
|
75
|
+
:'passenger_count',
|
50
76
|
:'project_id',
|
51
77
|
:'create_order'
|
52
78
|
])
|
@@ -83,12 +109,34 @@ module Patch
|
|
83
109
|
self.distance_m = attributes[:'distance_m']
|
84
110
|
end
|
85
111
|
|
112
|
+
if attributes.key?(:'origin_airport')
|
113
|
+
self.origin_airport = attributes[:'origin_airport']
|
114
|
+
end
|
115
|
+
|
116
|
+
if attributes.key?(:'destination_airport')
|
117
|
+
self.destination_airport = attributes[:'destination_airport']
|
118
|
+
end
|
119
|
+
|
120
|
+
if attributes.key?(:'aircraft_code')
|
121
|
+
self.aircraft_code = attributes[:'aircraft_code']
|
122
|
+
end
|
123
|
+
|
124
|
+
if attributes.key?(:'cabin_class')
|
125
|
+
self.cabin_class = attributes[:'cabin_class']
|
126
|
+
end
|
127
|
+
|
128
|
+
if attributes.key?(:'passenger_count')
|
129
|
+
self.passenger_count = attributes[:'passenger_count']
|
130
|
+
end
|
131
|
+
|
86
132
|
if attributes.key?(:'project_id')
|
87
133
|
self.project_id = attributes[:'project_id']
|
88
134
|
end
|
89
135
|
|
90
136
|
if attributes.key?(:'create_order')
|
91
137
|
self.create_order = attributes[:'create_order']
|
138
|
+
else
|
139
|
+
self.create_order = false
|
92
140
|
end
|
93
141
|
end
|
94
142
|
|
@@ -96,15 +144,11 @@ module Patch
|
|
96
144
|
# @return Array for valid properties with the reasons
|
97
145
|
def list_invalid_properties
|
98
146
|
invalid_properties = Array.new
|
99
|
-
if
|
100
|
-
invalid_properties.push('invalid value for "distance_m", distance_m cannot be nil.')
|
101
|
-
end
|
102
|
-
|
103
|
-
if @distance_m > 400000000
|
147
|
+
if !@distance_m.nil? && @distance_m > 400000000
|
104
148
|
invalid_properties.push('invalid value for "distance_m", must be smaller than or equal to 400000000.')
|
105
149
|
end
|
106
150
|
|
107
|
-
if @distance_m < 0
|
151
|
+
if !@distance_m.nil? && @distance_m < 0
|
108
152
|
invalid_properties.push('invalid value for "distance_m", must be greater than or equal to 0.')
|
109
153
|
end
|
110
154
|
|
@@ -114,24 +158,19 @@ module Patch
|
|
114
158
|
# Check to see if the all the properties in the model are valid
|
115
159
|
# @return true if the model is valid
|
116
160
|
def valid?
|
117
|
-
return false if
|
118
|
-
return false if @distance_m
|
119
|
-
return false if @distance_m < 0
|
161
|
+
return false if !@distance_m.nil? && @distance_m > 400000000
|
162
|
+
return false if !@distance_m.nil? && @distance_m < 0
|
120
163
|
true
|
121
164
|
end
|
122
165
|
|
123
166
|
# Custom attribute writer method with validation
|
124
167
|
# @param [Object] distance_m Value to be assigned
|
125
168
|
def distance_m=(distance_m)
|
126
|
-
if distance_m.nil?
|
127
|
-
fail ArgumentError, 'distance_m cannot be nil'
|
128
|
-
end
|
129
|
-
|
130
|
-
if distance_m > 400000000
|
169
|
+
if !distance_m.nil? && distance_m > 400000000
|
131
170
|
fail ArgumentError, 'invalid value for "distance_m", must be smaller than or equal to 400000000.'
|
132
171
|
end
|
133
172
|
|
134
|
-
if distance_m < 0
|
173
|
+
if !distance_m.nil? && distance_m < 0
|
135
174
|
fail ArgumentError, 'invalid value for "distance_m", must be greater than or equal to 0.'
|
136
175
|
end
|
137
176
|
|
@@ -144,6 +183,11 @@ module Patch
|
|
144
183
|
return true if self.equal?(o)
|
145
184
|
self.class == o.class &&
|
146
185
|
distance_m == o.distance_m &&
|
186
|
+
origin_airport == o.origin_airport &&
|
187
|
+
destination_airport == o.destination_airport &&
|
188
|
+
aircraft_code == o.aircraft_code &&
|
189
|
+
cabin_class == o.cabin_class &&
|
190
|
+
passenger_count == o.passenger_count &&
|
147
191
|
project_id == o.project_id &&
|
148
192
|
create_order == o.create_order
|
149
193
|
end
|
@@ -157,7 +201,7 @@ module Patch
|
|
157
201
|
# Calculates hash code according to all attributes.
|
158
202
|
# @return [Integer] Hash code
|
159
203
|
def hash
|
160
|
-
[distance_m, project_id, create_order].hash
|
204
|
+
[distance_m, origin_airport, destination_airport, aircraft_code, cabin_class, passenger_count, project_id, create_order].hash
|
161
205
|
end
|
162
206
|
|
163
207
|
# Builds the object from hash
|
@@ -18,6 +18,9 @@ module Patch
|
|
18
18
|
# A unique uid for the record. UIDs will be prepended by ord_prod or ord_test depending on the mode it was created in.
|
19
19
|
attr_accessor :id
|
20
20
|
|
21
|
+
# The timestamp at which the order was created
|
22
|
+
attr_accessor :created_at
|
23
|
+
|
21
24
|
# The amount of carbon offsets in grams purchased through this order.
|
22
25
|
attr_accessor :mass_g
|
23
26
|
|
@@ -71,6 +74,7 @@ module Patch
|
|
71
74
|
def self.attribute_map
|
72
75
|
{
|
73
76
|
:'id' => :'id',
|
77
|
+
:'created_at' => :'created_at',
|
74
78
|
:'mass_g' => :'mass_g',
|
75
79
|
:'production' => :'production',
|
76
80
|
:'state' => :'state',
|
@@ -92,6 +96,7 @@ module Patch
|
|
92
96
|
def self.openapi_types
|
93
97
|
{
|
94
98
|
:'id' => :'String',
|
99
|
+
:'created_at' => :'Time',
|
95
100
|
:'mass_g' => :'Integer',
|
96
101
|
:'production' => :'Boolean',
|
97
102
|
:'state' => :'String',
|
@@ -143,6 +148,10 @@ module Patch
|
|
143
148
|
self.id = attributes[:'id']
|
144
149
|
end
|
145
150
|
|
151
|
+
if attributes.key?(:'created_at')
|
152
|
+
self.created_at = attributes[:'created_at']
|
153
|
+
end
|
154
|
+
|
146
155
|
if attributes.key?(:'mass_g')
|
147
156
|
self.mass_g = attributes[:'mass_g']
|
148
157
|
end
|
@@ -288,6 +297,7 @@ module Patch
|
|
288
297
|
return true if self.equal?(o)
|
289
298
|
self.class == o.class &&
|
290
299
|
id == o.id &&
|
300
|
+
created_at == o.created_at &&
|
291
301
|
mass_g == o.mass_g &&
|
292
302
|
production == o.production &&
|
293
303
|
state == o.state &&
|
@@ -308,7 +318,7 @@ module Patch
|
|
308
318
|
# Calculates hash code according to all attributes.
|
309
319
|
# @return [Integer] Hash code
|
310
320
|
def hash
|
311
|
-
[id, mass_g, production, state, allocation_state, price_cents_usd, patch_fee_cents_usd, allocations, registry_url, metadata].hash
|
321
|
+
[id, created_at, mass_g, production, state, allocation_state, price_cents_usd, patch_fee_cents_usd, allocations, registry_url, metadata].hash
|
312
322
|
end
|
313
323
|
|
314
324
|
# Builds the object from hash
|
data/lib/patch_ruby/version.rb
CHANGED
@@ -30,6 +30,21 @@ RSpec.describe 'Estimates Integration' do
|
|
30
30
|
expect(flight_estimate.data.mass_g).to eq 1_000_622
|
31
31
|
end
|
32
32
|
|
33
|
+
it 'supports creating flight estimates with origin and destination' do
|
34
|
+
flight_estimate = Patch::Estimate.create_flight_estimate(
|
35
|
+
origin_airport: "SFO",
|
36
|
+
destination_airport: "LAX"
|
37
|
+
)
|
38
|
+
|
39
|
+
flight_estimate_longer = Patch::Estimate.create_flight_estimate(
|
40
|
+
origin_airport: "SFO",
|
41
|
+
destination_airport: "JFK"
|
42
|
+
)
|
43
|
+
|
44
|
+
expect(flight_estimate.data.type).to eq 'flight'
|
45
|
+
expect(flight_estimate_longer.data.mass_g).to be > 2 * flight_estimate.data.mass_g
|
46
|
+
end
|
47
|
+
|
33
48
|
it 'supports creating vehicle estimates' do
|
34
49
|
distance_m = 10_000
|
35
50
|
make = "Toyota"
|
@@ -41,11 +56,12 @@ RSpec.describe 'Estimates Integration' do
|
|
41
56
|
make: make,
|
42
57
|
model: model,
|
43
58
|
year: year,
|
44
|
-
create_order:
|
59
|
+
create_order: true
|
45
60
|
)
|
46
61
|
|
47
62
|
expect(vehicle_estimate.data.type).to eq 'vehicle'
|
48
63
|
expect(vehicle_estimate.data.mass_g).to eq 5_500
|
64
|
+
expect(vehicle_estimate.data.order.mass_g).to eq 5_500
|
49
65
|
end
|
50
66
|
|
51
67
|
it 'supports creating vehicle estimates with partial information' do
|
@@ -76,7 +92,7 @@ RSpec.describe 'Estimates Integration' do
|
|
76
92
|
|
77
93
|
|
78
94
|
it 'supports creating bitcoin estimates with partial information' do
|
79
|
-
bitcoin_estimate = Patch::Estimate.create_bitcoin_estimate(
|
95
|
+
bitcoin_estimate = Patch::Estimate.create_bitcoin_estimate()
|
80
96
|
|
81
97
|
expect(bitcoin_estimate.data.type).to eq 'bitcoin'
|
82
98
|
expect(bitcoin_estimate.data.mass_g).to be >= 2_000
|
@@ -108,6 +124,19 @@ RSpec.describe 'Estimates Integration' do
|
|
108
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
|
109
125
|
end
|
110
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
|
+
|
111
140
|
it 'supports creating ethereum estimates with a gas amount' do
|
112
141
|
ethereum_estimate = Patch::Estimate.create_ethereum_estimate(
|
113
142
|
gas_used: 100
|
@@ -37,6 +37,7 @@ RSpec.describe 'Orders Integration' do
|
|
37
37
|
order = create_order_response.data
|
38
38
|
expect(create_order_response.success).to eq true
|
39
39
|
expect(order.id).not_to be_nil
|
40
|
+
expect(order.created_at).to be_a_kind_of(Time)
|
40
41
|
expect(order.mass_g).to eq(order_mass_g)
|
41
42
|
expect(order.price_cents_usd).to be_between(expected_price - 2, expected_price + 2)
|
42
43
|
expect(order.patch_fee_cents_usd).to be_kind_of(Integer)
|
@@ -86,13 +87,13 @@ RSpec.describe 'Orders Integration' do
|
|
86
87
|
end
|
87
88
|
|
88
89
|
it 'supports place and cancel for orders created via an estimate' do
|
89
|
-
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)
|
90
91
|
order_to_place_id = create_estimate_to_place_response.data.order.id
|
91
92
|
|
92
93
|
place_order_response = Patch::Order.place_order(order_to_place_id)
|
93
94
|
expect(place_order_response.data.state).to eq 'placed'
|
94
95
|
|
95
|
-
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)
|
96
97
|
order_to_cancel_id = create_estimate_to_cancel_response.data.order.id
|
97
98
|
|
98
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
|