google-cloud-commerce-consumer-procurement-v1 1.0.2 → 1.1.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.
Files changed (25) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +4 -4
  3. data/README.md +3 -3
  4. data/lib/google/cloud/commerce/consumer/procurement/v1/consumer_procurement_service/client.rb +224 -1
  5. data/lib/google/cloud/commerce/consumer/procurement/v1/consumer_procurement_service/rest/client.rb +210 -1
  6. data/lib/google/cloud/commerce/consumer/procurement/v1/consumer_procurement_service/rest/service_stub.rb +120 -0
  7. data/lib/google/cloud/commerce/consumer/procurement/v1/license_management_service/client.rb +825 -0
  8. data/lib/google/cloud/commerce/consumer/procurement/v1/license_management_service/credentials.rb +51 -0
  9. data/lib/google/cloud/commerce/consumer/procurement/v1/license_management_service/paths.rb +54 -0
  10. data/lib/google/cloud/commerce/consumer/procurement/v1/license_management_service/rest/client.rb +764 -0
  11. data/lib/google/cloud/commerce/consumer/procurement/v1/license_management_service/rest/service_stub.rb +371 -0
  12. data/lib/google/cloud/commerce/consumer/procurement/v1/license_management_service/rest.rb +56 -0
  13. data/lib/google/cloud/commerce/consumer/procurement/v1/license_management_service.rb +59 -0
  14. data/lib/google/cloud/commerce/consumer/procurement/v1/license_management_service_pb.rb +69 -0
  15. data/lib/google/cloud/commerce/consumer/procurement/v1/license_management_service_services_pb.rb +57 -0
  16. data/lib/google/cloud/commerce/consumer/procurement/v1/procurement_service_pb.rb +8 -1
  17. data/lib/google/cloud/commerce/consumer/procurement/v1/procurement_service_services_pb.rb +7 -0
  18. data/lib/google/cloud/commerce/consumer/procurement/v1/rest.rb +2 -1
  19. data/lib/google/cloud/commerce/consumer/procurement/v1/version.rb +1 -1
  20. data/lib/google/cloud/commerce/consumer/procurement/v1.rb +3 -2
  21. data/proto_docs/google/cloud/commerce/consumer/procurement/v1/license_management_service.rb +196 -0
  22. data/proto_docs/google/cloud/commerce/consumer/procurement/v1/order.rb +14 -10
  23. data/proto_docs/google/cloud/commerce/consumer/procurement/v1/procurement_service.rb +115 -1
  24. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  25. metadata +14 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eac76ca752a4942078ee88427f4e2abedf555e33679390daf05d3f760d132a6f
4
- data.tar.gz: ba67ec31b246c81ad2971d77070632c0c594029ba06b48047b04c119a648fc44
3
+ metadata.gz: b2806abd56a36390df505d86defccf6b54ed0ad8144ff2347e322e10f135b9c0
4
+ data.tar.gz: 7156f9718cd3e2ec371bd9ce504d66493286fed9287fac6e0c92e809ca7b9d15
5
5
  SHA512:
6
- metadata.gz: d0e07d91691dbc4e1e93058f136171d211f0fb3050597e9de68244fe6573fc511c1a2acf0fddb7fd4e698b2e18b3893e04c0825c18bfc6eb46ff8eedc7005c47
7
- data.tar.gz: fad99168574ecb4759b5271ad674245631a2b791bb02a1d31c5d5e499b33598a8ef2f69e678e90fb9ec172723b3c67ede8f804a585eb853dfb7b655556f26c29
6
+ metadata.gz: 0ec31da46c87b52c6f07b4d317332c49d3f76e400165657427f58be30566186cb5a0ab0b9813673fee1223346c8f286e01759755283276f6d274bb77e5b3ef0d
7
+ data.tar.gz: '0463719766cd010a8618cac5b3389224d664b80d8e9e0a7af15fe0613b7d30abc8f5939d6a4d750f09f5cbbddab0ff2a77d54e5c85085ef25063b0ccab8107d9'
data/AUTHENTICATION.md CHANGED
@@ -56,7 +56,7 @@ To configure a credentials file for an individual client initialization:
56
56
  ```ruby
57
57
  require "google/cloud/commerce/consumer/procurement/v1"
58
58
 
59
- client = ::Google::Cloud::Commerce::Consumer::Procurement::V1::ConsumerProcurementService::Client.new do |config|
59
+ client = ::Google::Cloud::Commerce::Consumer::Procurement::V1::LicenseManagementService::Client.new do |config|
60
60
  config.credentials = "path/to/credentialfile.json"
61
61
  end
62
62
  ```
@@ -66,11 +66,11 @@ To configure a credentials file globally for all clients:
66
66
  ```ruby
67
67
  require "google/cloud/commerce/consumer/procurement/v1"
68
68
 
69
- ::Google::Cloud::Commerce::Consumer::Procurement::V1::ConsumerProcurementService::Client.configure do |config|
69
+ ::Google::Cloud::Commerce::Consumer::Procurement::V1::LicenseManagementService::Client.configure do |config|
70
70
  config.credentials = "path/to/credentialfile.json"
71
71
  end
72
72
 
73
- client = ::Google::Cloud::Commerce::Consumer::Procurement::V1::ConsumerProcurementService::Client.new
73
+ client = ::Google::Cloud::Commerce::Consumer::Procurement::V1::LicenseManagementService::Client.new
74
74
  ```
75
75
 
76
76
  ### Environment Variables
@@ -100,7 +100,7 @@ require "google/cloud/commerce/consumer/procurement/v1"
100
100
 
101
101
  ENV["GOOGLE_APPLICATION_CREDENTIALS"] = "path/to/credentialfile.json"
102
102
 
103
- client = ::Google::Cloud::Commerce::Consumer::Procurement::V1::ConsumerProcurementService::Client.new
103
+ client = ::Google::Cloud::Commerce::Consumer::Procurement::V1::LicenseManagementService::Client.new
104
104
  ```
105
105
 
106
106
  ### Local ADC file
data/README.md CHANGED
@@ -31,9 +31,9 @@ In order to use this library, you first need to go through the following steps:
31
31
  ```ruby
32
32
  require "google/cloud/commerce/consumer/procurement/v1"
33
33
 
34
- client = ::Google::Cloud::Commerce::Consumer::Procurement::V1::ConsumerProcurementService::Client.new
35
- request = ::Google::Cloud::Commerce::Consumer::Procurement::V1::PlaceOrderRequest.new # (request fields as keyword arguments...)
36
- response = client.place_order request
34
+ client = ::Google::Cloud::Commerce::Consumer::Procurement::V1::LicenseManagementService::Client.new
35
+ request = ::Google::Cloud::Commerce::Consumer::Procurement::V1::GetLicensePoolRequest.new # (request fields as keyword arguments...)
36
+ response = client.get_license_pool request
37
37
  ```
38
38
 
39
39
  View the [Client Library Documentation](https://cloud.google.com/ruby/docs/reference/google-cloud-commerce-consumer-procurement-v1/latest)
@@ -237,7 +237,7 @@ module Google
237
237
  # @param request_id [::String]
238
238
  # Optional. A unique identifier for this request.
239
239
  # The server will ignore subsequent requests that provide a duplicate request
240
- # ID for at least 120 minutes after the first request.
240
+ # ID for at least 24 hours after the first request.
241
241
  #
242
242
  # The request ID must be a valid
243
243
  # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format).
@@ -439,6 +439,7 @@ module Google
439
439
  #
440
440
  # * `display_name`
441
441
  #
442
+ #
442
443
  # If the query contains special characters other than letters,
443
444
  # underscore, or digits, the phrase must be quoted with double quotes. For
444
445
  # example, `display_name="foo:bar"`, where the display name needs to be
@@ -518,6 +519,214 @@ module Google
518
519
  raise ::Google::Cloud::Error.from_error(e)
519
520
  end
520
521
 
522
+ ##
523
+ # Modifies an existing
524
+ # {::Google::Cloud::Commerce::Consumer::Procurement::V1::Order Order} resource.
525
+ #
526
+ # @overload modify_order(request, options = nil)
527
+ # Pass arguments to `modify_order` via a request object, either of type
528
+ # {::Google::Cloud::Commerce::Consumer::Procurement::V1::ModifyOrderRequest} or an equivalent Hash.
529
+ #
530
+ # @param request [::Google::Cloud::Commerce::Consumer::Procurement::V1::ModifyOrderRequest, ::Hash]
531
+ # A request object representing the call parameters. Required. To specify no
532
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
533
+ # @param options [::Gapic::CallOptions, ::Hash]
534
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
535
+ #
536
+ # @overload modify_order(name: nil, modifications: nil, display_name: nil, etag: nil)
537
+ # Pass arguments to `modify_order` via keyword arguments. Note that at
538
+ # least one keyword argument is required. To specify no parameters, or to keep all
539
+ # the default parameter values, pass an empty Hash as a request object (see above).
540
+ #
541
+ # @param name [::String]
542
+ # Required. Name of the order to update.
543
+ # @param modifications [::Array<::Google::Cloud::Commerce::Consumer::Procurement::V1::ModifyOrderRequest::Modification, ::Hash>]
544
+ # Optional. Modifications for an existing Order created by an Offer.
545
+ # Required when Offer based Order is being modified, except for when going
546
+ # from an offer to a public plan.
547
+ # @param display_name [::String]
548
+ # Optional. Updated display name of the order, leave as empty if you do not
549
+ # want to update current display name.
550
+ # @param etag [::String]
551
+ # Optional. The weak etag, which can be optionally populated, of the order
552
+ # that this modify request is based on. Validation checking will only happen
553
+ # if the invoker supplies this field.
554
+ #
555
+ # @yield [response, operation] Access the result along with the RPC operation
556
+ # @yieldparam response [::Gapic::Operation]
557
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
558
+ #
559
+ # @return [::Gapic::Operation]
560
+ #
561
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
562
+ #
563
+ # @example Basic example
564
+ # require "google/cloud/commerce/consumer/procurement/v1"
565
+ #
566
+ # # Create a client object. The client can be reused for multiple calls.
567
+ # client = Google::Cloud::Commerce::Consumer::Procurement::V1::ConsumerProcurementService::Client.new
568
+ #
569
+ # # Create a request. To set request fields, pass in keyword arguments.
570
+ # request = Google::Cloud::Commerce::Consumer::Procurement::V1::ModifyOrderRequest.new
571
+ #
572
+ # # Call the modify_order method.
573
+ # result = client.modify_order request
574
+ #
575
+ # # The returned object is of type Gapic::Operation. You can use it to
576
+ # # check the status of an operation, cancel it, or wait for results.
577
+ # # Here is how to wait for a response.
578
+ # result.wait_until_done! timeout: 60
579
+ # if result.response?
580
+ # p result.response
581
+ # else
582
+ # puts "No response received."
583
+ # end
584
+ #
585
+ def modify_order request, options = nil
586
+ raise ::ArgumentError, "request must be provided" if request.nil?
587
+
588
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Commerce::Consumer::Procurement::V1::ModifyOrderRequest
589
+
590
+ # Converts hash and nil to an options object
591
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
592
+
593
+ # Customize the options with defaults
594
+ metadata = @config.rpcs.modify_order.metadata.to_h
595
+
596
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
597
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
598
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
599
+ gapic_version: ::Google::Cloud::Commerce::Consumer::Procurement::V1::VERSION
600
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
601
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
602
+
603
+ header_params = {}
604
+ if request.name
605
+ header_params["name"] = request.name
606
+ end
607
+
608
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
609
+ metadata[:"x-goog-request-params"] ||= request_params_header
610
+
611
+ options.apply_defaults timeout: @config.rpcs.modify_order.timeout,
612
+ metadata: metadata,
613
+ retry_policy: @config.rpcs.modify_order.retry_policy
614
+
615
+ options.apply_defaults timeout: @config.timeout,
616
+ metadata: @config.metadata,
617
+ retry_policy: @config.retry_policy
618
+
619
+ @consumer_procurement_service_stub.call_rpc :modify_order, request, options: options do |response, operation|
620
+ response = ::Gapic::Operation.new response, @operations_client, options: options
621
+ yield response, operation if block_given?
622
+ return response
623
+ end
624
+ rescue ::GRPC::BadStatus => e
625
+ raise ::Google::Cloud::Error.from_error(e)
626
+ end
627
+
628
+ ##
629
+ # Cancels an existing
630
+ # {::Google::Cloud::Commerce::Consumer::Procurement::V1::Order Order}. Every product
631
+ # procured in the Order will be cancelled.
632
+ #
633
+ # @overload cancel_order(request, options = nil)
634
+ # Pass arguments to `cancel_order` via a request object, either of type
635
+ # {::Google::Cloud::Commerce::Consumer::Procurement::V1::CancelOrderRequest} or an equivalent Hash.
636
+ #
637
+ # @param request [::Google::Cloud::Commerce::Consumer::Procurement::V1::CancelOrderRequest, ::Hash]
638
+ # A request object representing the call parameters. Required. To specify no
639
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
640
+ # @param options [::Gapic::CallOptions, ::Hash]
641
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
642
+ #
643
+ # @overload cancel_order(name: nil, etag: nil, cancellation_policy: nil)
644
+ # Pass arguments to `cancel_order` via keyword arguments. Note that at
645
+ # least one keyword argument is required. To specify no parameters, or to keep all
646
+ # the default parameter values, pass an empty Hash as a request object (see above).
647
+ #
648
+ # @param name [::String]
649
+ # Required. The resource name of the order.
650
+ # @param etag [::String]
651
+ # Optional. The weak etag, which can be optionally populated, of the order
652
+ # that this cancel request is based on. Validation checking will only happen
653
+ # if the invoker supplies this field.
654
+ # @param cancellation_policy [::Google::Cloud::Commerce::Consumer::Procurement::V1::CancelOrderRequest::CancellationPolicy]
655
+ # Optional. Cancellation policy of this request.
656
+ #
657
+ # @yield [response, operation] Access the result along with the RPC operation
658
+ # @yieldparam response [::Gapic::Operation]
659
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
660
+ #
661
+ # @return [::Gapic::Operation]
662
+ #
663
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
664
+ #
665
+ # @example Basic example
666
+ # require "google/cloud/commerce/consumer/procurement/v1"
667
+ #
668
+ # # Create a client object. The client can be reused for multiple calls.
669
+ # client = Google::Cloud::Commerce::Consumer::Procurement::V1::ConsumerProcurementService::Client.new
670
+ #
671
+ # # Create a request. To set request fields, pass in keyword arguments.
672
+ # request = Google::Cloud::Commerce::Consumer::Procurement::V1::CancelOrderRequest.new
673
+ #
674
+ # # Call the cancel_order method.
675
+ # result = client.cancel_order request
676
+ #
677
+ # # The returned object is of type Gapic::Operation. You can use it to
678
+ # # check the status of an operation, cancel it, or wait for results.
679
+ # # Here is how to wait for a response.
680
+ # result.wait_until_done! timeout: 60
681
+ # if result.response?
682
+ # p result.response
683
+ # else
684
+ # puts "No response received."
685
+ # end
686
+ #
687
+ def cancel_order request, options = nil
688
+ raise ::ArgumentError, "request must be provided" if request.nil?
689
+
690
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Commerce::Consumer::Procurement::V1::CancelOrderRequest
691
+
692
+ # Converts hash and nil to an options object
693
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
694
+
695
+ # Customize the options with defaults
696
+ metadata = @config.rpcs.cancel_order.metadata.to_h
697
+
698
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
699
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
700
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
701
+ gapic_version: ::Google::Cloud::Commerce::Consumer::Procurement::V1::VERSION
702
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
703
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
704
+
705
+ header_params = {}
706
+ if request.name
707
+ header_params["name"] = request.name
708
+ end
709
+
710
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
711
+ metadata[:"x-goog-request-params"] ||= request_params_header
712
+
713
+ options.apply_defaults timeout: @config.rpcs.cancel_order.timeout,
714
+ metadata: metadata,
715
+ retry_policy: @config.rpcs.cancel_order.retry_policy
716
+
717
+ options.apply_defaults timeout: @config.timeout,
718
+ metadata: @config.metadata,
719
+ retry_policy: @config.retry_policy
720
+
721
+ @consumer_procurement_service_stub.call_rpc :cancel_order, request, options: options do |response, operation|
722
+ response = ::Gapic::Operation.new response, @operations_client, options: options
723
+ yield response, operation if block_given?
724
+ return response
725
+ end
726
+ rescue ::GRPC::BadStatus => e
727
+ raise ::Google::Cloud::Error.from_error(e)
728
+ end
729
+
521
730
  ##
522
731
  # Configuration class for the ConsumerProcurementService API.
523
732
  #
@@ -686,6 +895,16 @@ module Google
686
895
  # @return [::Gapic::Config::Method]
687
896
  #
688
897
  attr_reader :list_orders
898
+ ##
899
+ # RPC-specific configuration for `modify_order`
900
+ # @return [::Gapic::Config::Method]
901
+ #
902
+ attr_reader :modify_order
903
+ ##
904
+ # RPC-specific configuration for `cancel_order`
905
+ # @return [::Gapic::Config::Method]
906
+ #
907
+ attr_reader :cancel_order
689
908
 
690
909
  # @private
691
910
  def initialize parent_rpcs = nil
@@ -695,6 +914,10 @@ module Google
695
914
  @get_order = ::Gapic::Config::Method.new get_order_config
696
915
  list_orders_config = parent_rpcs.list_orders if parent_rpcs.respond_to? :list_orders
697
916
  @list_orders = ::Gapic::Config::Method.new list_orders_config
917
+ modify_order_config = parent_rpcs.modify_order if parent_rpcs.respond_to? :modify_order
918
+ @modify_order = ::Gapic::Config::Method.new modify_order_config
919
+ cancel_order_config = parent_rpcs.cancel_order if parent_rpcs.respond_to? :cancel_order
920
+ @cancel_order = ::Gapic::Config::Method.new cancel_order_config
698
921
 
699
922
  yield self if block_given?
700
923
  end
@@ -230,7 +230,7 @@ module Google
230
230
  # @param request_id [::String]
231
231
  # Optional. A unique identifier for this request.
232
232
  # The server will ignore subsequent requests that provide a duplicate request
233
- # ID for at least 120 minutes after the first request.
233
+ # ID for at least 24 hours after the first request.
234
234
  #
235
235
  # The request ID must be a valid
236
236
  # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format).
@@ -418,6 +418,7 @@ module Google
418
418
  #
419
419
  # * `display_name`
420
420
  #
421
+ #
421
422
  # If the query contains special characters other than letters,
422
423
  # underscore, or digits, the phrase must be quoted with double quotes. For
423
424
  # example, `display_name="foo:bar"`, where the display name needs to be
@@ -490,6 +491,200 @@ module Google
490
491
  raise ::Google::Cloud::Error.from_error(e)
491
492
  end
492
493
 
494
+ ##
495
+ # Modifies an existing
496
+ # {::Google::Cloud::Commerce::Consumer::Procurement::V1::Order Order} resource.
497
+ #
498
+ # @overload modify_order(request, options = nil)
499
+ # Pass arguments to `modify_order` via a request object, either of type
500
+ # {::Google::Cloud::Commerce::Consumer::Procurement::V1::ModifyOrderRequest} or an equivalent Hash.
501
+ #
502
+ # @param request [::Google::Cloud::Commerce::Consumer::Procurement::V1::ModifyOrderRequest, ::Hash]
503
+ # A request object representing the call parameters. Required. To specify no
504
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
505
+ # @param options [::Gapic::CallOptions, ::Hash]
506
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
507
+ #
508
+ # @overload modify_order(name: nil, modifications: nil, display_name: nil, etag: nil)
509
+ # Pass arguments to `modify_order` via keyword arguments. Note that at
510
+ # least one keyword argument is required. To specify no parameters, or to keep all
511
+ # the default parameter values, pass an empty Hash as a request object (see above).
512
+ #
513
+ # @param name [::String]
514
+ # Required. Name of the order to update.
515
+ # @param modifications [::Array<::Google::Cloud::Commerce::Consumer::Procurement::V1::ModifyOrderRequest::Modification, ::Hash>]
516
+ # Optional. Modifications for an existing Order created by an Offer.
517
+ # Required when Offer based Order is being modified, except for when going
518
+ # from an offer to a public plan.
519
+ # @param display_name [::String]
520
+ # Optional. Updated display name of the order, leave as empty if you do not
521
+ # want to update current display name.
522
+ # @param etag [::String]
523
+ # Optional. The weak etag, which can be optionally populated, of the order
524
+ # that this modify request is based on. Validation checking will only happen
525
+ # if the invoker supplies this field.
526
+ # @yield [result, operation] Access the result along with the TransportOperation object
527
+ # @yieldparam result [::Gapic::Operation]
528
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
529
+ #
530
+ # @return [::Gapic::Operation]
531
+ #
532
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
533
+ #
534
+ # @example Basic example
535
+ # require "google/cloud/commerce/consumer/procurement/v1"
536
+ #
537
+ # # Create a client object. The client can be reused for multiple calls.
538
+ # client = Google::Cloud::Commerce::Consumer::Procurement::V1::ConsumerProcurementService::Rest::Client.new
539
+ #
540
+ # # Create a request. To set request fields, pass in keyword arguments.
541
+ # request = Google::Cloud::Commerce::Consumer::Procurement::V1::ModifyOrderRequest.new
542
+ #
543
+ # # Call the modify_order method.
544
+ # result = client.modify_order request
545
+ #
546
+ # # The returned object is of type Gapic::Operation. You can use it to
547
+ # # check the status of an operation, cancel it, or wait for results.
548
+ # # Here is how to wait for a response.
549
+ # result.wait_until_done! timeout: 60
550
+ # if result.response?
551
+ # p result.response
552
+ # else
553
+ # puts "No response received."
554
+ # end
555
+ #
556
+ def modify_order request, options = nil
557
+ raise ::ArgumentError, "request must be provided" if request.nil?
558
+
559
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Commerce::Consumer::Procurement::V1::ModifyOrderRequest
560
+
561
+ # Converts hash and nil to an options object
562
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
563
+
564
+ # Customize the options with defaults
565
+ call_metadata = @config.rpcs.modify_order.metadata.to_h
566
+
567
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
568
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
569
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
570
+ gapic_version: ::Google::Cloud::Commerce::Consumer::Procurement::V1::VERSION,
571
+ transports_version_send: [:rest]
572
+
573
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
574
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
575
+
576
+ options.apply_defaults timeout: @config.rpcs.modify_order.timeout,
577
+ metadata: call_metadata,
578
+ retry_policy: @config.rpcs.modify_order.retry_policy
579
+
580
+ options.apply_defaults timeout: @config.timeout,
581
+ metadata: @config.metadata,
582
+ retry_policy: @config.retry_policy
583
+
584
+ @consumer_procurement_service_stub.modify_order request, options do |result, operation|
585
+ result = ::Gapic::Operation.new result, @operations_client, options: options
586
+ yield result, operation if block_given?
587
+ return result
588
+ end
589
+ rescue ::Gapic::Rest::Error => e
590
+ raise ::Google::Cloud::Error.from_error(e)
591
+ end
592
+
593
+ ##
594
+ # Cancels an existing
595
+ # {::Google::Cloud::Commerce::Consumer::Procurement::V1::Order Order}. Every product
596
+ # procured in the Order will be cancelled.
597
+ #
598
+ # @overload cancel_order(request, options = nil)
599
+ # Pass arguments to `cancel_order` via a request object, either of type
600
+ # {::Google::Cloud::Commerce::Consumer::Procurement::V1::CancelOrderRequest} or an equivalent Hash.
601
+ #
602
+ # @param request [::Google::Cloud::Commerce::Consumer::Procurement::V1::CancelOrderRequest, ::Hash]
603
+ # A request object representing the call parameters. Required. To specify no
604
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
605
+ # @param options [::Gapic::CallOptions, ::Hash]
606
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
607
+ #
608
+ # @overload cancel_order(name: nil, etag: nil, cancellation_policy: nil)
609
+ # Pass arguments to `cancel_order` via keyword arguments. Note that at
610
+ # least one keyword argument is required. To specify no parameters, or to keep all
611
+ # the default parameter values, pass an empty Hash as a request object (see above).
612
+ #
613
+ # @param name [::String]
614
+ # Required. The resource name of the order.
615
+ # @param etag [::String]
616
+ # Optional. The weak etag, which can be optionally populated, of the order
617
+ # that this cancel request is based on. Validation checking will only happen
618
+ # if the invoker supplies this field.
619
+ # @param cancellation_policy [::Google::Cloud::Commerce::Consumer::Procurement::V1::CancelOrderRequest::CancellationPolicy]
620
+ # Optional. Cancellation policy of this request.
621
+ # @yield [result, operation] Access the result along with the TransportOperation object
622
+ # @yieldparam result [::Gapic::Operation]
623
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
624
+ #
625
+ # @return [::Gapic::Operation]
626
+ #
627
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
628
+ #
629
+ # @example Basic example
630
+ # require "google/cloud/commerce/consumer/procurement/v1"
631
+ #
632
+ # # Create a client object. The client can be reused for multiple calls.
633
+ # client = Google::Cloud::Commerce::Consumer::Procurement::V1::ConsumerProcurementService::Rest::Client.new
634
+ #
635
+ # # Create a request. To set request fields, pass in keyword arguments.
636
+ # request = Google::Cloud::Commerce::Consumer::Procurement::V1::CancelOrderRequest.new
637
+ #
638
+ # # Call the cancel_order method.
639
+ # result = client.cancel_order request
640
+ #
641
+ # # The returned object is of type Gapic::Operation. You can use it to
642
+ # # check the status of an operation, cancel it, or wait for results.
643
+ # # Here is how to wait for a response.
644
+ # result.wait_until_done! timeout: 60
645
+ # if result.response?
646
+ # p result.response
647
+ # else
648
+ # puts "No response received."
649
+ # end
650
+ #
651
+ def cancel_order request, options = nil
652
+ raise ::ArgumentError, "request must be provided" if request.nil?
653
+
654
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Commerce::Consumer::Procurement::V1::CancelOrderRequest
655
+
656
+ # Converts hash and nil to an options object
657
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
658
+
659
+ # Customize the options with defaults
660
+ call_metadata = @config.rpcs.cancel_order.metadata.to_h
661
+
662
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
663
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
664
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
665
+ gapic_version: ::Google::Cloud::Commerce::Consumer::Procurement::V1::VERSION,
666
+ transports_version_send: [:rest]
667
+
668
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
669
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
670
+
671
+ options.apply_defaults timeout: @config.rpcs.cancel_order.timeout,
672
+ metadata: call_metadata,
673
+ retry_policy: @config.rpcs.cancel_order.retry_policy
674
+
675
+ options.apply_defaults timeout: @config.timeout,
676
+ metadata: @config.metadata,
677
+ retry_policy: @config.retry_policy
678
+
679
+ @consumer_procurement_service_stub.cancel_order request, options do |result, operation|
680
+ result = ::Gapic::Operation.new result, @operations_client, options: options
681
+ yield result, operation if block_given?
682
+ return result
683
+ end
684
+ rescue ::Gapic::Rest::Error => e
685
+ raise ::Google::Cloud::Error.from_error(e)
686
+ end
687
+
493
688
  ##
494
689
  # Configuration class for the ConsumerProcurementService REST API.
495
690
  #
@@ -638,6 +833,16 @@ module Google
638
833
  # @return [::Gapic::Config::Method]
639
834
  #
640
835
  attr_reader :list_orders
836
+ ##
837
+ # RPC-specific configuration for `modify_order`
838
+ # @return [::Gapic::Config::Method]
839
+ #
840
+ attr_reader :modify_order
841
+ ##
842
+ # RPC-specific configuration for `cancel_order`
843
+ # @return [::Gapic::Config::Method]
844
+ #
845
+ attr_reader :cancel_order
641
846
 
642
847
  # @private
643
848
  def initialize parent_rpcs = nil
@@ -647,6 +852,10 @@ module Google
647
852
  @get_order = ::Gapic::Config::Method.new get_order_config
648
853
  list_orders_config = parent_rpcs.list_orders if parent_rpcs.respond_to? :list_orders
649
854
  @list_orders = ::Gapic::Config::Method.new list_orders_config
855
+ modify_order_config = parent_rpcs.modify_order if parent_rpcs.respond_to? :modify_order
856
+ @modify_order = ::Gapic::Config::Method.new modify_order_config
857
+ cancel_order_config = parent_rpcs.cancel_order if parent_rpcs.respond_to? :cancel_order
858
+ @cancel_order = ::Gapic::Config::Method.new cancel_order_config
650
859
 
651
860
  yield self if block_given?
652
861
  end