Reference documentation and code samples for the Cloud Commerce Consumer Procurement V1 API class Google::Cloud::Commerce::Consumer::Procurement::V1::ConsumerProcurementService::Client.
Client for the ConsumerProcurementService service.
ConsumerProcurementService allows customers to make purchases of products served by the Cloud Commerce platform.
When purchases are made, the ConsumerProcurementService programs the appropriate backends, including both Google's own infrastructure, as well as third-party systems, and to enable billing setup for charging for the procured item.
Inherits
- Object
Methods
.configure
def self.configure() { |config| ... } -> Client::Configuration
Configure the ConsumerProcurementService Client class.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
# Modify the configuration for all ConsumerProcurementService clients ::Google::Cloud::Commerce::Consumer::Procurement::V1::ConsumerProcurementService::Client.configure do |config| config.timeout = 10.0 end
#cancel_order
def cancel_order(request, options = nil) -> ::Gapic::Operation
def cancel_order(name: nil, etag: nil, cancellation_policy: nil) -> ::Gapic::Operation
Cancels an existing Order. Every product procured in the Order will be cancelled.
def cancel_order(request, options = nil) -> ::Gapic::Operation
cancel_order
via a request object, either of type
Google::Cloud::Commerce::Consumer::Procurement::V1::CancelOrderRequest or an equivalent Hash.
- request (::Google::Cloud::Commerce::Consumer::Procurement::V1::CancelOrderRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def cancel_order(name: nil, etag: nil, cancellation_policy: nil) -> ::Gapic::Operation
cancel_order
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- name (::String) — Required. The resource name of the order.
- etag (::String) — Optional. The weak etag, which can be optionally populated, of the order that this cancel request is based on. Validation checking will only happen if the invoker supplies this field.
- cancellation_policy (::Google::Cloud::Commerce::Consumer::Procurement::V1::CancelOrderRequest::CancellationPolicy) — Optional. Cancellation policy of this request.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::Operation)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/commerce/consumer/procurement/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Commerce::Consumer::Procurement::V1::ConsumerProcurementService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Commerce::Consumer::Procurement::V1::CancelOrderRequest.new # Call the cancel_order method. result = client.cancel_order request # The returned object is of type Gapic::Operation. You can use it to # check the status of an operation, cancel it, or wait for results. # Here is how to wait for a response. result.wait_until_done! timeout: 60 if result.response? p result.response else puts "No response received." end
#configure
def configure() { |config| ... } -> Client::Configuration
Configure the ConsumerProcurementService Client instance.
The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
#get_order
def get_order(request, options = nil) -> ::Google::Cloud::Commerce::Consumer::Procurement::V1::Order
def get_order(name: nil) -> ::Google::Cloud::Commerce::Consumer::Procurement::V1::Order
Returns the requested Order resource.
def get_order(request, options = nil) -> ::Google::Cloud::Commerce::Consumer::Procurement::V1::Order
get_order
via a request object, either of type
GetOrderRequest or an equivalent Hash.
- request (::Google::Cloud::Commerce::Consumer::Procurement::V1::GetOrderRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_order(name: nil) -> ::Google::Cloud::Commerce::Consumer::Procurement::V1::Order
get_order
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- name (::String) — Required. The name of the order to retrieve.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Commerce::Consumer::Procurement::V1::Order)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/commerce/consumer/procurement/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Commerce::Consumer::Procurement::V1::ConsumerProcurementService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Commerce::Consumer::Procurement::V1::GetOrderRequest.new # Call the get_order method. result = client.get_order request # The returned object is of type Google::Cloud::Commerce::Consumer::Procurement::V1::Order. p result
#initialize
def initialize() { |config| ... } -> Client
Create a new ConsumerProcurementService client object.
- (config) — Configure the ConsumerProcurementService client.
- config (Client::Configuration)
- (Client) — a new instance of Client
# Create a client using the default configuration client = ::Google::Cloud::Commerce::Consumer::Procurement::V1::ConsumerProcurementService::Client.new # Create a client using a custom configuration client = ::Google::Cloud::Commerce::Consumer::Procurement::V1::ConsumerProcurementService::Client.new do |config| config.timeout = 10.0 end
#list_orders
def list_orders(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Commerce::Consumer::Procurement::V1::Order>
def list_orders(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Commerce::Consumer::Procurement::V1::Order>
Lists Order resources that the user has access to, within the scope of the parent resource.
def list_orders(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Commerce::Consumer::Procurement::V1::Order>
list_orders
via a request object, either of type
ListOrdersRequest or an equivalent Hash.
- request (::Google::Cloud::Commerce::Consumer::Procurement::V1::ListOrdersRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_orders(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Commerce::Consumer::Procurement::V1::Order>
list_orders
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. The parent resource to query for orders.
This field has the form
billingAccounts/{billing-account-id}
. - page_size (::Integer) — The maximum number of entries requested. The default page size is 25 and the maximum page size is 200.
- page_token (::String) — The token for fetching the next page.
-
filter (::String) — Filter that you can use to limit the list request.
A query string that can match a selected set of attributes with string values. For example,
display_name=abc
. Supported query attributes aredisplay_name
If the query contains special characters other than letters, underscore, or digits, the phrase must be quoted with double quotes. For example,
display_name="foo:bar"
, where the display name needs to be quoted because it contains special character colon.Queries can be combined with
OR
, andNOT
to form more complex queries. You can also group them to force a desired evaluation order. For example,display_name=abc OR display_name=def
.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::PagedEnumerable<::Google::Cloud::Commerce::Consumer::Procurement::V1::Order>)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::PagedEnumerable<::Google::Cloud::Commerce::Consumer::Procurement::V1::Order>)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/commerce/consumer/procurement/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Commerce::Consumer::Procurement::V1::ConsumerProcurementService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Commerce::Consumer::Procurement::V1::ListOrdersRequest.new # Call the list_orders method. result = client.list_orders request # The returned object is of type Gapic::PagedEnumerable. You can iterate # over elements, and API calls will be issued to fetch pages as needed. result.each do |item| # Each element is of type ::Google::Cloud::Commerce::Consumer::Procurement::V1::Order. p item end
#logger
def logger() -> Logger
The logger used for request/response debug logging.
- (Logger)
#modify_order
def modify_order(request, options = nil) -> ::Gapic::Operation
def modify_order(name: nil, modifications: nil, display_name: nil, etag: nil) -> ::Gapic::Operation
Modifies an existing Order resource.
def modify_order(request, options = nil) -> ::Gapic::Operation
modify_order
via a request object, either of type
ModifyOrderRequest or an equivalent Hash.
- request (::Google::Cloud::Commerce::Consumer::Procurement::V1::ModifyOrderRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def modify_order(name: nil, modifications: nil, display_name: nil, etag: nil) -> ::Gapic::Operation
modify_order
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- name (::String) — Required. Name of the order to update.
- modifications (::Array<::Google::Cloud::Commerce::Consumer::Procurement::V1::ModifyOrderRequest::Modification, ::Hash>) — Optional. Modifications for an existing Order created by an Offer. Required when Offer based Order is being modified, except for when going from an offer to a public plan.
- display_name (::String) — Optional. Updated display name of the order, leave as empty if you do not want to update current display name.
- etag (::String) — Optional. The weak etag, which can be optionally populated, of the order that this modify request is based on. Validation checking will only happen if the invoker supplies this field.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::Operation)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/commerce/consumer/procurement/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Commerce::Consumer::Procurement::V1::ConsumerProcurementService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Commerce::Consumer::Procurement::V1::ModifyOrderRequest.new # Call the modify_order method. result = client.modify_order request # The returned object is of type Gapic::Operation. You can use it to # check the status of an operation, cancel it, or wait for results. # Here is how to wait for a response. result.wait_until_done! timeout: 60 if result.response? p result.response else puts "No response received." end
#operations_client
def operations_client() -> ::Google::Cloud::Commerce::Consumer::Procurement::V1::ConsumerProcurementService::Operations
Get the associated client for long-running operations.
#place_order
def place_order(request, options = nil) -> ::Gapic::Operation
def place_order(parent: nil, display_name: nil, line_item_info: nil, request_id: nil) -> ::Gapic::Operation
Creates a new Order.
This API only supports GCP spend-based committed use discounts specified by GCP documentation.
The returned long-running operation is in-progress until the backend completes the creation of the resource. Once completed, the order is in [OrderState.ORDER_STATE_ACTIVE][google.cloud.commerce.consumer.procurement.v1.OrderState.ORDER_STATE_ACTIVE]. In case of failure, the order resource will be removed.
def place_order(request, options = nil) -> ::Gapic::Operation
place_order
via a request object, either of type
PlaceOrderRequest or an equivalent Hash.
- request (::Google::Cloud::Commerce::Consumer::Procurement::V1::PlaceOrderRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def place_order(parent: nil, display_name: nil, line_item_info: nil, request_id: nil) -> ::Gapic::Operation
place_order
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. The resource name of the parent resource.
This field has the form
billingAccounts/{billing-account-id}
. - display_name (::String) — Required. The user-specified name of the order being placed.
- line_item_info (::Array<::Google::Cloud::Commerce::Consumer::Procurement::V1::LineItemInfo, ::Hash>) — Optional. Places order for offer. Required when an offer-based order is being placed.
-
request_id (::String) — Optional. A unique identifier for this request.
The server will ignore subsequent requests that provide a duplicate request
ID for at least 24 hours after the first request.
The request ID must be a valid UUID.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::Operation)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/commerce/consumer/procurement/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Commerce::Consumer::Procurement::V1::ConsumerProcurementService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Commerce::Consumer::Procurement::V1::PlaceOrderRequest.new # Call the place_order method. result = client.place_order request # The returned object is of type Gapic::Operation. You can use it to # check the status of an operation, cancel it, or wait for results. # Here is how to wait for a response. result.wait_until_done! timeout: 60 if result.response? p result.response else puts "No response received." end
#universe_domain
def universe_domain() -> String
The effective universe domain
- (String)