patch_ruby 2.3.1 → 2.5.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2a6cf438be6ff5461e7154c3c8a552c30bb2889fe35822da0ac35a8a1b51e630
4
- data.tar.gz: abdd0f7524382a3f257ab8c7076311da89bf3c7e450b1024cd120df41ae3a367
3
+ metadata.gz: 7f45f73f5a0d485524694df0e81f00c0df48628442ef1edb9153d47047fcc8ad
4
+ data.tar.gz: 17700875029da791ce206a83f0a85736173c6d22050567f2e124b79d0250e2f4
5
5
  SHA512:
6
- metadata.gz: 4d7ed5df7cf393f5fb8dc111da72d98f868edf3958e6557e6cdcbf5bd03ff192174a2beaf3e453b875fabb2eeb16c1321a288c0d0ffb70e4f956f6e8586fcae6
7
- data.tar.gz: 0ef3be8201d172e095158291c2483b403abdd5dfeec3c63041b0be6232d2defa3262c0d6d84b35c6c66c82cc20f6e3cb43173c35fd587f07f1de25b64e2419cc
6
+ metadata.gz: e0c9c11a47c3472d0d62f379a60c1ff9128bbad335965b388c2e6e7e27cfd1602424b803e448a68f28196e2164dd6793b64dc5e37da9460ad37ddb4db2d28c4e
7
+ data.tar.gz: a8f8649b420733b967ebbf992043e1082b3a48c436c78f777de4f72c8999943ee2f58577ecbba5e4762970c542d86321ca4cabd7d14757791109c2a92f99c7cc
data/CHANGELOG.md CHANGED
@@ -5,6 +5,32 @@ 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
+ ## [2.5.0] - 2025-08-19
9
+
10
+ ### Removed
11
+
12
+ - Removes `create_flight_estimate_request` method
13
+
14
+ ## [2.4.0] - 2025-05-16
15
+
16
+ ### Removed
17
+
18
+ - Removes `Patch::Estimate.create_hotel_estimate` method
19
+
20
+ ## [2.3.1] - 2025-04-28
21
+
22
+ ### Removed
23
+
24
+ - Removes `Patch::Estimate.create_ecommerce_estimate` method
25
+
26
+ ## [2.3.0] - 2025-01-10
27
+
28
+ ### Removed
29
+
30
+ - Removes `Patch::Estimate.create_ethereum_estimate` method
31
+ - Removes `Patch::Estimate.create_shipping_estimate` method
32
+ - Removes `Patch::Estimate.create_vehicle_estimate` method
33
+
8
34
  ## [2.1.1] - 2023-04-18
9
35
 
10
36
  ### Added
data/Gemfile CHANGED
@@ -5,5 +5,5 @@ gemspec
5
5
  group :development, :test do
6
6
  gem 'rake', '~> 13.0.1'
7
7
  gem 'pry-byebug'
8
- gem 'rubocop', '~> 0.66.0'
8
+ gem 'rubocop', '~> 1.75.6'
9
9
  end
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- patch_ruby (2.3.1)
4
+ patch_ruby (2.5.0)
5
5
  typhoeus (~> 1.0, >= 1.0.1)
6
6
 
7
7
  GEM
@@ -12,7 +12,7 @@ GEM
12
12
  i18n (>= 1.6, < 2)
13
13
  minitest (>= 5.1)
14
14
  tzinfo (~> 2.0)
15
- ast (2.4.2)
15
+ ast (2.4.3)
16
16
  byebug (11.1.3)
17
17
  coderay (1.1.3)
18
18
  concurrent-ruby (1.2.2)
@@ -21,24 +21,29 @@ GEM
21
21
  ffi (>= 1.15.0)
22
22
  factory_bot (6.2.0)
23
23
  activesupport (>= 5.0.0)
24
- ffi (1.17.1)
24
+ ffi (1.17.2)
25
25
  i18n (1.12.0)
26
26
  concurrent-ruby (~> 1.0)
27
- jaro_winkler (1.5.6)
27
+ json (2.12.0)
28
+ language_server-protocol (3.17.0.5)
29
+ lint_roller (1.1.0)
28
30
  method_source (1.0.0)
29
31
  minitest (5.18.0)
30
- parallel (1.20.1)
31
- parser (3.0.2.0)
32
+ parallel (1.27.0)
33
+ parser (3.3.8.0)
32
34
  ast (~> 2.4.1)
35
+ racc
36
+ prism (1.4.0)
33
37
  pry (0.14.1)
34
38
  coderay (~> 1.1)
35
39
  method_source (~> 1.0)
36
40
  pry-byebug (3.8.0)
37
41
  byebug (~> 11.0)
38
42
  pry (~> 0.10)
39
- psych (4.0.1)
40
- rainbow (3.0.0)
43
+ racc (1.8.1)
44
+ rainbow (3.1.1)
41
45
  rake (13.0.6)
46
+ regexp_parser (2.10.0)
42
47
  rspec (3.10.0)
43
48
  rspec-core (~> 3.10.0)
44
49
  rspec-expectations (~> 3.10.0)
@@ -52,20 +57,28 @@ GEM
52
57
  diff-lcs (>= 1.2.0, < 2.0)
53
58
  rspec-support (~> 3.10.0)
54
59
  rspec-support (3.10.2)
55
- rubocop (0.66.0)
56
- jaro_winkler (~> 1.5.1)
60
+ rubocop (1.75.6)
61
+ json (~> 2.3)
62
+ language_server-protocol (~> 3.17.0.2)
63
+ lint_roller (~> 1.1.0)
57
64
  parallel (~> 1.10)
58
- parser (>= 2.5, != 2.5.1.1)
59
- psych (>= 3.1.0)
65
+ parser (>= 3.3.0.2)
60
66
  rainbow (>= 2.2.2, < 4.0)
67
+ regexp_parser (>= 2.9.3, < 3.0)
68
+ rubocop-ast (>= 1.44.0, < 2.0)
61
69
  ruby-progressbar (~> 1.7)
62
- unicode-display_width (>= 1.4.0, < 1.6)
63
- ruby-progressbar (1.11.0)
70
+ unicode-display_width (>= 2.4.0, < 4.0)
71
+ rubocop-ast (1.44.1)
72
+ parser (>= 3.3.7.2)
73
+ prism (~> 1.4)
74
+ ruby-progressbar (1.13.0)
64
75
  typhoeus (1.4.1)
65
76
  ethon (>= 0.9.0)
66
77
  tzinfo (2.0.6)
67
78
  concurrent-ruby (~> 1.0)
68
- unicode-display_width (1.5.0)
79
+ unicode-display_width (3.1.4)
80
+ unicode-emoji (~> 4.0, >= 4.0.4)
81
+ unicode-emoji (4.0.4)
69
82
 
70
83
  PLATFORMS
71
84
  arm64-darwin-20
@@ -83,7 +96,7 @@ DEPENDENCIES
83
96
  pry-byebug
84
97
  rake (~> 13.0.1)
85
98
  rspec (~> 3.6, >= 3.6.0)
86
- rubocop (~> 0.66.0)
99
+ rubocop (~> 1.75.6)
87
100
 
88
101
  BUNDLED WITH
89
102
  2.3.9
data/README.md CHANGED
@@ -123,10 +123,6 @@ Estimates allow API users to get a quote for the cost of compensating a certain
123
123
  mass = 1_000_000 # Pass in the mass in grams (i.e. 1 metric tonne)
124
124
  Patch::Estimate.create_mass_estimate(mass_g: mass)
125
125
 
126
- # Create a flight estimate
127
- distance_m = 1_000_000 # Pass in the distance traveled in meters
128
- Patch::Estimate.create_flight_estimate(distance_m: distance_m)
129
-
130
126
  # Create a vehicle estimate
131
127
  distance_m = 1_000_000 # Pass in the shipping distance in meters
132
128
  make = "Toyota" # Pass in the car make
@@ -17,8 +17,6 @@ module Patch
17
17
  OPERATIONS = [
18
18
  :create_air_shipping_estimate,
19
19
  :create_bitcoin_estimate,
20
- :create_flight_estimate,
21
- :create_hotel_estimate,
22
20
  :create_mass_estimate,
23
21
  :create_rail_shipping_estimate,
24
22
  :create_road_shipping_estimate,
@@ -180,154 +178,6 @@ module Patch
180
178
  return data, status_code, headers
181
179
  end
182
180
 
183
- # Create a flight estimate given the distance traveled in meters
184
- # Creates a flight 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.
185
- # @param create_flight_estimate_request [CreateFlightEstimateRequest]
186
- # @param [Hash] opts the optional parameters
187
- # @option opts [Integer] :patch_version
188
- # @return [EstimateResponse]
189
- def create_flight_estimate(create_flight_estimate_request = {}, opts = {})
190
- _create_flight_estimate_request = Patch::CreateFlightEstimateRequest.new(create_flight_estimate_request)
191
- data, _status_code, _headers = create_flight_estimate_with_http_info(_create_flight_estimate_request, opts)
192
- data
193
- end
194
-
195
- # Create a flight estimate given the distance traveled in meters
196
- # Creates a flight 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.
197
- # @param create_flight_estimate_request [CreateFlightEstimateRequest]
198
- # @param [Hash] opts the optional parameters
199
- # @option opts [Integer] :patch_version
200
- # @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers
201
- def create_flight_estimate_with_http_info(create_flight_estimate_request, opts = {})
202
- if @api_client.config.debugging
203
- @api_client.config.logger.debug 'Calling API: EstimatesApi.create_flight_estimate ...'
204
- end
205
- # verify the required parameter 'create_flight_estimate_request' is set
206
- if @api_client.config.client_side_validation && create_flight_estimate_request.nil?
207
- fail ArgumentError, "Missing the required parameter 'create_flight_estimate_request' when calling EstimatesApi.create_flight_estimate"
208
- end
209
- # resource path
210
- local_var_path = '/v1/estimates/flight'
211
-
212
- # query parameters
213
- query_params = opts[:query_params] || {}
214
-
215
- # header parameters
216
- header_params = opts[:header_params] || {}
217
-
218
- # HTTP header 'Accept' (if needed)
219
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
220
- # HTTP header 'Content-Type'
221
- content_type = @api_client.select_header_content_type(['application/json'])
222
- if !content_type.nil?
223
- header_params['Content-Type'] = content_type
224
- end
225
- header_params['Patch-Version'] = 2
226
- header_params[:'Patch-Version'] = opts[:'patch_version'] if !opts[:'patch_version'].nil?
227
-
228
- # form parameters
229
- form_params = opts[:form_params] || {}
230
-
231
- # http body (model)
232
- post_body = opts[:debug_body] || @api_client.object_to_http_body(create_flight_estimate_request)
233
-
234
- # return_type
235
- return_type = opts[:debug_return_type] || 'EstimateResponse'
236
-
237
- # auth_names
238
- auth_names = opts[:debug_auth_names] || ['bearer_auth']
239
-
240
- new_options = opts.merge(
241
- :operation => :"EstimatesApi.create_flight_estimate",
242
- :header_params => header_params,
243
- :query_params => query_params,
244
- :form_params => form_params,
245
- :body => post_body,
246
- :auth_names => auth_names,
247
- :return_type => return_type
248
- )
249
-
250
- data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
251
- if @api_client.config.debugging
252
- @api_client.config.logger.debug "API called: EstimatesApi#create_flight_estimate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
253
- end
254
- return data, status_code, headers
255
- end
256
-
257
- # Create a hotel estimate.
258
- # Creates a hotel estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters.
259
- # @param create_hotel_estimate_request [CreateHotelEstimateRequest]
260
- # @param [Hash] opts the optional parameters
261
- # @option opts [Integer] :patch_version
262
- # @return [EstimateResponse]
263
- def create_hotel_estimate(create_hotel_estimate_request = {}, opts = {})
264
- _create_hotel_estimate_request = Patch::CreateHotelEstimateRequest.new(create_hotel_estimate_request)
265
- data, _status_code, _headers = create_hotel_estimate_with_http_info(_create_hotel_estimate_request, opts)
266
- data
267
- end
268
-
269
- # Create a hotel estimate.
270
- # Creates a hotel estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters.
271
- # @param create_hotel_estimate_request [CreateHotelEstimateRequest]
272
- # @param [Hash] opts the optional parameters
273
- # @option opts [Integer] :patch_version
274
- # @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers
275
- def create_hotel_estimate_with_http_info(create_hotel_estimate_request, opts = {})
276
- if @api_client.config.debugging
277
- @api_client.config.logger.debug 'Calling API: EstimatesApi.create_hotel_estimate ...'
278
- end
279
- # verify the required parameter 'create_hotel_estimate_request' is set
280
- if @api_client.config.client_side_validation && create_hotel_estimate_request.nil?
281
- fail ArgumentError, "Missing the required parameter 'create_hotel_estimate_request' when calling EstimatesApi.create_hotel_estimate"
282
- end
283
- # resource path
284
- local_var_path = '/v1/estimates/hotel'
285
-
286
- # query parameters
287
- query_params = opts[:query_params] || {}
288
-
289
- # header parameters
290
- header_params = opts[:header_params] || {}
291
-
292
- # HTTP header 'Accept' (if needed)
293
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
294
- # HTTP header 'Content-Type'
295
- content_type = @api_client.select_header_content_type(['application/json'])
296
- if !content_type.nil?
297
- header_params['Content-Type'] = content_type
298
- end
299
- header_params['Patch-Version'] = 2
300
- header_params[:'Patch-Version'] = opts[:'patch_version'] if !opts[:'patch_version'].nil?
301
-
302
- # form parameters
303
- form_params = opts[:form_params] || {}
304
-
305
- # http body (model)
306
- post_body = opts[:debug_body] || @api_client.object_to_http_body(create_hotel_estimate_request)
307
-
308
- # return_type
309
- return_type = opts[:debug_return_type] || 'EstimateResponse'
310
-
311
- # auth_names
312
- auth_names = opts[:debug_auth_names] || ['bearer_auth']
313
-
314
- new_options = opts.merge(
315
- :operation => :"EstimatesApi.create_hotel_estimate",
316
- :header_params => header_params,
317
- :query_params => query_params,
318
- :form_params => form_params,
319
- :body => post_body,
320
- :auth_names => auth_names,
321
- :return_type => return_type
322
- )
323
-
324
- data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
325
- if @api_client.config.debugging
326
- @api_client.config.logger.debug "API called: EstimatesApi#create_hotel_estimate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
327
- end
328
- return data, status_code, headers
329
- end
330
-
331
181
  # Create an estimate based on mass of CO2
332
182
  # Creates an estimate for the mass of CO2 to be compensated. An order in the `draft` state will also be created, linked to the estimate.
333
183
  # @param create_mass_estimate_request [CreateMassEstimateRequest]
@@ -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/2.3.1"
34
+ @user_agent = "patch-ruby/2.5.0"
35
35
  @default_headers = {
36
36
  'Content-Type' => 'application/json',
37
37
  'User-Agent' => @user_agent
@@ -21,7 +21,7 @@ module Patch
21
21
  # A boolean indicating if this estimate is a production or demo mode estimate.
22
22
  attr_accessor :production
23
23
 
24
- # The type of estimate. Available types are mass, flight, shipping, and crypto.
24
+ # The type of estimate. Available types are mass, shipping, and crypto.
25
25
  attr_accessor :type
26
26
 
27
27
  # The estimated mass in grams for this estimate.
@@ -11,5 +11,5 @@ OpenAPI Generator version: 5.3.1
11
11
  =end
12
12
 
13
13
  module Patch
14
- VERSION = '2.3.1'
14
+ VERSION = '2.5.0'
15
15
  end
data/lib/patch_ruby.rb CHANGED
@@ -19,8 +19,6 @@ require 'patch_ruby/configuration'
19
19
  # Models
20
20
  require 'patch_ruby/models/create_air_shipping_estimate_request'
21
21
  require 'patch_ruby/models/create_bitcoin_estimate_request'
22
- require 'patch_ruby/models/create_flight_estimate_request'
23
- require 'patch_ruby/models/create_hotel_estimate_request'
24
22
  require 'patch_ruby/models/create_mass_estimate_request'
25
23
  require 'patch_ruby/models/create_order_line_item_request'
26
24
  require 'patch_ruby/models/create_order_request'
@@ -19,32 +19,6 @@ RSpec.describe 'Estimates Integration' do
19
19
  expect(estimates.length).not_to be_zero
20
20
  end
21
21
 
22
- it 'supports creating flight estimates' do
23
- distance_m = 10_000_000
24
- flight_estimate = Patch::Estimate.create_flight_estimate(
25
- distance_m: distance_m,
26
- create_order: false
27
- )
28
-
29
- expect(flight_estimate.data.type).to eq 'flight'
30
- expect(flight_estimate.data.mass_g).to be >= 1_000_000
31
- end
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
-
48
22
  it 'supports creating bitcoin estimates with partial information' do
49
23
  bitcoin_estimate = Patch::Estimate.create_bitcoin_estimate()
50
24
 
@@ -91,21 +65,6 @@ RSpec.describe 'Estimates Integration' do
91
65
  expect(bitcoin_estimate_1.data.mass_g).to be < bitcoin_estimate_2.data.mass_g
92
66
  end
93
67
 
94
- it 'supports creating hotel estimates' do
95
- create_estimate_response = Patch::Estimate.create_hotel_estimate(
96
- country_code: "US",
97
- city: "Denver",
98
- star_rating: 5,
99
- number_of_nights: 2,
100
- number_of_rooms: 2
101
- )
102
-
103
- expect(create_estimate_response.success).to eq(true)
104
- expect(create_estimate_response.data.type).to eq 'hotel'
105
- expect(create_estimate_response.data.mass_g).to be >= 100_000
106
- expect(create_estimate_response.data.id).not_to be_nil
107
- end
108
-
109
68
  context "when creating an air shipping estimate" do
110
69
  it "supports creating an estimate using airports" do
111
70
  air_shipping_estimate = Patch::Estimate.create_air_shipping_estimate(
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: 2.3.1
4
+ version: 2.5.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: 2025-04-29 00:00:00.000000000 Z
11
+ date: 2025-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -103,8 +103,6 @@ files:
103
103
  - lib/patch_ruby/configuration.rb
104
104
  - lib/patch_ruby/models/create_air_shipping_estimate_request.rb
105
105
  - lib/patch_ruby/models/create_bitcoin_estimate_request.rb
106
- - lib/patch_ruby/models/create_flight_estimate_request.rb
107
- - lib/patch_ruby/models/create_hotel_estimate_request.rb
108
106
  - lib/patch_ruby/models/create_mass_estimate_request.rb
109
107
  - lib/patch_ruby/models/create_order_line_item_request.rb
110
108
  - lib/patch_ruby/models/create_order_request.rb
@@ -210,47 +208,47 @@ signing_key:
210
208
  specification_version: 4
211
209
  summary: Ruby wrapper for the Patch API
212
210
  test_files:
211
+ - spec/api/estimates_api_spec.rb
212
+ - spec/api/technology_types_api_spec.rb
213
213
  - spec/api/projects_api_spec.rb
214
214
  - spec/api/orders_api_spec.rb
215
215
  - spec/api/order_line_items_api_spec.rb
216
- - spec/api/estimates_api_spec.rb
217
- - spec/api/technology_types_api_spec.rb
218
216
  - spec/api_client_spec.rb
219
217
  - spec/configuration_spec.rb
220
218
  - spec/constants.rb
221
- - spec/factories/order_list_responses.rb
222
- - spec/factories/project_responses.rb
223
- - spec/factories/estimate_list_responses.rb
224
- - spec/factories/projects.rb
225
- - spec/factories/orders.rb
226
- - spec/factories/technology_type.rb
219
+ - spec/factories/project_list_responses.rb
227
220
  - spec/factories/order_responses.rb
228
- - spec/factories/create_mass_estimate_requests.rb
229
- - spec/factories/estimate_responses.rb
230
- - spec/factories/create_order_requests.rb
231
221
  - spec/factories/parent_technology_type.rb
232
- - spec/factories/project_list_responses.rb
233
- - spec/factories/error_responses.rb
222
+ - spec/factories/orders.rb
223
+ - spec/factories/estimate_responses.rb
224
+ - spec/factories/order_list_responses.rb
234
225
  - spec/factories/estimates.rb
235
- - spec/factories/meta_index_objects.rb
226
+ - spec/factories/create_mass_estimate_requests.rb
236
227
  - spec/factories/sdgs.rb
237
- - spec/integration/projects/technology_types_spec.rb
228
+ - spec/factories/estimate_list_responses.rb
229
+ - spec/factories/create_order_requests.rb
230
+ - spec/factories/technology_type.rb
231
+ - spec/factories/meta_index_objects.rb
232
+ - spec/factories/project_responses.rb
233
+ - spec/factories/error_responses.rb
234
+ - spec/factories/projects.rb
235
+ - spec/integration/projects_spec.rb
238
236
  - spec/integration/orders_spec.rb
237
+ - spec/integration/projects/technology_types_spec.rb
239
238
  - spec/integration/estimates_spec.rb
240
- - spec/integration/projects_spec.rb
239
+ - spec/models/order_spec.rb
240
+ - spec/models/project_list_response_spec.rb
241
+ - spec/models/estimate_list_response_spec.rb
241
242
  - spec/models/create_order_request_spec.rb
242
243
  - spec/models/estimate_response_spec.rb
243
- - spec/models/meta_index_object_spec.rb
244
- - spec/models/create_mass_estimate_request_spec.rb
245
- - spec/models/order_spec.rb
246
- - spec/models/error_response_spec.rb
247
244
  - spec/models/order_response_spec.rb
245
+ - spec/models/project_response_spec.rb
248
246
  - spec/models/estimate_spec.rb
249
- - spec/models/estimate_list_response_spec.rb
250
- - spec/models/order_list_response_spec.rb
251
- - spec/models/project_list_response_spec.rb
247
+ - spec/models/error_response_spec.rb
248
+ - spec/models/create_mass_estimate_request_spec.rb
252
249
  - spec/models/project_spec.rb
253
- - spec/models/project_response_spec.rb
250
+ - spec/models/meta_index_object_spec.rb
251
+ - spec/models/order_list_response_spec.rb
254
252
  - spec/patch_ruby_spec.rb
255
253
  - spec/spec_helper.rb
256
254
  - spec/support/shared/generated_classes.rb
@@ -1,325 +0,0 @@
1
- =begin
2
- #Patch API V2
3
-
4
- #The core API used to integrate with Patch's service
5
-
6
- The version of the OpenAPI document: 2
7
- Contact: engineering@usepatch.com
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 5.3.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
- else
139
- self.create_order = false
140
- end
141
- end
142
-
143
- # Show invalid properties with the reasons. Usually used together with valid?
144
- # @return Array for valid properties with the reasons
145
- def list_invalid_properties
146
- invalid_properties = Array.new
147
- if !@distance_m.nil? && @distance_m > 400000000
148
- invalid_properties.push('invalid value for "distance_m", must be smaller than or equal to 400000000.')
149
- end
150
-
151
- if !@distance_m.nil? && @distance_m < 0
152
- invalid_properties.push('invalid value for "distance_m", must be greater than or equal to 0.')
153
- end
154
-
155
- invalid_properties
156
- end
157
-
158
- # Check to see if the all the properties in the model are valid
159
- # @return true if the model is valid
160
- def valid?
161
- return false if !@distance_m.nil? && @distance_m > 400000000
162
- return false if !@distance_m.nil? && @distance_m < 0
163
- true
164
- end
165
-
166
- # Custom attribute writer method with validation
167
- # @param [Object] distance_m Value to be assigned
168
- def distance_m=(distance_m)
169
- if !distance_m.nil? && distance_m > 400000000
170
- fail ArgumentError, 'invalid value for "distance_m", must be smaller than or equal to 400000000.'
171
- end
172
-
173
- if !distance_m.nil? && distance_m < 0
174
- fail ArgumentError, 'invalid value for "distance_m", must be greater than or equal to 0.'
175
- end
176
-
177
- @distance_m = distance_m
178
- end
179
-
180
- # Checks equality by comparing each attribute.
181
- # @param [Object] Object to be compared
182
- def ==(o)
183
- return true if self.equal?(o)
184
- self.class == o.class &&
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 &&
191
- project_id == o.project_id &&
192
- create_order == o.create_order
193
- end
194
-
195
- # @see the `==` method
196
- # @param [Object] Object to be compared
197
- def eql?(o)
198
- self == o
199
- end
200
-
201
- # Calculates hash code according to all attributes.
202
- # @return [Integer] Hash code
203
- def hash
204
- [distance_m, origin_airport, destination_airport, aircraft_code, cabin_class, passenger_count, project_id, create_order].hash
205
- end
206
-
207
- # Builds the object from hash
208
- # @param [Hash] attributes Model attributes in the form of hash
209
- # @return [Object] Returns the model itself
210
- def self.build_from_hash(attributes)
211
- new.build_from_hash(attributes)
212
- end
213
-
214
- # Builds the object from hash
215
- # @param [Hash] attributes Model attributes in the form of hash
216
- # @return [Object] Returns the model itself
217
- def build_from_hash(attributes)
218
- return nil unless attributes.is_a?(Hash)
219
- self.class.openapi_types.each_pair do |key, type|
220
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
221
- self.send("#{key}=", nil)
222
- elsif type =~ /\AArray<(.*)>/i
223
- # check to ensure the input is an array given that the attribute
224
- # is documented as an array but the input is not
225
- if attributes[self.class.attribute_map[key]].is_a?(Array)
226
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
227
- end
228
- elsif !attributes[self.class.attribute_map[key]].nil?
229
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
230
- end
231
- end
232
-
233
- self
234
- end
235
-
236
- # Deserializes the data based on type
237
- # @param string type Data type
238
- # @param string value Value to be deserialized
239
- # @return [Object] Deserialized data
240
- def _deserialize(type, value)
241
- case type.to_sym
242
- when :Time
243
- Time.parse(value)
244
- when :Date
245
- Date.parse(value)
246
- when :String
247
- value.to_s
248
- when :Integer
249
- value.to_i
250
- when :Float
251
- value.to_f
252
- when :Boolean
253
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
254
- true
255
- else
256
- false
257
- end
258
- when :Object
259
- # generic object (usually a Hash), return directly
260
- value
261
- when /\AArray<(?<inner_type>.+)>\z/
262
- inner_type = Regexp.last_match[:inner_type]
263
- value.map { |v| _deserialize(inner_type, v) }
264
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
265
- k_type = Regexp.last_match[:k_type]
266
- v_type = Regexp.last_match[:v_type]
267
- {}.tap do |hash|
268
- value.each do |k, v|
269
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
270
- end
271
- end
272
- else # model
273
- # models (e.g. Pet) or oneOf
274
- klass = Patch.const_get(type)
275
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
276
- end
277
- end
278
-
279
- # Returns the string representation of the object
280
- # @return [String] String presentation of the object
281
- def to_s
282
- to_hash.to_s
283
- end
284
-
285
- # to_body is an alias to to_hash (backward compatibility)
286
- # @return [Hash] Returns the object in the form of hash
287
- def to_body
288
- to_hash
289
- end
290
-
291
- # Returns the object in the form of hash
292
- # @return [Hash] Returns the object in the form of hash
293
- def to_hash
294
- hash = {}
295
- self.class.attribute_map.each_pair do |attr, param|
296
- value = self.send(attr)
297
- if value.nil?
298
- is_nullable = self.class.openapi_nullable.include?(attr)
299
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
300
- end
301
-
302
- hash[param] = _to_hash(value)
303
- end
304
- hash
305
- end
306
-
307
- # Outputs non-array value in the form of hash
308
- # For object, use to_hash. Otherwise, just return the value
309
- # @param [Object] value Any valid value
310
- # @return [Hash] Returns the value in the form of hash
311
- def _to_hash(value)
312
- if value.is_a?(Array)
313
- value.compact.map { |v| _to_hash(v) }
314
- elsif value.is_a?(Hash)
315
- {}.tap do |hash|
316
- value.each { |k, v| hash[k] = _to_hash(v) }
317
- end
318
- elsif value.respond_to? :to_hash
319
- value.to_hash
320
- else
321
- value
322
- end
323
- end
324
- end
325
- end
@@ -1,300 +0,0 @@
1
- =begin
2
- #Patch API V2
3
-
4
- #The core API used to integrate with Patch's service
5
-
6
- The version of the OpenAPI document: 2
7
- Contact: engineering@usepatch.com
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 5.3.1
10
-
11
- =end
12
-
13
- require 'date'
14
- require 'time'
15
-
16
- module Patch
17
- class CreateHotelEstimateRequest
18
- attr_accessor :country_code
19
-
20
- attr_accessor :city
21
-
22
- attr_accessor :region
23
-
24
- attr_accessor :star_rating
25
-
26
- attr_accessor :number_of_nights
27
-
28
- attr_accessor :number_of_rooms
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
- :'country_code' => :'country_code',
38
- :'city' => :'city',
39
- :'region' => :'region',
40
- :'star_rating' => :'star_rating',
41
- :'number_of_nights' => :'number_of_nights',
42
- :'number_of_rooms' => :'number_of_rooms',
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
- :'country_code' => :'String',
57
- :'city' => :'String',
58
- :'region' => :'String',
59
- :'star_rating' => :'Integer',
60
- :'number_of_nights' => :'Integer',
61
- :'number_of_rooms' => :'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
- :'project_id',
71
- :'create_order'
72
- ])
73
- end
74
-
75
-
76
- # Allows models with corresponding API classes to delegate API operations to those API classes
77
- # Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
78
- # Eg. Order.create_order delegates to OrdersApi.new.create_order
79
- def self.method_missing(message, *args, &block)
80
- if Object.const_defined?('Patch::CreateHotelEstimateRequestsApi::OPERATIONS') && Patch::CreateHotelEstimateRequestsApi::OPERATIONS.include?(message)
81
- Patch::CreateHotelEstimateRequestsApi.new.send(message, *args)
82
- else
83
- super
84
- end
85
- end
86
-
87
- # Initializes the object
88
- # @param [Hash] attributes Model attributes in the form of hash
89
- def initialize(attributes = {})
90
- if (!attributes.is_a?(Hash))
91
- fail ArgumentError, "The input argument (attributes) must be a hash in `Patch::CreateHotelEstimateRequest` initialize method"
92
- end
93
-
94
- # check to see if the attribute exists and convert string to symbol for hash key
95
- attributes = attributes.each_with_object({}) { |(k, v), h|
96
- if (!self.class.attribute_map.key?(k.to_sym))
97
- fail ArgumentError, "`#{k}` is not a valid attribute in `Patch::CreateHotelEstimateRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
98
- end
99
- h[k.to_sym] = v
100
- }
101
-
102
- if attributes.key?(:'country_code')
103
- self.country_code = attributes[:'country_code']
104
- end
105
-
106
- if attributes.key?(:'city')
107
- self.city = attributes[:'city']
108
- end
109
-
110
- if attributes.key?(:'region')
111
- self.region = attributes[:'region']
112
- end
113
-
114
- if attributes.key?(:'star_rating')
115
- self.star_rating = attributes[:'star_rating']
116
- end
117
-
118
- if attributes.key?(:'number_of_nights')
119
- self.number_of_nights = attributes[:'number_of_nights']
120
- end
121
-
122
- if attributes.key?(:'number_of_rooms')
123
- self.number_of_rooms = attributes[:'number_of_rooms']
124
- end
125
-
126
- if attributes.key?(:'project_id')
127
- self.project_id = attributes[:'project_id']
128
- end
129
-
130
- if attributes.key?(:'create_order')
131
- self.create_order = attributes[:'create_order']
132
- else
133
- self.create_order = false
134
- end
135
- end
136
-
137
- # Show invalid properties with the reasons. Usually used together with valid?
138
- # @return Array for valid properties with the reasons
139
- def list_invalid_properties
140
- invalid_properties = Array.new
141
- if @country_code.nil?
142
- invalid_properties.push('invalid value for "country_code", country_code cannot be nil.')
143
- end
144
-
145
- invalid_properties
146
- end
147
-
148
- # Check to see if the all the properties in the model are valid
149
- # @return true if the model is valid
150
- def valid?
151
- return false if @country_code.nil?
152
- true
153
- end
154
-
155
- # Checks equality by comparing each attribute.
156
- # @param [Object] Object to be compared
157
- def ==(o)
158
- return true if self.equal?(o)
159
- self.class == o.class &&
160
- country_code == o.country_code &&
161
- city == o.city &&
162
- region == o.region &&
163
- star_rating == o.star_rating &&
164
- number_of_nights == o.number_of_nights &&
165
- number_of_rooms == o.number_of_rooms &&
166
- project_id == o.project_id &&
167
- create_order == o.create_order
168
- end
169
-
170
- # @see the `==` method
171
- # @param [Object] Object to be compared
172
- def eql?(o)
173
- self == o
174
- end
175
-
176
- # Calculates hash code according to all attributes.
177
- # @return [Integer] Hash code
178
- def hash
179
- [country_code, city, region, star_rating, number_of_nights, number_of_rooms, project_id, create_order].hash
180
- end
181
-
182
- # Builds the object from hash
183
- # @param [Hash] attributes Model attributes in the form of hash
184
- # @return [Object] Returns the model itself
185
- def self.build_from_hash(attributes)
186
- new.build_from_hash(attributes)
187
- end
188
-
189
- # Builds the object from hash
190
- # @param [Hash] attributes Model attributes in the form of hash
191
- # @return [Object] Returns the model itself
192
- def build_from_hash(attributes)
193
- return nil unless attributes.is_a?(Hash)
194
- self.class.openapi_types.each_pair do |key, type|
195
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
196
- self.send("#{key}=", nil)
197
- elsif type =~ /\AArray<(.*)>/i
198
- # check to ensure the input is an array given that the attribute
199
- # is documented as an array but the input is not
200
- if attributes[self.class.attribute_map[key]].is_a?(Array)
201
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
202
- end
203
- elsif !attributes[self.class.attribute_map[key]].nil?
204
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
205
- end
206
- end
207
-
208
- self
209
- end
210
-
211
- # Deserializes the data based on type
212
- # @param string type Data type
213
- # @param string value Value to be deserialized
214
- # @return [Object] Deserialized data
215
- def _deserialize(type, value)
216
- case type.to_sym
217
- when :Time
218
- Time.parse(value)
219
- when :Date
220
- Date.parse(value)
221
- when :String
222
- value.to_s
223
- when :Integer
224
- value.to_i
225
- when :Float
226
- value.to_f
227
- when :Boolean
228
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
229
- true
230
- else
231
- false
232
- end
233
- when :Object
234
- # generic object (usually a Hash), return directly
235
- value
236
- when /\AArray<(?<inner_type>.+)>\z/
237
- inner_type = Regexp.last_match[:inner_type]
238
- value.map { |v| _deserialize(inner_type, v) }
239
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
240
- k_type = Regexp.last_match[:k_type]
241
- v_type = Regexp.last_match[:v_type]
242
- {}.tap do |hash|
243
- value.each do |k, v|
244
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
245
- end
246
- end
247
- else # model
248
- # models (e.g. Pet) or oneOf
249
- klass = Patch.const_get(type)
250
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
251
- end
252
- end
253
-
254
- # Returns the string representation of the object
255
- # @return [String] String presentation of the object
256
- def to_s
257
- to_hash.to_s
258
- end
259
-
260
- # to_body is an alias to to_hash (backward compatibility)
261
- # @return [Hash] Returns the object in the form of hash
262
- def to_body
263
- to_hash
264
- end
265
-
266
- # Returns the object in the form of hash
267
- # @return [Hash] Returns the object in the form of hash
268
- def to_hash
269
- hash = {}
270
- self.class.attribute_map.each_pair do |attr, param|
271
- value = self.send(attr)
272
- if value.nil?
273
- is_nullable = self.class.openapi_nullable.include?(attr)
274
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
275
- end
276
-
277
- hash[param] = _to_hash(value)
278
- end
279
- hash
280
- end
281
-
282
- # Outputs non-array value in the form of hash
283
- # For object, use to_hash. Otherwise, just return the value
284
- # @param [Object] value Any valid value
285
- # @return [Hash] Returns the value in the form of hash
286
- def _to_hash(value)
287
- if value.is_a?(Array)
288
- value.compact.map { |v| _to_hash(v) }
289
- elsif value.is_a?(Hash)
290
- {}.tap do |hash|
291
- value.each { |k, v| hash[k] = _to_hash(v) }
292
- end
293
- elsif value.respond_to? :to_hash
294
- value.to_hash
295
- else
296
- value
297
- end
298
- end
299
- end
300
- end