Universal Ledger V1 API - Class Google::Cloud::UniversalLedger::V1::UniversalLedger::Rest::Client (v0.1.0)

Reference documentation and code samples for the Universal Ledger V1 API class Google::Cloud::UniversalLedger::V1::UniversalLedger::Rest::Client.

REST client for the UniversalLedger service.

A service for interacting with the Google Cloud Universal Ledger. Endpoints are pre-created and managed by Google and cannot be modified by users. The names of available endpoints will be provided in the public documentation. An endpoint is a regional resource within a Universal Ledger network. Requests sent to an endpoint may be routed to different validators in the given network within the given region.

Inherits

  • Object

Methods

.configure

def self.configure() { |config| ... } -> Client::Configuration

Configure the UniversalLedger Client class.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all UniversalLedger clients
::Google::Cloud::UniversalLedger::V1::UniversalLedger::Rest::Client.configure do |config|
  config.timeout = 10.0
end

#configure

def configure() { |config| ... } -> Client::Configuration

Configure the UniversalLedger 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.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#get_endpoint

def get_endpoint(request, options = nil) -> ::Google::Cloud::UniversalLedger::V1::Endpoint
def get_endpoint(name: nil) -> ::Google::Cloud::UniversalLedger::V1::Endpoint

Gets the details of a specific endpoint.

Overloads
def get_endpoint(request, options = nil) -> ::Google::Cloud::UniversalLedger::V1::Endpoint
Pass arguments to get_endpoint via a request object, either of type GetEndpointRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::UniversalLedger::V1::GetEndpointRequest, ::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_endpoint(name: nil) -> ::Google::Cloud::UniversalLedger::V1::Endpoint
Pass arguments to get_endpoint 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).
Parameter
  • name (::String) — Required. The name of the endpoint to retrieve. Format: projects/{project}/locations/{location}/endpoints/{endpoint}
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/universal_ledger/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::UniversalLedger::V1::UniversalLedger::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::UniversalLedger::V1::GetEndpointRequest.new

# Call the get_endpoint method.
result = client.get_endpoint request

# The returned object is of type Google::Cloud::UniversalLedger::V1::Endpoint.
p result

#initialize

def initialize() { |config| ... } -> Client

Create a new UniversalLedger REST client object.

Yields
  • (config) — Configure the UniversalLedger client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client = ::Google::Cloud::UniversalLedger::V1::UniversalLedger::Rest::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::UniversalLedger::V1::UniversalLedger::Rest::Client.new do |config|
  config.timeout = 10.0
end

#list_endpoints

def list_endpoints(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::UniversalLedger::V1::Endpoint>
def list_endpoints(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::UniversalLedger::V1::Endpoint>

Lists all endpoints for a given project and location.

Overloads
def list_endpoints(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::UniversalLedger::V1::Endpoint>
Pass arguments to list_endpoints via a request object, either of type ListEndpointsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::UniversalLedger::V1::ListEndpointsRequest, ::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_endpoints(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::UniversalLedger::V1::Endpoint>
Pass arguments to list_endpoints 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).
Parameters
  • parent (::String) — Required. The parent, which owns this collection of endpoints. Format: projects/{project}/locations/{location}
  • page_size (::Integer) — Optional. The maximum number of endpoints to return. The service may return fewer than this value. If unspecified, at most 50 endpoints will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000.
  • page_token (::String) — Optional. A page token, received from a previous ListEndpoints call. Provide this to retrieve the subsequent page.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/universal_ledger/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::UniversalLedger::V1::UniversalLedger::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::UniversalLedger::V1::ListEndpointsRequest.new

# Call the list_endpoints method.
result = client.list_endpoints 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::UniversalLedger::V1::Endpoint.
  p item
end

#location_client

def location_client() -> Google::Cloud::Location::Locations::Rest::Client

Get the associated client for mix-in of the Locations.

Returns
  • (Google::Cloud::Location::Locations::Rest::Client)

#logger

def logger() -> Logger

The logger used for request/response debug logging.

Returns
  • (Logger)

#query_account

def query_account(request, options = nil) -> ::Google::Cloud::UniversalLedger::V1::QueryAccountResponse
def query_account(endpoint: nil, account_id: nil, round_id: nil) -> ::Google::Cloud::UniversalLedger::V1::QueryAccountResponse

Deprecated: Use the QueryData method instead. Queries all the information stored about an account in the network. The returned account details may vary between calls, because an endpoint may route requests to different validators within the network and region, and the validators may not be at the same round ID at any given time.

Overloads
def query_account(request, options = nil) -> ::Google::Cloud::UniversalLedger::V1::QueryAccountResponse
Pass arguments to query_account via a request object, either of type QueryAccountRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::UniversalLedger::V1::QueryAccountRequest, ::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 query_account(endpoint: nil, account_id: nil, round_id: nil) -> ::Google::Cloud::UniversalLedger::V1::QueryAccountResponse
Pass arguments to query_account 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).
Parameters
  • endpoint (::String) — Required. The endpoint to serve the request. Format: projects/{project}/locations/{location}/endpoints/{endpoint} The location is a region.
  • account_id (::String) — Required. The account ID to get information about. The value is limited to 60 characters.
  • round_id (::Integer) — Optional. The ID of the execution round (similar to block "height") at which to request data. The returned account information will be accurate for the world state at this execution round. If unspecified, uses the latest finalized round as known by the serving validator. The state at a given round ID is always consistent and canonical.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/universal_ledger/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::UniversalLedger::V1::UniversalLedger::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::UniversalLedger::V1::QueryAccountRequest.new

# Call the query_account method.
result = client.query_account request

# The returned object is of type Google::Cloud::UniversalLedger::V1::QueryAccountResponse.
p result

#query_data

def query_data(request, options = nil) -> ::Google::Cloud::UniversalLedger::V1::QueryDataResponse
def query_data(endpoint: nil, serialized_signed_query_request: nil) -> ::Google::Cloud::UniversalLedger::V1::QueryDataResponse

Queries the network for information stored on the ledger, such as accounts and transactions.

Access to certain sensitive fields, such as account balances, may be restricted based on the identity of the sender derived from the signature in the request. If the sender lacks permission, sensitive fields will be redacted from the response and reported in the redacted_fields field.

Overloads
def query_data(request, options = nil) -> ::Google::Cloud::UniversalLedger::V1::QueryDataResponse
Pass arguments to query_data via a request object, either of type QueryDataRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::UniversalLedger::V1::QueryDataRequest, ::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 query_data(endpoint: nil, serialized_signed_query_request: nil) -> ::Google::Cloud::UniversalLedger::V1::QueryDataResponse
Pass arguments to query_data 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).
Parameters
  • endpoint (::String) — Required. The endpoint to serve the request. Format: projects/{project}/locations/{location}/endpoints/{endpoint} The location is a region.
  • serialized_signed_query_request (::String) — Required. A protobuf serialized SignedQueryRequest to query the Universal Ledger network.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/universal_ledger/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::UniversalLedger::V1::UniversalLedger::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::UniversalLedger::V1::QueryDataRequest.new

# Call the query_data method.
result = client.query_data request

# The returned object is of type Google::Cloud::UniversalLedger::V1::QueryDataResponse.
p result

#query_transaction_state

def query_transaction_state(request, options = nil) -> ::Google::Cloud::UniversalLedger::V1::QueryTransactionStateResponse
def query_transaction_state(endpoint: nil, transaction_digest_hex: nil) -> ::Google::Cloud::UniversalLedger::V1::QueryTransactionStateResponse

Deprecated: Use the QueryData method instead. Queries the state of a transaction. This method can be called for any transaction submitted to the network. The returned transaction details may vary between calls, because an endpoint may route requests to different validators within the network and region, and the validators may not be at the same round ID at any given time.

Overloads
def query_transaction_state(request, options = nil) -> ::Google::Cloud::UniversalLedger::V1::QueryTransactionStateResponse
Pass arguments to query_transaction_state via a request object, either of type QueryTransactionStateRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::UniversalLedger::V1::QueryTransactionStateRequest, ::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 query_transaction_state(endpoint: nil, transaction_digest_hex: nil) -> ::Google::Cloud::UniversalLedger::V1::QueryTransactionStateResponse
Pass arguments to query_transaction_state 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).
Parameters
  • endpoint (::String) — Required. The endpoint to serve the request. Format: projects/{project}/locations/{location}/endpoints/{endpoint} The location is a region.
  • transaction_digest_hex (::String) — Required. The transaction ID to get the state of.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/universal_ledger/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::UniversalLedger::V1::UniversalLedger::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::UniversalLedger::V1::QueryTransactionStateRequest.new

# Call the query_transaction_state method.
result = client.query_transaction_state request

# The returned object is of type Google::Cloud::UniversalLedger::V1::QueryTransactionStateResponse.
p result

#submit_operational_transaction

def submit_operational_transaction(request, options = nil) -> ::Google::Cloud::UniversalLedger::V1::SubmitOperationalTransactionResponse
def submit_operational_transaction(endpoint: nil, serialized_signed_operational_transaction: nil) -> ::Google::Cloud::UniversalLedger::V1::SubmitOperationalTransactionResponse

Submits an operational transaction to the network. This method returns only after the transaction has been replicated across a majority of validators in the network, or if the transaction fails.

Overloads
def submit_operational_transaction(request, options = nil) -> ::Google::Cloud::UniversalLedger::V1::SubmitOperationalTransactionResponse
Pass arguments to submit_operational_transaction via a request object, either of type SubmitOperationalTransactionRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::UniversalLedger::V1::SubmitOperationalTransactionRequest, ::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 submit_operational_transaction(endpoint: nil, serialized_signed_operational_transaction: nil) -> ::Google::Cloud::UniversalLedger::V1::SubmitOperationalTransactionResponse
Pass arguments to submit_operational_transaction 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).
Parameters
  • endpoint (::String) — Required. The endpoint to serve the request. Format: projects/{project}/locations/{location}/endpoints/{endpoint} The location is a region.
  • serialized_signed_operational_transaction (::String) — Required. A protobuf serialized SignedTransaction to submit to the ledger. The enclosed client transaction must be an operational transaction, and the sender must be the platform operator. Using a serialized format ensures that all validators compute the same transaction ID as the SHA-256 digest of the serialized bytes.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/universal_ledger/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::UniversalLedger::V1::UniversalLedger::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::UniversalLedger::V1::SubmitOperationalTransactionRequest.new

# Call the submit_operational_transaction method.
result = client.submit_operational_transaction request

# The returned object is of type Google::Cloud::UniversalLedger::V1::SubmitOperationalTransactionResponse.
p result

#submit_transaction

def submit_transaction(request, options = nil) -> ::Google::Cloud::UniversalLedger::V1::SubmitTransactionResponse
def submit_transaction(endpoint: nil, serialized_signed_transaction: nil) -> ::Google::Cloud::UniversalLedger::V1::SubmitTransactionResponse

Submits a transaction to the network. The request is first validated for basic correctness. If validation fails, the request will fail immediately. If validation succeeds, this method returns only after the transaction has been replicated across a majority of validators in the network, or until the request fails.

Overloads
def submit_transaction(request, options = nil) -> ::Google::Cloud::UniversalLedger::V1::SubmitTransactionResponse
Pass arguments to submit_transaction via a request object, either of type SubmitTransactionRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::UniversalLedger::V1::SubmitTransactionRequest, ::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 submit_transaction(endpoint: nil, serialized_signed_transaction: nil) -> ::Google::Cloud::UniversalLedger::V1::SubmitTransactionResponse
Pass arguments to submit_transaction 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).
Parameters
  • endpoint (::String) — Required. The endpoint to submit the transaction to. Format: projects/{project}/locations/{location}/endpoints/{endpoint} The location is a region.
  • serialized_signed_transaction (::String) — Required. A protobuf serialized SignedTransaction to submit to the ledger. Using a serialized format ensures that all validators compute the same transaction ID as the SHA-256 digest of the serialized bytes.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/universal_ledger/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::UniversalLedger::V1::UniversalLedger::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::UniversalLedger::V1::SubmitTransactionRequest.new

# Call the submit_transaction method.
result = client.submit_transaction request

# The returned object is of type Google::Cloud::UniversalLedger::V1::SubmitTransactionResponse.
p result

#universe_domain

def universe_domain() -> String

The effective universe domain

Returns
  • (String)