patch_ruby 1.21.0 → 1.24.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6e90b99f33c3f3a2115590dba9caffe9335da298a1bb4fb362496e31d87c8f6e
4
- data.tar.gz: 86a32f5775dd5d23fa61b5ac2617f6ff65ff1a487d9deb19bcf5f27752dc5dad
3
+ metadata.gz: 1a119c788c7b08df5347be280324d01a7f9acf576ef7f727833c32433a53b6ff
4
+ data.tar.gz: fb0aac7b2909a12485a97e476ae0e7f3b17a54186b2262f2b8eb1cb8ae1e447c
5
5
  SHA512:
6
- metadata.gz: 8f85ec5d3bb14d15411ae9b75da0d0e4655d599dec6144128801b05c3f5a8984f644de5fb0c95065d7c1e7c1adf73f4c4d5af24c0ff216291866b020ffeecc13
7
- data.tar.gz: 9cd5df665fe03ff82e9f1d6b49d48dc7378cea330c023d38572d89cadc537cf58464eb0ef88c2c195e99f953ad79135c954632f0c9864709b41b8fa31e3529d6
6
+ metadata.gz: f8185665815ed84680fab0b395845260fd41c2ef86cb288137e106cfef865fda41dce66b259f0773c5464127959cb1ea62ccbf7fd5af162b4dee82a30a97a11a
7
+ data.tar.gz: e4afa1e0675073437b34cf4928e909f40958664c6b7646d887bd6b75137510efc25254e79fcdd040755c35147ba680656b1416beaa37a8746b09caafd23775bb
data/CHANGELOG.md CHANGED
@@ -5,6 +5,27 @@ 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.24.0] - 2022-07-22
9
+
10
+ ### Added
11
+
12
+ - Adds `Patch::Estimate.create_air_shipping_estimate` method
13
+ - Adds `Patch::Estimate.create_rail_shipping_estimate` method
14
+ - Adds `Patch::Estimate.create_road_shipping_estimate` method
15
+ - Adds `Patch::Estimate.create_sea_shipping_estimate` method
16
+
17
+ ## [1.23.0] - 2022-06-03
18
+
19
+ ### Added
20
+
21
+ - Adds support for the `issued_to` parameter on `orders`, to add support for creating and placing orders on behalf of another party.
22
+
23
+ ## [1.22.0] - 2022-05-16
24
+
25
+ ### Added
26
+
27
+ - Adds support for the `accept_language` option on `projects`, to add support for the `Accept-Language` header.
28
+
8
29
  ## [1.21.0] - 2022-05-03
9
30
 
10
31
  ### Added
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- patch_ruby (1.21.0)
4
+ patch_ruby (1.24.0)
5
5
  typhoeus (~> 1.0, >= 1.0.1)
6
6
 
7
7
  GEM
@@ -73,6 +73,7 @@ PLATFORMS
73
73
  arm64-darwin-20
74
74
  arm64-darwin-21
75
75
  x86_64-darwin-20
76
+ x86_64-darwin-21
76
77
  x86_64-linux
77
78
 
78
79
  DEPENDENCIES
data/README.md CHANGED
@@ -74,6 +74,12 @@ total_price = 5_00 # Pass in the total price in smallest currency unit (ie cents
74
74
  currency = "USD"
75
75
  Patch::Order.create_order(total_price: total_price, currency: currency)
76
76
 
77
+ # Create an order with issued_to field (optional)
78
+ total_price = 5_00 # Pass in the total price in smallest currency unit (ie cents for USD).
79
+ currency = "USD"
80
+ issued_to = {email: "envimpact@companya.com", name: "Company A"}
81
+ Patch::Order.create_order(total_price: total_price, currency: currency, issued_to: issued_to)
82
+
77
83
  ## You can also specify a project-id field (optional) to be used instead of the preferred one
78
84
  project_id = 'pro_test_1234' # Pass in the project's ID
79
85
  Patch::Order.create_order(amount: amount, unit: unit, project_id: project_id)
@@ -90,6 +96,11 @@ Patch::Order.retrieve_order(order_id)
90
96
  order_id = 'ord_test_1234' # Pass in the order's id
91
97
  Patch::Order.place_order(order_id)
92
98
 
99
+ ## Placing an order on behalf of another party with the issued_to field (optional)
100
+ order_id = 'ord_test_1234' # Pass in the order's id
101
+ issued_to = {email: "envimpact@companya.com", name: "Company A"}
102
+ Patch::Order.place_order(order_id, issued_to: issued_to)
103
+
93
104
  # Cancel an order
94
105
  order_id = 'ord_test_1234' # Pass in the order's id
95
106
  Patch::Order.cancel_order(order_id)
@@ -189,6 +200,15 @@ Patch::Project.retrieve_projects(type: type)
189
200
  # Retrieve a list of projects with at least 100 grams of available offsets
190
201
  minimum_available_mass = 100
191
202
  Patch::Project.retrieve_projects(minimum_available_mass: minimum_available_mass)
203
+
204
+ # Retrieve a project in a different language
205
+ # See http://docs.patch.test:3000/#/internationalization for more information and support
206
+ project_id = 'pro_test_1234'
207
+ Patch::Project.retrieve_project(project_id, accept_language: 'fr')
208
+
209
+ # Retrieve a list of projects in a different language
210
+ # See http://docs.patch.test:3000/#/internationalization for more information and support
211
+ Patch::Project.retrieve_projects(accept_language: 'fr')
192
212
  ```
193
213
  ## Contributing
194
214
 
@@ -210,6 +230,25 @@ This will create a .gem file. To install the local gem:
210
230
  gem install patch_ruby-1.x.x.gem
211
231
  ```
212
232
 
233
+ Once you have installed the gem, you can easily test with `irb`. Here's an example of testing Order creation:
234
+ ```bash
235
+ brett@Bretts-MacBook-Pro patch-ruby $ irb
236
+ irb(main):001:0> require 'patch_ruby'
237
+ => true
238
+ irb(main):002:0>
239
+ irb(main):003:1* Patch.configure do |config|
240
+ irb(main):004:1* # Configure the Patch gem with your API key here
241
+ irb(main):005:1* config.access_token = ENV['SANDBOX_API_KEY']
242
+ irb(main):006:0> end
243
+ => "[REDACTED]"
244
+ irb(main):007:0> total_price = 5_00
245
+ => 500
246
+ irb(main):008:0> currency = "USD"
247
+ => "USD"
248
+ irb(main):009:0> issued_to = {email: "envimpact@companya.com", name: "Company A"}
249
+ irb(main):010:0> Patch::Order.create_order(total_price: total_price, currency: currency, issued_to: issued_to)
250
+ ```
251
+
213
252
  ### Running tests
214
253
 
215
254
  Set up the required environment variable.
@@ -15,11 +15,15 @@ require 'cgi'
15
15
  module Patch
16
16
  class EstimatesApi
17
17
  OPERATIONS = [
18
+ :create_air_shipping_estimate,
18
19
  :create_bitcoin_estimate,
19
20
  :create_ethereum_estimate,
20
21
  :create_flight_estimate,
21
22
  :create_hotel_estimate,
22
23
  :create_mass_estimate,
24
+ :create_rail_shipping_estimate,
25
+ :create_road_shipping_estimate,
26
+ :create_sea_shipping_estimate,
23
27
  :create_shipping_estimate,
24
28
  :create_vehicle_estimate,
25
29
  :retrieve_estimate,
@@ -31,6 +35,75 @@ module Patch
31
35
  def initialize(api_client = ApiClient.default)
32
36
  @api_client = api_client
33
37
  end
38
+ # Creates a GLEC air shipping estimate given freight mass and logistics
39
+ # Creates a GLEC air shipping 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.
40
+ # @param create_air_shipping_estimate_request [CreateAirShippingEstimateRequest]
41
+ # @param [Hash] opts the optional parameters
42
+ # @return [EstimateResponse]
43
+ def create_air_shipping_estimate(create_air_shipping_estimate_request = {}, opts = {})
44
+ _create_air_shipping_estimate_request = Patch::CreateAirShippingEstimateRequest.new(create_air_shipping_estimate_request)
45
+ data, _status_code, _headers = create_air_shipping_estimate_with_http_info(_create_air_shipping_estimate_request, opts)
46
+ data
47
+ end
48
+
49
+ # Creates a GLEC air shipping estimate given freight mass and logistics
50
+ # Creates a GLEC air shipping 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.
51
+ # @param create_air_shipping_estimate_request [CreateAirShippingEstimateRequest]
52
+ # @param [Hash] opts the optional parameters
53
+ # @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers
54
+ def create_air_shipping_estimate_with_http_info(create_air_shipping_estimate_request, opts = {})
55
+ if @api_client.config.debugging
56
+ @api_client.config.logger.debug 'Calling API: EstimatesApi.create_air_shipping_estimate ...'
57
+ end
58
+ # verify the required parameter 'create_air_shipping_estimate_request' is set
59
+ if @api_client.config.client_side_validation && create_air_shipping_estimate_request.nil?
60
+ fail ArgumentError, "Missing the required parameter 'create_air_shipping_estimate_request' when calling EstimatesApi.create_air_shipping_estimate"
61
+ end
62
+ # resource path
63
+ local_var_path = '/v1/estimates/shipping/air'
64
+
65
+ # query parameters
66
+ query_params = opts[:query_params] || {}
67
+
68
+ # header parameters
69
+ header_params = opts[:header_params] || {}
70
+ # HTTP header 'Accept' (if needed)
71
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
72
+ # HTTP header 'Content-Type'
73
+ content_type = @api_client.select_header_content_type(['application/json'])
74
+ if !content_type.nil?
75
+ header_params['Content-Type'] = content_type
76
+ end
77
+
78
+ # form parameters
79
+ form_params = opts[:form_params] || {}
80
+
81
+ # http body (model)
82
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(create_air_shipping_estimate_request)
83
+
84
+ # return_type
85
+ return_type = opts[:debug_return_type] || 'EstimateResponse'
86
+
87
+ # auth_names
88
+ auth_names = opts[:debug_auth_names] || ['bearer_auth']
89
+
90
+ new_options = opts.merge(
91
+ :operation => :"EstimatesApi.create_air_shipping_estimate",
92
+ :header_params => header_params,
93
+ :query_params => query_params,
94
+ :form_params => form_params,
95
+ :body => post_body,
96
+ :auth_names => auth_names,
97
+ :return_type => return_type
98
+ )
99
+
100
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
101
+ if @api_client.config.debugging
102
+ @api_client.config.logger.debug "API called: EstimatesApi#create_air_shipping_estimate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
103
+ end
104
+ return data, status_code, headers
105
+ end
106
+
34
107
  # Create a bitcoin estimate given a timestamp and transaction value
35
108
  # Creates a bitcoin 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.
36
109
  # @param create_bitcoin_estimate_request [CreateBitcoinEstimateRequest]
@@ -376,6 +449,213 @@ module Patch
376
449
  return data, status_code, headers
377
450
  end
378
451
 
452
+ # Creates a GLEC rail shipping estimate given freight mass and logistics
453
+ # Creates a GLEC rail shipping 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.
454
+ # @param create_rail_shipping_estimate_request [CreateRailShippingEstimateRequest]
455
+ # @param [Hash] opts the optional parameters
456
+ # @return [EstimateResponse]
457
+ def create_rail_shipping_estimate(create_rail_shipping_estimate_request = {}, opts = {})
458
+ _create_rail_shipping_estimate_request = Patch::CreateRailShippingEstimateRequest.new(create_rail_shipping_estimate_request)
459
+ data, _status_code, _headers = create_rail_shipping_estimate_with_http_info(_create_rail_shipping_estimate_request, opts)
460
+ data
461
+ end
462
+
463
+ # Creates a GLEC rail shipping estimate given freight mass and logistics
464
+ # Creates a GLEC rail shipping estimate for the amount of CO2 to be compensated. An order in the &#x60;draft&#x60; state may be created based on the parameters, linked to the estimate.
465
+ # @param create_rail_shipping_estimate_request [CreateRailShippingEstimateRequest]
466
+ # @param [Hash] opts the optional parameters
467
+ # @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers
468
+ def create_rail_shipping_estimate_with_http_info(create_rail_shipping_estimate_request, opts = {})
469
+ if @api_client.config.debugging
470
+ @api_client.config.logger.debug 'Calling API: EstimatesApi.create_rail_shipping_estimate ...'
471
+ end
472
+ # verify the required parameter 'create_rail_shipping_estimate_request' is set
473
+ if @api_client.config.client_side_validation && create_rail_shipping_estimate_request.nil?
474
+ fail ArgumentError, "Missing the required parameter 'create_rail_shipping_estimate_request' when calling EstimatesApi.create_rail_shipping_estimate"
475
+ end
476
+ # resource path
477
+ local_var_path = '/v1/estimates/shipping/rail'
478
+
479
+ # query parameters
480
+ query_params = opts[:query_params] || {}
481
+
482
+ # header parameters
483
+ header_params = opts[:header_params] || {}
484
+ # HTTP header 'Accept' (if needed)
485
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
486
+ # HTTP header 'Content-Type'
487
+ content_type = @api_client.select_header_content_type(['application/json'])
488
+ if !content_type.nil?
489
+ header_params['Content-Type'] = content_type
490
+ end
491
+
492
+ # form parameters
493
+ form_params = opts[:form_params] || {}
494
+
495
+ # http body (model)
496
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(create_rail_shipping_estimate_request)
497
+
498
+ # return_type
499
+ return_type = opts[:debug_return_type] || 'EstimateResponse'
500
+
501
+ # auth_names
502
+ auth_names = opts[:debug_auth_names] || ['bearer_auth']
503
+
504
+ new_options = opts.merge(
505
+ :operation => :"EstimatesApi.create_rail_shipping_estimate",
506
+ :header_params => header_params,
507
+ :query_params => query_params,
508
+ :form_params => form_params,
509
+ :body => post_body,
510
+ :auth_names => auth_names,
511
+ :return_type => return_type
512
+ )
513
+
514
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
515
+ if @api_client.config.debugging
516
+ @api_client.config.logger.debug "API called: EstimatesApi#create_rail_shipping_estimate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
517
+ end
518
+ return data, status_code, headers
519
+ end
520
+
521
+ # Creates a GLEC road shipping estimate given freight mass and logistics
522
+ # Creates a GLEC road shipping 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.
523
+ # @param create_road_shipping_estimate_request [CreateRoadShippingEstimateRequest]
524
+ # @param [Hash] opts the optional parameters
525
+ # @return [EstimateResponse]
526
+ def create_road_shipping_estimate(create_road_shipping_estimate_request = {}, opts = {})
527
+ _create_road_shipping_estimate_request = Patch::CreateRoadShippingEstimateRequest.new(create_road_shipping_estimate_request)
528
+ data, _status_code, _headers = create_road_shipping_estimate_with_http_info(_create_road_shipping_estimate_request, opts)
529
+ data
530
+ end
531
+
532
+ # Creates a GLEC road shipping estimate given freight mass and logistics
533
+ # Creates a GLEC road shipping estimate for the amount of CO2 to be compensated. An order in the &#x60;draft&#x60; state may be created based on the parameters, linked to the estimate.
534
+ # @param create_road_shipping_estimate_request [CreateRoadShippingEstimateRequest]
535
+ # @param [Hash] opts the optional parameters
536
+ # @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers
537
+ def create_road_shipping_estimate_with_http_info(create_road_shipping_estimate_request, opts = {})
538
+ if @api_client.config.debugging
539
+ @api_client.config.logger.debug 'Calling API: EstimatesApi.create_road_shipping_estimate ...'
540
+ end
541
+ # verify the required parameter 'create_road_shipping_estimate_request' is set
542
+ if @api_client.config.client_side_validation && create_road_shipping_estimate_request.nil?
543
+ fail ArgumentError, "Missing the required parameter 'create_road_shipping_estimate_request' when calling EstimatesApi.create_road_shipping_estimate"
544
+ end
545
+ # resource path
546
+ local_var_path = '/v1/estimates/shipping/road'
547
+
548
+ # query parameters
549
+ query_params = opts[:query_params] || {}
550
+
551
+ # header parameters
552
+ header_params = opts[:header_params] || {}
553
+ # HTTP header 'Accept' (if needed)
554
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
555
+ # HTTP header 'Content-Type'
556
+ content_type = @api_client.select_header_content_type(['application/json'])
557
+ if !content_type.nil?
558
+ header_params['Content-Type'] = content_type
559
+ end
560
+
561
+ # form parameters
562
+ form_params = opts[:form_params] || {}
563
+
564
+ # http body (model)
565
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(create_road_shipping_estimate_request)
566
+
567
+ # return_type
568
+ return_type = opts[:debug_return_type] || 'EstimateResponse'
569
+
570
+ # auth_names
571
+ auth_names = opts[:debug_auth_names] || ['bearer_auth']
572
+
573
+ new_options = opts.merge(
574
+ :operation => :"EstimatesApi.create_road_shipping_estimate",
575
+ :header_params => header_params,
576
+ :query_params => query_params,
577
+ :form_params => form_params,
578
+ :body => post_body,
579
+ :auth_names => auth_names,
580
+ :return_type => return_type
581
+ )
582
+
583
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
584
+ if @api_client.config.debugging
585
+ @api_client.config.logger.debug "API called: EstimatesApi#create_road_shipping_estimate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
586
+ end
587
+ return data, status_code, headers
588
+ end
589
+
590
+ # Creates a GLEC sea shipping estimate given freight mass and logistics
591
+ # Creates a GLEC sea shipping 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.
592
+ # @param create_sea_shipping_estimate_request [CreateSeaShippingEstimateRequest]
593
+ # @param [Hash] opts the optional parameters
594
+ # @return [EstimateResponse]
595
+ def create_sea_shipping_estimate(create_sea_shipping_estimate_request = {}, opts = {})
596
+ _create_sea_shipping_estimate_request = Patch::CreateSeaShippingEstimateRequest.new(create_sea_shipping_estimate_request)
597
+ data, _status_code, _headers = create_sea_shipping_estimate_with_http_info(_create_sea_shipping_estimate_request, opts)
598
+ data
599
+ end
600
+
601
+ # Creates a GLEC sea shipping estimate given freight mass and logistics
602
+ # Creates a GLEC sea shipping estimate for the amount of CO2 to be compensated. An order in the &#x60;draft&#x60; state may be created based on the parameters, linked to the estimate.
603
+ # @param create_sea_shipping_estimate_request [CreateSeaShippingEstimateRequest]
604
+ # @param [Hash] opts the optional parameters
605
+ # @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers
606
+ def create_sea_shipping_estimate_with_http_info(create_sea_shipping_estimate_request, opts = {})
607
+ if @api_client.config.debugging
608
+ @api_client.config.logger.debug 'Calling API: EstimatesApi.create_sea_shipping_estimate ...'
609
+ end
610
+ # verify the required parameter 'create_sea_shipping_estimate_request' is set
611
+ if @api_client.config.client_side_validation && create_sea_shipping_estimate_request.nil?
612
+ fail ArgumentError, "Missing the required parameter 'create_sea_shipping_estimate_request' when calling EstimatesApi.create_sea_shipping_estimate"
613
+ end
614
+ # resource path
615
+ local_var_path = '/v1/estimates/shipping/sea'
616
+
617
+ # query parameters
618
+ query_params = opts[:query_params] || {}
619
+
620
+ # header parameters
621
+ header_params = opts[:header_params] || {}
622
+ # HTTP header 'Accept' (if needed)
623
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
624
+ # HTTP header 'Content-Type'
625
+ content_type = @api_client.select_header_content_type(['application/json'])
626
+ if !content_type.nil?
627
+ header_params['Content-Type'] = content_type
628
+ end
629
+
630
+ # form parameters
631
+ form_params = opts[:form_params] || {}
632
+
633
+ # http body (model)
634
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(create_sea_shipping_estimate_request)
635
+
636
+ # return_type
637
+ return_type = opts[:debug_return_type] || 'EstimateResponse'
638
+
639
+ # auth_names
640
+ auth_names = opts[:debug_auth_names] || ['bearer_auth']
641
+
642
+ new_options = opts.merge(
643
+ :operation => :"EstimatesApi.create_sea_shipping_estimate",
644
+ :header_params => header_params,
645
+ :query_params => query_params,
646
+ :form_params => form_params,
647
+ :body => post_body,
648
+ :auth_names => auth_names,
649
+ :return_type => return_type
650
+ )
651
+
652
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
653
+ if @api_client.config.debugging
654
+ @api_client.config.logger.debug "API called: EstimatesApi#create_sea_shipping_estimate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
655
+ end
656
+ return data, status_code, headers
657
+ end
658
+
379
659
  # Create a shipping estimate given the distance traveled in meters, package weight, and transportation method.
380
660
  # Creates a shipping estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters.
381
661
  # @param create_shipping_estimate_request [CreateShippingEstimateRequest]
@@ -28,19 +28,18 @@ module Patch
28
28
  @api_client = api_client
29
29
  end
30
30
  # Cancel an order
31
- # Cancelling an order removes the associated offset allocation from an order. You will not be charged for cancelled orders. Only orders in the `draft` or `placed` state can be cancelled.
32
- # @param id [String]
31
+ # Cancelling an order removes the associated offset allocation from an order. You will not be charged for cancelled orders. Only orders in the `draft` or `placed` state can be cancelled.
32
+ # @param id [String]
33
33
  # @param [Hash] opts the optional parameters
34
34
  # @return [OrderResponse]
35
35
  def cancel_order(id, opts = {})
36
-
37
36
  data, _status_code, _headers = cancel_order_with_http_info(id, opts)
38
37
  data
39
38
  end
40
39
 
41
40
  # Cancel an order
42
- # Cancelling an order removes the associated offset allocation from an order. You will not be charged for cancelled orders. Only orders in the &#x60;draft&#x60; or &#x60;placed&#x60; state can be cancelled.
43
- # @param id [String]
41
+ # Cancelling an order removes the associated offset allocation from an order. You will not be charged for cancelled orders. Only orders in the &#x60;draft&#x60; or &#x60;placed&#x60; state can be cancelled.
42
+ # @param id [String]
44
43
  # @param [Hash] opts the optional parameters
45
44
  # @return [Array<(OrderResponse, Integer, Hash)>] OrderResponse data, response status code and response headers
46
45
  def cancel_order_with_http_info(id, opts = {})
@@ -92,19 +91,19 @@ module Patch
92
91
  end
93
92
 
94
93
  # Creates an order
95
- # Creates an order in the `placed` or `draft` state.
96
- # @param create_order_request [CreateOrderRequest]
94
+ # Creates an order in the `placed` or `draft` state.
95
+ # @param create_order_request [CreateOrderRequest]
97
96
  # @param [Hash] opts the optional parameters
98
97
  # @return [OrderResponse]
99
98
  def create_order(create_order_request = {}, opts = {})
100
- _create_order_request = Patch::CreateOrderRequest.new(create_order_request)
99
+ _create_order_request = Patch::CreateOrderRequest.new(create_order_request)
101
100
  data, _status_code, _headers = create_order_with_http_info(_create_order_request, opts)
102
101
  data
103
102
  end
104
103
 
105
104
  # Creates an order
106
- # Creates an order in the &#x60;placed&#x60; or &#x60;draft&#x60; state.
107
- # @param create_order_request [CreateOrderRequest]
105
+ # Creates an order in the &#x60;placed&#x60; or &#x60;draft&#x60; state.
106
+ # @param create_order_request [CreateOrderRequest]
108
107
  # @param [Hash] opts the optional parameters
109
108
  # @return [Array<(OrderResponse, Integer, Hash)>] OrderResponse data, response status code and response headers
110
109
  def create_order_with_http_info(create_order_request, opts = {})
@@ -161,20 +160,23 @@ module Patch
161
160
  end
162
161
 
163
162
  # Place an order
164
- # Placing an order confirms an order's allocation of offsets. Only orders that are in the `draft` state can be placed
165
- # @param id [String]
163
+ # Placing an order confirms an order's allocation of offsets. Only orders that are in the `draft` state can be placed
164
+ # @param id [String]
166
165
  # @param [Hash] opts the optional parameters
166
+ # @option opts [PlaceOrderRequest] :place_order_request
167
167
  # @return [OrderResponse]
168
- def place_order(id, opts = {})
169
-
170
- data, _status_code, _headers = place_order_with_http_info(id, opts)
168
+ def place_order(order_id, opts = {})
169
+ place_order_request = Patch::PlaceOrderRequest.new(opts)
170
+ opts[:place_order_request] = place_order_request
171
+ data, _status_code, _headers = place_order_with_http_info(order_id, opts)
171
172
  data
172
173
  end
173
174
 
174
175
  # Place an order
175
- # Placing an order confirms an order&#39;s allocation of offsets. Only orders that are in the &#x60;draft&#x60; state can be placed
176
- # @param id [String]
176
+ # Placing an order confirms an order&#39;s allocation of offsets. Only orders that are in the &#x60;draft&#x60; state can be placed
177
+ # @param id [String]
177
178
  # @param [Hash] opts the optional parameters
179
+ # @option opts [PlaceOrderRequest] :place_order_request
178
180
  # @return [Array<(OrderResponse, Integer, Hash)>] OrderResponse data, response status code and response headers
179
181
  def place_order_with_http_info(id, opts = {})
180
182
  if @api_client.config.debugging
@@ -194,12 +196,17 @@ module Patch
194
196
  header_params = opts[:header_params] || {}
195
197
  # HTTP header 'Accept' (if needed)
196
198
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
199
+ # HTTP header 'Content-Type'
200
+ content_type = @api_client.select_header_content_type(['application/json'])
201
+ if !content_type.nil?
202
+ header_params['Content-Type'] = content_type
203
+ end
197
204
 
198
205
  # form parameters
199
206
  form_params = opts[:form_params] || {}
200
207
 
201
208
  # http body (model)
202
- post_body = opts[:debug_body]
209
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'place_order_request'])
203
210
 
204
211
  # return_type
205
212
  return_type = opts[:debug_return_type] || 'OrderResponse'
@@ -225,19 +232,18 @@ module Patch
225
232
  end
226
233
 
227
234
  # Retrieves an order
228
- # Retrieves a given order and its allocation offsets or negative emissions. You can only retrieve orders associated with the organization you are querying for.
229
- # @param id [String]
235
+ # Retrieves a given order and its allocation offsets or negative emissions. You can only retrieve orders associated with the organization you are querying for.
236
+ # @param id [String]
230
237
  # @param [Hash] opts the optional parameters
231
238
  # @return [OrderResponse]
232
239
  def retrieve_order(id, opts = {})
233
-
234
240
  data, _status_code, _headers = retrieve_order_with_http_info(id, opts)
235
241
  data
236
242
  end
237
243
 
238
244
  # Retrieves an order
239
- # Retrieves a given order and its allocation offsets or negative emissions. You can only retrieve orders associated with the organization you are querying for.
240
- # @param id [String]
245
+ # Retrieves a given order and its allocation offsets or negative emissions. You can only retrieve orders associated with the organization you are querying for.
246
+ # @param id [String]
241
247
  # @param [Hash] opts the optional parameters
242
248
  # @return [Array<(OrderResponse, Integer, Hash)>] OrderResponse data, response status code and response headers
243
249
  def retrieve_order_with_http_info(id, opts = {})
@@ -289,26 +295,25 @@ module Patch
289
295
  end
290
296
 
291
297
  # Retrieves a list of orders
292
- # Retrieves a list of orders and its allocation offsets or negative emissions. You can only retrieve orders associated with the organization you are querying for.
298
+ # Retrieves a list of orders and its allocation offsets or negative emissions. You can only retrieve orders associated with the organization you are querying for.
293
299
  # @param [Hash] opts the optional parameters
294
- # @option opts [Integer] :page
295
- # @option opts [String] :metadata
296
- # @option opts [String] :metadata_example1
297
- # @option opts [String] :metadata_example2
300
+ # @option opts [Integer] :page
301
+ # @option opts [String] :metadata
302
+ # @option opts [String] :metadata_example1
303
+ # @option opts [String] :metadata_example2
298
304
  # @return [OrderListResponse]
299
305
  def retrieve_orders(opts = {})
300
-
301
306
  data, _status_code, _headers = retrieve_orders_with_http_info(opts)
302
307
  data
303
308
  end
304
309
 
305
310
  # Retrieves a list of orders
306
- # Retrieves a list of orders and its allocation offsets or negative emissions. You can only retrieve orders associated with the organization you are querying for.
311
+ # Retrieves a list of orders and its allocation offsets or negative emissions. You can only retrieve orders associated with the organization you are querying for.
307
312
  # @param [Hash] opts the optional parameters
308
- # @option opts [Integer] :page
309
- # @option opts [String] :metadata
310
- # @option opts [String] :metadata_example1
311
- # @option opts [String] :metadata_example2
313
+ # @option opts [Integer] :page
314
+ # @option opts [String] :metadata
315
+ # @option opts [String] :metadata_example1
316
+ # @option opts [String] :metadata_example2
312
317
  # @return [Array<(OrderListResponse, Integer, Hash)>] OrderListResponse data, response status code and response headers
313
318
  def retrieve_orders_with_http_info(opts = {})
314
319
  if @api_client.config.debugging
@@ -28,6 +28,7 @@ module Patch
28
28
  # Retrieves a project available on Patch's platform.
29
29
  # @param id [String]
30
30
  # @param [Hash] opts the optional parameters
31
+ # @option opts [String] :accept_language
31
32
  # @return [ProjectResponse]
32
33
  def retrieve_project(id, opts = {})
33
34
 
@@ -39,6 +40,7 @@ module Patch
39
40
  # Retrieves a project available on Patch&#39;s platform.
40
41
  # @param id [String]
41
42
  # @param [Hash] opts the optional parameters
43
+ # @option opts [String] :accept_language
42
44
  # @return [Array<(ProjectResponse, Integer, Hash)>] ProjectResponse data, response status code and response headers
43
45
  def retrieve_project_with_http_info(id, opts = {})
44
46
  if @api_client.config.debugging
@@ -58,6 +60,7 @@ module Patch
58
60
  header_params = opts[:header_params] || {}
59
61
  # HTTP header 'Accept' (if needed)
60
62
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
63
+ header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?
61
64
 
62
65
  # form parameters
63
66
  form_params = opts[:form_params] || {}
@@ -95,6 +98,7 @@ module Patch
95
98
  # @option opts [String] :country
96
99
  # @option opts [String] :type
97
100
  # @option opts [Integer] :minimum_available_mass
101
+ # @option opts [String] :accept_language
98
102
  # @return [ProjectListResponse]
99
103
  def retrieve_projects(opts = {})
100
104
 
@@ -109,6 +113,7 @@ module Patch
109
113
  # @option opts [String] :country
110
114
  # @option opts [String] :type
111
115
  # @option opts [Integer] :minimum_available_mass
116
+ # @option opts [String] :accept_language
112
117
  # @return [Array<(ProjectListResponse, Integer, Hash)>] ProjectListResponse data, response status code and response headers
113
118
  def retrieve_projects_with_http_info(opts = {})
114
119
  if @api_client.config.debugging
@@ -128,6 +133,7 @@ module Patch
128
133
  header_params = opts[:header_params] || {}
129
134
  # HTTP header 'Accept' (if needed)
130
135
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
136
+ header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?
131
137
 
132
138
  # form parameters
133
139
  form_params = opts[:form_params] || {}
@@ -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.21.0"
34
+ @user_agent = "patch-ruby/1.24.0"
35
35
  @default_headers = {
36
36
  'Content-Type' => 'application/json',
37
37
  'User-Agent' => @user_agent
@@ -18,7 +18,7 @@ module Patch
18
18
  # A unique uid for the record. UIDs will be prepended by all_prod or all_test depending on the mode it was created in.
19
19
  attr_accessor :id
20
20
 
21
- # A boolean indicating if this project is a production or test mode project.
21
+ # A boolean indicating if this project is a production or demo mode project.
22
22
  attr_accessor :production
23
23
 
24
24
  # The amount (in grams) of allocated carbon offsets.