patch_ruby 1.10.1 → 1.12.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 +21 -20
- data/Makefile +2 -2
- data/lib/patch_ruby/api/estimates_api.rb +20 -12
- 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 +1 -1
- data/lib/patch_ruby/models/create_flight_estimate_request.rb +58 -16
- data/lib/patch_ruby/models/order.rb +11 -1
- data/lib/patch_ruby/version.rb +1 -1
- data/patch_ruby.gemspec +1 -0
- data/spec/integration/estimates_spec.rb +17 -1
- data/spec/integration/orders_spec.rb +1 -0
- data/spec/spec_helper.rb +1 -0
- metadata +43 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4c6622c9c97768d2c233d87f9ce0dbfab9fc74f7e4f0ac580754cacf9d892c8
|
4
|
+
data.tar.gz: eb8743d767c0bc0116ea6a36a4b6e1a160d986ddde64942d4c4e056c47987ed4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fbde5884a5facbdc44de9b3bbb44ed3f001bdb4ee094ff173603bc784a269b31ccc57be17756239b8cb51f5912954d0ab7ada18ca5eae80e965c224b17f112fc
|
7
|
+
data.tar.gz: 435315b6ba7b76b5ffe84a4a5924c52ceafdaa6efe7fc4fb4bbe19fd722d06c73b810c7f577787ed15d7e91635df34aa792d63dcd03c373254a306f22a6b43f8
|
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.12.0] - 2021-09-08
|
9
|
+
|
10
|
+
### Added
|
11
|
+
|
12
|
+
- Adds a `created_at` attribute in all order responses
|
13
|
+
|
14
|
+
## [1.11.1] - 2021-09-07
|
15
|
+
|
16
|
+
### Changed
|
17
|
+
|
18
|
+
- Body parameters are validated before being sent to the API. This gives developers faster feedback as they develop their applications.
|
19
|
+
|
20
|
+
## [1.11.0] - 2021-09-07
|
21
|
+
|
22
|
+
### Added
|
23
|
+
|
24
|
+
- Adds support for airports, aircracts, cabin class and passenger count in flight estimates
|
25
|
+
|
26
|
+
## [1.10.2] - 2021-09-01
|
27
|
+
|
28
|
+
### Fixed
|
29
|
+
|
30
|
+
- Allows methods to be called with no parameters
|
31
|
+
|
8
32
|
## [1.10.0] - 2021-08-27
|
9
33
|
|
10
34
|
### Added
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
patch_ruby (1.
|
4
|
+
patch_ruby (1.12.0)
|
5
5
|
typhoeus (~> 1.0, >= 1.0.1)
|
6
6
|
|
7
7
|
GEM
|
@@ -17,12 +17,12 @@ GEM
|
|
17
17
|
byebug (11.1.3)
|
18
18
|
coderay (1.1.3)
|
19
19
|
concurrent-ruby (1.1.9)
|
20
|
-
diff-lcs (1.4.
|
20
|
+
diff-lcs (1.4.4)
|
21
21
|
ethon (0.14.0)
|
22
22
|
ffi (>= 1.15.0)
|
23
23
|
factory_bot (6.2.0)
|
24
24
|
activesupport (>= 5.0.0)
|
25
|
-
ffi (1.15.
|
25
|
+
ffi (1.15.4)
|
26
26
|
i18n (1.8.10)
|
27
27
|
concurrent-ruby (~> 1.0)
|
28
28
|
jaro_winkler (1.5.4)
|
@@ -31,28 +31,28 @@ GEM
|
|
31
31
|
parallel (1.20.1)
|
32
32
|
parser (3.0.2.0)
|
33
33
|
ast (~> 2.4.1)
|
34
|
-
pry (0.
|
34
|
+
pry (0.14.1)
|
35
35
|
coderay (~> 1.1)
|
36
36
|
method_source (~> 1.0)
|
37
|
-
pry-byebug (3.
|
37
|
+
pry-byebug (3.8.0)
|
38
38
|
byebug (~> 11.0)
|
39
|
-
pry (~> 0.
|
39
|
+
pry (~> 0.10)
|
40
40
|
psych (4.0.1)
|
41
41
|
rainbow (3.0.0)
|
42
|
-
rake (13.0.
|
43
|
-
rspec (3.
|
44
|
-
rspec-core (~> 3.
|
45
|
-
rspec-expectations (~> 3.
|
46
|
-
rspec-mocks (~> 3.
|
47
|
-
rspec-core (3.
|
48
|
-
rspec-support (~> 3.
|
49
|
-
rspec-expectations (3.
|
42
|
+
rake (13.0.6)
|
43
|
+
rspec (3.10.0)
|
44
|
+
rspec-core (~> 3.10.0)
|
45
|
+
rspec-expectations (~> 3.10.0)
|
46
|
+
rspec-mocks (~> 3.10.0)
|
47
|
+
rspec-core (3.10.1)
|
48
|
+
rspec-support (~> 3.10.0)
|
49
|
+
rspec-expectations (3.10.1)
|
50
50
|
diff-lcs (>= 1.2.0, < 2.0)
|
51
|
-
rspec-support (~> 3.
|
52
|
-
rspec-mocks (3.
|
51
|
+
rspec-support (~> 3.10.0)
|
52
|
+
rspec-mocks (3.10.2)
|
53
53
|
diff-lcs (>= 1.2.0, < 2.0)
|
54
|
-
rspec-support (~> 3.
|
55
|
-
rspec-support (3.
|
54
|
+
rspec-support (~> 3.10.0)
|
55
|
+
rspec-support (3.10.2)
|
56
56
|
rubocop (0.66.0)
|
57
57
|
jaro_winkler (~> 1.5.1)
|
58
58
|
parallel (~> 1.10)
|
@@ -70,15 +70,16 @@ GEM
|
|
70
70
|
zeitwerk (2.4.2)
|
71
71
|
|
72
72
|
PLATFORMS
|
73
|
-
|
73
|
+
x86_64-darwin-20
|
74
74
|
|
75
75
|
DEPENDENCIES
|
76
76
|
factory_bot (~> 6.2)
|
77
77
|
patch_ruby!
|
78
|
+
pry
|
78
79
|
pry-byebug
|
79
80
|
rake (~> 13.0.1)
|
80
81
|
rspec (~> 3.6, >= 3.6.0)
|
81
82
|
rubocop (~> 0.66.0)
|
82
83
|
|
83
84
|
BUNDLED WITH
|
84
|
-
2.2.
|
85
|
+
2.2.22
|
data/Makefile
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
|
|
@@ -100,8 +101,9 @@ module Patch
|
|
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
|
|
@@ -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.12.0"
|
35
35
|
@default_headers = {
|
36
36
|
'Content-Type' => 'application/json',
|
37
37
|
'User-Agent' => @user_agent
|
@@ -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,6 +109,26 @@ 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
|
@@ -96,15 +142,11 @@ module Patch
|
|
96
142
|
# @return Array for valid properties with the reasons
|
97
143
|
def list_invalid_properties
|
98
144
|
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
|
145
|
+
if !@distance_m.nil? && @distance_m > 400000000
|
104
146
|
invalid_properties.push('invalid value for "distance_m", must be smaller than or equal to 400000000.')
|
105
147
|
end
|
106
148
|
|
107
|
-
if @distance_m < 0
|
149
|
+
if !@distance_m.nil? && @distance_m < 0
|
108
150
|
invalid_properties.push('invalid value for "distance_m", must be greater than or equal to 0.')
|
109
151
|
end
|
110
152
|
|
@@ -114,24 +156,19 @@ module Patch
|
|
114
156
|
# Check to see if the all the properties in the model are valid
|
115
157
|
# @return true if the model is valid
|
116
158
|
def valid?
|
117
|
-
return false if
|
118
|
-
return false if @distance_m
|
119
|
-
return false if @distance_m < 0
|
159
|
+
return false if !@distance_m.nil? && @distance_m > 400000000
|
160
|
+
return false if !@distance_m.nil? && @distance_m < 0
|
120
161
|
true
|
121
162
|
end
|
122
163
|
|
123
164
|
# Custom attribute writer method with validation
|
124
165
|
# @param [Object] distance_m Value to be assigned
|
125
166
|
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
|
167
|
+
if !distance_m.nil? && distance_m > 400000000
|
131
168
|
fail ArgumentError, 'invalid value for "distance_m", must be smaller than or equal to 400000000.'
|
132
169
|
end
|
133
170
|
|
134
|
-
if distance_m < 0
|
171
|
+
if !distance_m.nil? && distance_m < 0
|
135
172
|
fail ArgumentError, 'invalid value for "distance_m", must be greater than or equal to 0.'
|
136
173
|
end
|
137
174
|
|
@@ -144,6 +181,11 @@ module Patch
|
|
144
181
|
return true if self.equal?(o)
|
145
182
|
self.class == o.class &&
|
146
183
|
distance_m == o.distance_m &&
|
184
|
+
origin_airport == o.origin_airport &&
|
185
|
+
destination_airport == o.destination_airport &&
|
186
|
+
aircraft_code == o.aircraft_code &&
|
187
|
+
cabin_class == o.cabin_class &&
|
188
|
+
passenger_count == o.passenger_count &&
|
147
189
|
project_id == o.project_id &&
|
148
190
|
create_order == o.create_order
|
149
191
|
end
|
@@ -157,7 +199,7 @@ module Patch
|
|
157
199
|
# Calculates hash code according to all attributes.
|
158
200
|
# @return [Integer] Hash code
|
159
201
|
def hash
|
160
|
-
[distance_m, project_id, create_order].hash
|
202
|
+
[distance_m, origin_airport, destination_airport, aircraft_code, cabin_class, passenger_count, project_id, create_order].hash
|
161
203
|
end
|
162
204
|
|
163
205
|
# 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
data/patch_ruby.gemspec
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"
|
@@ -74,8 +89,9 @@ RSpec.describe 'Estimates Integration' do
|
|
74
89
|
expect(create_estimate_response.data.mass_g).to eq 12_431
|
75
90
|
end
|
76
91
|
|
92
|
+
|
77
93
|
it 'supports creating bitcoin estimates with partial information' do
|
78
|
-
bitcoin_estimate = Patch::Estimate.create_bitcoin_estimate({
|
94
|
+
bitcoin_estimate = Patch::Estimate.create_bitcoin_estimate({})
|
79
95
|
|
80
96
|
expect(bitcoin_estimate.data.type).to eq 'bitcoin'
|
81
97
|
expect(bitcoin_estimate.data.mass_g).to be >= 2_000
|
@@ -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)
|
data/spec/spec_helper.rb
CHANGED
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.12.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-08
|
11
|
+
date: 2021-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -64,6 +64,20 @@ dependencies:
|
|
64
64
|
- - "~>"
|
65
65
|
- !ruby/object:Gem::Version
|
66
66
|
version: '6.2'
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
name: pry
|
69
|
+
requirement: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
type: :development
|
75
|
+
prerelease: false
|
76
|
+
version_requirements: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
67
81
|
description: Ruby wrapper for the Patch API
|
68
82
|
email:
|
69
83
|
- developers@usepatch.com
|
@@ -190,52 +204,52 @@ specification_version: 4
|
|
190
204
|
summary: Ruby wrapper for the Patch API
|
191
205
|
test_files:
|
192
206
|
- spec/api/orders_api_spec.rb
|
193
|
-
- spec/api/preferences_api_spec.rb
|
194
207
|
- spec/api/projects_api_spec.rb
|
208
|
+
- spec/api/preferences_api_spec.rb
|
195
209
|
- spec/api/estimates_api_spec.rb
|
196
210
|
- spec/api_client_spec.rb
|
197
211
|
- spec/configuration_spec.rb
|
198
212
|
- spec/constants.rb
|
199
|
-
- spec/factories/
|
200
|
-
- spec/factories/allocations.rb
|
213
|
+
- spec/factories/preferences.rb
|
201
214
|
- spec/factories/create_order_requests.rb
|
202
|
-
- spec/factories/
|
203
|
-
- spec/factories/
|
215
|
+
- spec/factories/order_list_responses.rb
|
216
|
+
- spec/factories/projects.rb
|
217
|
+
- spec/factories/estimate_list_responses.rb
|
204
218
|
- spec/factories/create_preference_requests.rb
|
219
|
+
- spec/factories/preference_responses.rb
|
220
|
+
- spec/factories/error_responses.rb
|
205
221
|
- spec/factories/estimates.rb
|
206
|
-
- spec/factories/
|
222
|
+
- spec/factories/order_responses.rb
|
207
223
|
- spec/factories/create_mass_estimate_requests.rb
|
208
|
-
- spec/factories/project_list_responses.rb
|
209
|
-
- spec/factories/error_responses.rb
|
210
|
-
- spec/factories/orders.rb
|
211
|
-
- spec/factories/project_responses.rb
|
212
224
|
- spec/factories/preference_list_responses.rb
|
213
|
-
- spec/factories/order_list_responses.rb
|
214
|
-
- spec/factories/projects.rb
|
215
|
-
- spec/factories/order_responses.rb
|
216
225
|
- spec/factories/estimate_responses.rb
|
217
|
-
- spec/
|
218
|
-
- spec/
|
226
|
+
- spec/factories/meta_index_objects.rb
|
227
|
+
- spec/factories/project_responses.rb
|
228
|
+
- spec/factories/orders.rb
|
229
|
+
- spec/factories/project_list_responses.rb
|
230
|
+
- spec/factories/allocations.rb
|
219
231
|
- spec/integration/projects_spec.rb
|
220
232
|
- spec/integration/preferences_spec.rb
|
221
|
-
- spec/
|
222
|
-
- spec/
|
223
|
-
- spec/models/
|
224
|
-
- spec/models/
|
233
|
+
- spec/integration/estimates_spec.rb
|
234
|
+
- spec/integration/orders_spec.rb
|
235
|
+
- spec/models/error_response_spec.rb
|
236
|
+
- spec/models/create_order_request_spec.rb
|
225
237
|
- spec/models/create_mass_estimate_request_spec.rb
|
226
|
-
- spec/models/preference_spec.rb
|
227
|
-
- spec/models/order_response_spec.rb
|
228
238
|
- spec/models/preference_list_response_spec.rb
|
229
|
-
- spec/models/estimate_spec.rb
|
230
239
|
- spec/models/project_response_spec.rb
|
240
|
+
- spec/models/estimate_spec.rb
|
241
|
+
- spec/models/project_list_response_spec.rb
|
242
|
+
- spec/models/preference_spec.rb
|
243
|
+
- spec/models/order_response_spec.rb
|
244
|
+
- spec/models/estimate_list_response_spec.rb
|
245
|
+
- spec/models/order_list_response_spec.rb
|
246
|
+
- spec/models/create_preference_request_spec.rb
|
247
|
+
- spec/models/meta_index_object_spec.rb
|
248
|
+
- spec/models/order_spec.rb
|
249
|
+
- spec/models/preference_response_spec.rb
|
231
250
|
- spec/models/estimate_response_spec.rb
|
232
|
-
- spec/models/error_response_spec.rb
|
233
251
|
- spec/models/project_spec.rb
|
234
|
-
- spec/models/preference_response_spec.rb
|
235
|
-
- spec/models/create_order_request_spec.rb
|
236
|
-
- spec/models/order_spec.rb
|
237
252
|
- spec/models/allocation_spec.rb
|
238
|
-
- spec/models/estimate_list_response_spec.rb
|
239
253
|
- spec/patch_ruby_spec.rb
|
240
254
|
- spec/spec_helper.rb
|
241
255
|
- spec/support/shared/generated_classes.rb
|