patch_ruby 1.10.0 → 1.11.1
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 +4 -4
- data/CHANGELOG.md +18 -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_flight_estimate_request.rb +323 -0
- data/lib/patch_ruby/models/create_shipping_estimate_request.rb +371 -0
- data/lib/patch_ruby/models/create_success_response.rb +247 -0
- data/lib/patch_ruby/models/create_vehicle_estimate_request.rb +326 -0
- data/lib/patch_ruby/version.rb +1 -1
- data/lib/patch_ruby.rb +4 -0
- data/patch_ruby.gemspec +1 -0
- data/spec/integration/estimates_spec.rb +17 -1
- data/spec/spec_helper.rb +1 -0
- metadata +47 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a017e768d44e30fef04820e7d9254fabdcd1fc4559ad72956b386a9b428ee773
|
4
|
+
data.tar.gz: d1ba0ce0ae0b6ee71a95665fe734cb00235595151bd79dd612f57822e1b2859d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 217658d0c7ebe7752555e74879fa0afe3093e0df0499d22f8787b280a1580c130ebbb7eed8c9164e513c3512784618bd0f7086d5277964887b37511e46f32493
|
7
|
+
data.tar.gz: 9d3bc7146dd951e13b3cf32019ce5f5713fc5cc01470ea814714db2d61b3b34da8cc318bc321f93ae407785d0a75a2ed4840c9263a19601bc91643bcd1f20f5b
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,24 @@ 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.11.1] - 2021-09-07
|
9
|
+
|
10
|
+
### Changed
|
11
|
+
|
12
|
+
- Body parameters are validated before being sent to the API. This gives developers faster feedback as they develop their applications.
|
13
|
+
|
14
|
+
## [1.11.0] - 2021-09-07
|
15
|
+
|
16
|
+
### Added
|
17
|
+
|
18
|
+
- Adds support for airports, aircracts, cabin class and passenger count in flight estimates
|
19
|
+
|
20
|
+
## [1.10.2] - 2021-09-01
|
21
|
+
|
22
|
+
### Fixed
|
23
|
+
|
24
|
+
- Allows methods to be called with no parameters
|
25
|
+
|
8
26
|
## [1.10.0] - 2021-08-27
|
9
27
|
|
10
28
|
### 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.11.1)
|
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.11.1"
|
35
35
|
@default_headers = {
|
36
36
|
'Content-Type' => 'application/json',
|
37
37
|
'User-Agent' => @user_agent
|
@@ -0,0 +1,323 @@
|
|
1
|
+
=begin
|
2
|
+
#Patch API V1
|
3
|
+
|
4
|
+
#The core API used to integrate with Patch's service
|
5
|
+
|
6
|
+
The version of the OpenAPI document: v1
|
7
|
+
Contact: developers@usepatch.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.2.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Patch
|
17
|
+
class CreateFlightEstimateRequest
|
18
|
+
attr_accessor :distance_m
|
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
|
+
|
30
|
+
attr_accessor :project_id
|
31
|
+
|
32
|
+
attr_accessor :create_order
|
33
|
+
|
34
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
35
|
+
def self.attribute_map
|
36
|
+
{
|
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',
|
43
|
+
:'project_id' => :'project_id',
|
44
|
+
:'create_order' => :'create_order'
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
# Returns all the JSON keys this model knows about
|
49
|
+
def self.acceptable_attributes
|
50
|
+
attribute_map.values
|
51
|
+
end
|
52
|
+
|
53
|
+
# Attribute type mapping.
|
54
|
+
def self.openapi_types
|
55
|
+
{
|
56
|
+
:'distance_m' => :'Integer',
|
57
|
+
:'origin_airport' => :'String',
|
58
|
+
:'destination_airport' => :'String',
|
59
|
+
:'aircraft_code' => :'String',
|
60
|
+
:'cabin_class' => :'String',
|
61
|
+
:'passenger_count' => :'Integer',
|
62
|
+
:'project_id' => :'String',
|
63
|
+
:'create_order' => :'Boolean'
|
64
|
+
}
|
65
|
+
end
|
66
|
+
|
67
|
+
# List of attributes with nullable: true
|
68
|
+
def self.openapi_nullable
|
69
|
+
Set.new([
|
70
|
+
:'distance_m',
|
71
|
+
:'origin_airport',
|
72
|
+
:'destination_airport',
|
73
|
+
:'aircraft_code',
|
74
|
+
:'cabin_class',
|
75
|
+
:'passenger_count',
|
76
|
+
:'project_id',
|
77
|
+
:'create_order'
|
78
|
+
])
|
79
|
+
end
|
80
|
+
|
81
|
+
|
82
|
+
# Allows models with corresponding API classes to delegate API operations to those API classes
|
83
|
+
# Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
|
84
|
+
# Eg. Order.create_order delegates to OrdersApi.new.create_order
|
85
|
+
def self.method_missing(message, *args, &block)
|
86
|
+
if Object.const_defined?('Patch::CreateFlightEstimateRequestsApi::OPERATIONS') && Patch::CreateFlightEstimateRequestsApi::OPERATIONS.include?(message)
|
87
|
+
Patch::CreateFlightEstimateRequestsApi.new.send(message, *args)
|
88
|
+
else
|
89
|
+
super
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
# Initializes the object
|
94
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
95
|
+
def initialize(attributes = {})
|
96
|
+
if (!attributes.is_a?(Hash))
|
97
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Patch::CreateFlightEstimateRequest` initialize method"
|
98
|
+
end
|
99
|
+
|
100
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
101
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
102
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
103
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Patch::CreateFlightEstimateRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
104
|
+
end
|
105
|
+
h[k.to_sym] = v
|
106
|
+
}
|
107
|
+
|
108
|
+
if attributes.key?(:'distance_m')
|
109
|
+
self.distance_m = attributes[:'distance_m']
|
110
|
+
end
|
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
|
+
|
132
|
+
if attributes.key?(:'project_id')
|
133
|
+
self.project_id = attributes[:'project_id']
|
134
|
+
end
|
135
|
+
|
136
|
+
if attributes.key?(:'create_order')
|
137
|
+
self.create_order = attributes[:'create_order']
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
142
|
+
# @return Array for valid properties with the reasons
|
143
|
+
def list_invalid_properties
|
144
|
+
invalid_properties = Array.new
|
145
|
+
if !@distance_m.nil? && @distance_m > 400000000
|
146
|
+
invalid_properties.push('invalid value for "distance_m", must be smaller than or equal to 400000000.')
|
147
|
+
end
|
148
|
+
|
149
|
+
if !@distance_m.nil? && @distance_m < 0
|
150
|
+
invalid_properties.push('invalid value for "distance_m", must be greater than or equal to 0.')
|
151
|
+
end
|
152
|
+
|
153
|
+
invalid_properties
|
154
|
+
end
|
155
|
+
|
156
|
+
# Check to see if the all the properties in the model are valid
|
157
|
+
# @return true if the model is valid
|
158
|
+
def valid?
|
159
|
+
return false if !@distance_m.nil? && @distance_m > 400000000
|
160
|
+
return false if !@distance_m.nil? && @distance_m < 0
|
161
|
+
true
|
162
|
+
end
|
163
|
+
|
164
|
+
# Custom attribute writer method with validation
|
165
|
+
# @param [Object] distance_m Value to be assigned
|
166
|
+
def distance_m=(distance_m)
|
167
|
+
if !distance_m.nil? && distance_m > 400000000
|
168
|
+
fail ArgumentError, 'invalid value for "distance_m", must be smaller than or equal to 400000000.'
|
169
|
+
end
|
170
|
+
|
171
|
+
if !distance_m.nil? && distance_m < 0
|
172
|
+
fail ArgumentError, 'invalid value for "distance_m", must be greater than or equal to 0.'
|
173
|
+
end
|
174
|
+
|
175
|
+
@distance_m = distance_m
|
176
|
+
end
|
177
|
+
|
178
|
+
# Checks equality by comparing each attribute.
|
179
|
+
# @param [Object] Object to be compared
|
180
|
+
def ==(o)
|
181
|
+
return true if self.equal?(o)
|
182
|
+
self.class == o.class &&
|
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 &&
|
189
|
+
project_id == o.project_id &&
|
190
|
+
create_order == o.create_order
|
191
|
+
end
|
192
|
+
|
193
|
+
# @see the `==` method
|
194
|
+
# @param [Object] Object to be compared
|
195
|
+
def eql?(o)
|
196
|
+
self == o
|
197
|
+
end
|
198
|
+
|
199
|
+
# Calculates hash code according to all attributes.
|
200
|
+
# @return [Integer] Hash code
|
201
|
+
def hash
|
202
|
+
[distance_m, origin_airport, destination_airport, aircraft_code, cabin_class, passenger_count, project_id, create_order].hash
|
203
|
+
end
|
204
|
+
|
205
|
+
# Builds the object from hash
|
206
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
207
|
+
# @return [Object] Returns the model itself
|
208
|
+
def self.build_from_hash(attributes)
|
209
|
+
new.build_from_hash(attributes)
|
210
|
+
end
|
211
|
+
|
212
|
+
# Builds the object from hash
|
213
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
214
|
+
# @return [Object] Returns the model itself
|
215
|
+
def build_from_hash(attributes)
|
216
|
+
return nil unless attributes.is_a?(Hash)
|
217
|
+
self.class.openapi_types.each_pair do |key, type|
|
218
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
219
|
+
self.send("#{key}=", nil)
|
220
|
+
elsif type =~ /\AArray<(.*)>/i
|
221
|
+
# check to ensure the input is an array given that the attribute
|
222
|
+
# is documented as an array but the input is not
|
223
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
224
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
225
|
+
end
|
226
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
227
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
self
|
232
|
+
end
|
233
|
+
|
234
|
+
# Deserializes the data based on type
|
235
|
+
# @param string type Data type
|
236
|
+
# @param string value Value to be deserialized
|
237
|
+
# @return [Object] Deserialized data
|
238
|
+
def _deserialize(type, value)
|
239
|
+
case type.to_sym
|
240
|
+
when :Time
|
241
|
+
Time.parse(value)
|
242
|
+
when :Date
|
243
|
+
Date.parse(value)
|
244
|
+
when :String
|
245
|
+
value.to_s
|
246
|
+
when :Integer
|
247
|
+
value.to_i
|
248
|
+
when :Float
|
249
|
+
value.to_f
|
250
|
+
when :Boolean
|
251
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
252
|
+
true
|
253
|
+
else
|
254
|
+
false
|
255
|
+
end
|
256
|
+
when :Object
|
257
|
+
# generic object (usually a Hash), return directly
|
258
|
+
value
|
259
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
260
|
+
inner_type = Regexp.last_match[:inner_type]
|
261
|
+
value.map { |v| _deserialize(inner_type, v) }
|
262
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
263
|
+
k_type = Regexp.last_match[:k_type]
|
264
|
+
v_type = Regexp.last_match[:v_type]
|
265
|
+
{}.tap do |hash|
|
266
|
+
value.each do |k, v|
|
267
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
268
|
+
end
|
269
|
+
end
|
270
|
+
else # model
|
271
|
+
# models (e.g. Pet) or oneOf
|
272
|
+
klass = Patch.const_get(type)
|
273
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
277
|
+
# Returns the string representation of the object
|
278
|
+
# @return [String] String presentation of the object
|
279
|
+
def to_s
|
280
|
+
to_hash.to_s
|
281
|
+
end
|
282
|
+
|
283
|
+
# to_body is an alias to to_hash (backward compatibility)
|
284
|
+
# @return [Hash] Returns the object in the form of hash
|
285
|
+
def to_body
|
286
|
+
to_hash
|
287
|
+
end
|
288
|
+
|
289
|
+
# Returns the object in the form of hash
|
290
|
+
# @return [Hash] Returns the object in the form of hash
|
291
|
+
def to_hash
|
292
|
+
hash = {}
|
293
|
+
self.class.attribute_map.each_pair do |attr, param|
|
294
|
+
value = self.send(attr)
|
295
|
+
if value.nil?
|
296
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
297
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
298
|
+
end
|
299
|
+
|
300
|
+
hash[param] = _to_hash(value)
|
301
|
+
end
|
302
|
+
hash
|
303
|
+
end
|
304
|
+
|
305
|
+
# Outputs non-array value in the form of hash
|
306
|
+
# For object, use to_hash. Otherwise, just return the value
|
307
|
+
# @param [Object] value Any valid value
|
308
|
+
# @return [Hash] Returns the value in the form of hash
|
309
|
+
def _to_hash(value)
|
310
|
+
if value.is_a?(Array)
|
311
|
+
value.compact.map { |v| _to_hash(v) }
|
312
|
+
elsif value.is_a?(Hash)
|
313
|
+
{}.tap do |hash|
|
314
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
315
|
+
end
|
316
|
+
elsif value.respond_to? :to_hash
|
317
|
+
value.to_hash
|
318
|
+
else
|
319
|
+
value
|
320
|
+
end
|
321
|
+
end
|
322
|
+
end
|
323
|
+
end
|