class Google::Shopping::Merchant::Accounts::V1beta::AccountsService::Rest::ServiceStub


including transcoding, making the REST call, and deserialing the response.
Service stub contains baseline method implementations
REST service stub for the AccountsService service.
#

def self.transcode_create_and_configure_account_request request_pb

Returns:
  • (Array(String, [String, nil], Hash{String => String})) -

Parameters:
  • request_pb (::Google::Shopping::Merchant::Accounts::V1beta::CreateAndConfigureAccountRequest) --

Other tags:
    Private: -
def self.transcode_create_and_configure_account_request request_pb
  transcoder = Gapic::Rest::GrpcTranscoder.new
                                          .with_bindings(
                                            uri_method: :post,
                                            uri_template: "/accounts/v1beta/accounts:createAndConfigure",
                                            body: "*",
                                            matches: []
                                          )
  transcoder.transcode request_pb
end

def self.transcode_delete_account_request request_pb

Returns:
  • (Array(String, [String, nil], Hash{String => String})) -

Parameters:
  • request_pb (::Google::Shopping::Merchant::Accounts::V1beta::DeleteAccountRequest) --

Other tags:
    Private: -
def self.transcode_delete_account_request request_pb
  transcoder = Gapic::Rest::GrpcTranscoder.new
                                          .with_bindings(
                                            uri_method: :delete,
                                            uri_template: "/accounts/v1beta/{name}",
                                            matches: [
                                              ["name", %r{^accounts/[^/]+/?$}, false]
                                            ]
                                          )
  transcoder.transcode request_pb
end

def self.transcode_get_account_request request_pb

Returns:
  • (Array(String, [String, nil], Hash{String => String})) -

Parameters:
  • request_pb (::Google::Shopping::Merchant::Accounts::V1beta::GetAccountRequest) --

Other tags:
    Private: -
def self.transcode_get_account_request request_pb
  transcoder = Gapic::Rest::GrpcTranscoder.new
                                          .with_bindings(
                                            uri_method: :get,
                                            uri_template: "/accounts/v1beta/{name}",
                                            matches: [
                                              ["name", %r{^accounts/[^/]+/?$}, false]
                                            ]
                                          )
  transcoder.transcode request_pb
end

def self.transcode_list_accounts_request request_pb

Returns:
  • (Array(String, [String, nil], Hash{String => String})) -

Parameters:
  • request_pb (::Google::Shopping::Merchant::Accounts::V1beta::ListAccountsRequest) --

Other tags:
    Private: -
def self.transcode_list_accounts_request request_pb
  transcoder = Gapic::Rest::GrpcTranscoder.new
                                          .with_bindings(
                                            uri_method: :get,
                                            uri_template: "/accounts/v1beta/accounts",
                                            matches: []
                                          )
  transcoder.transcode request_pb
end

def self.transcode_list_sub_accounts_request request_pb

Returns:
  • (Array(String, [String, nil], Hash{String => String})) -

Parameters:
  • request_pb (::Google::Shopping::Merchant::Accounts::V1beta::ListSubAccountsRequest) --

Other tags:
    Private: -
def self.transcode_list_sub_accounts_request request_pb
  transcoder = Gapic::Rest::GrpcTranscoder.new
                                          .with_bindings(
                                            uri_method: :get,
                                            uri_template: "/accounts/v1beta/{provider}:listSubaccounts",
                                            matches: [
                                              ["provider", %r{^accounts/[^/]+/?$}, false]
                                            ]
                                          )
  transcoder.transcode request_pb
end

def self.transcode_update_account_request request_pb

Returns:
  • (Array(String, [String, nil], Hash{String => String})) -

Parameters:
  • request_pb (::Google::Shopping::Merchant::Accounts::V1beta::UpdateAccountRequest) --

Other tags:
    Private: -
def self.transcode_update_account_request request_pb
  transcoder = Gapic::Rest::GrpcTranscoder.new
                                          .with_bindings(
                                            uri_method: :patch,
                                            uri_template: "/accounts/v1beta/{account.name}",
                                            body: "account",
                                            matches: [
                                              ["account.name", %r{^accounts/[^/]+/?$}, false]
                                            ]
                                          )
  transcoder.transcode request_pb
end

def create_and_configure_account request_pb, options = nil

Returns:
  • (::Google::Shopping::Merchant::Accounts::V1beta::Account) -

Other tags:
    Yieldparam: operation -
    Yieldparam: result -

Other tags:
    Yield: - Access the result along with the TransportOperation object

Parameters:
  • options (::Gapic::CallOptions) --
  • request_pb (::Google::Shopping::Merchant::Accounts::V1beta::CreateAndConfigureAccountRequest) --
def create_and_configure_account request_pb, options = nil
  raise ::ArgumentError, "request must be provided" if request_pb.nil?
  verb, uri, query_string_params, body = ServiceStub.transcode_create_and_configure_account_request request_pb
  query_string_params = if query_string_params.any?
                          query_string_params.to_h { |p| p.split "=", 2 }
                        else
                          {}
                        end
  response = @client_stub.make_http_request(
    verb,
    uri:     uri,
    body:    body || "",
    params:  query_string_params,
    options: options
  )
  operation = ::Gapic::Rest::TransportOperation.new response
  result = ::Google::Shopping::Merchant::Accounts::V1beta::Account.decode_json response.body, ignore_unknown_fields: true
  yield result, operation if block_given?
  result
end

def delete_account request_pb, options = nil

Returns:
  • (::Google::Protobuf::Empty) -

Other tags:
    Yieldparam: operation -
    Yieldparam: result -

Other tags:
    Yield: - Access the result along with the TransportOperation object

Parameters:
  • options (::Gapic::CallOptions) --
  • request_pb (::Google::Shopping::Merchant::Accounts::V1beta::DeleteAccountRequest) --
def delete_account request_pb, options = nil
  raise ::ArgumentError, "request must be provided" if request_pb.nil?
  verb, uri, query_string_params, body = ServiceStub.transcode_delete_account_request request_pb
  query_string_params = if query_string_params.any?
                          query_string_params.to_h { |p| p.split "=", 2 }
                        else
                          {}
                        end
  response = @client_stub.make_http_request(
    verb,
    uri:     uri,
    body:    body || "",
    params:  query_string_params,
    options: options
  )
  operation = ::Gapic::Rest::TransportOperation.new response
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
  yield result, operation if block_given?
  result
end

def endpoint

Returns:
  • (String) -
def endpoint
  @client_stub.endpoint
end

def get_account request_pb, options = nil

Returns:
  • (::Google::Shopping::Merchant::Accounts::V1beta::Account) -

Other tags:
    Yieldparam: operation -
    Yieldparam: result -

Other tags:
    Yield: - Access the result along with the TransportOperation object

Parameters:
  • options (::Gapic::CallOptions) --
  • request_pb (::Google::Shopping::Merchant::Accounts::V1beta::GetAccountRequest) --
def get_account request_pb, options = nil
  raise ::ArgumentError, "request must be provided" if request_pb.nil?
  verb, uri, query_string_params, body = ServiceStub.transcode_get_account_request request_pb
  query_string_params = if query_string_params.any?
                          query_string_params.to_h { |p| p.split "=", 2 }
                        else
                          {}
                        end
  response = @client_stub.make_http_request(
    verb,
    uri:     uri,
    body:    body || "",
    params:  query_string_params,
    options: options
  )
  operation = ::Gapic::Rest::TransportOperation.new response
  result = ::Google::Shopping::Merchant::Accounts::V1beta::Account.decode_json response.body, ignore_unknown_fields: true
  yield result, operation if block_given?
  result
end

def initialize endpoint:, endpoint_template:, universe_domain:, credentials:

def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
  # These require statements are intentionally placed here to initialize
  # the REST modules only when it's required.
  require "gapic/rest"
  @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
                                               endpoint_template: endpoint_template,
                                               universe_domain: universe_domain,
                                               credentials: credentials,
                                               numeric_enums: true,
                                               raise_faraday_errors: false
end

def list_accounts request_pb, options = nil

Returns:
  • (::Google::Shopping::Merchant::Accounts::V1beta::ListAccountsResponse) -

Other tags:
    Yieldparam: operation -
    Yieldparam: result -

Other tags:
    Yield: - Access the result along with the TransportOperation object

Parameters:
  • options (::Gapic::CallOptions) --
  • request_pb (::Google::Shopping::Merchant::Accounts::V1beta::ListAccountsRequest) --
def list_accounts request_pb, options = nil
  raise ::ArgumentError, "request must be provided" if request_pb.nil?
  verb, uri, query_string_params, body = ServiceStub.transcode_list_accounts_request request_pb
  query_string_params = if query_string_params.any?
                          query_string_params.to_h { |p| p.split "=", 2 }
                        else
                          {}
                        end
  response = @client_stub.make_http_request(
    verb,
    uri:     uri,
    body:    body || "",
    params:  query_string_params,
    options: options
  )
  operation = ::Gapic::Rest::TransportOperation.new response
  result = ::Google::Shopping::Merchant::Accounts::V1beta::ListAccountsResponse.decode_json response.body, ignore_unknown_fields: true
  yield result, operation if block_given?
  result
end

def list_sub_accounts request_pb, options = nil

Returns:
  • (::Google::Shopping::Merchant::Accounts::V1beta::ListSubAccountsResponse) -

Other tags:
    Yieldparam: operation -
    Yieldparam: result -

Other tags:
    Yield: - Access the result along with the TransportOperation object

Parameters:
  • options (::Gapic::CallOptions) --
  • request_pb (::Google::Shopping::Merchant::Accounts::V1beta::ListSubAccountsRequest) --
def list_sub_accounts request_pb, options = nil
  raise ::ArgumentError, "request must be provided" if request_pb.nil?
  verb, uri, query_string_params, body = ServiceStub.transcode_list_sub_accounts_request request_pb
  query_string_params = if query_string_params.any?
                          query_string_params.to_h { |p| p.split "=", 2 }
                        else
                          {}
                        end
  response = @client_stub.make_http_request(
    verb,
    uri:     uri,
    body:    body || "",
    params:  query_string_params,
    options: options
  )
  operation = ::Gapic::Rest::TransportOperation.new response
  result = ::Google::Shopping::Merchant::Accounts::V1beta::ListSubAccountsResponse.decode_json response.body, ignore_unknown_fields: true
  yield result, operation if block_given?
  result
end

def universe_domain

Returns:
  • (String) -
def universe_domain
  @client_stub.universe_domain
end

def update_account request_pb, options = nil

Returns:
  • (::Google::Shopping::Merchant::Accounts::V1beta::Account) -

Other tags:
    Yieldparam: operation -
    Yieldparam: result -

Other tags:
    Yield: - Access the result along with the TransportOperation object

Parameters:
  • options (::Gapic::CallOptions) --
  • request_pb (::Google::Shopping::Merchant::Accounts::V1beta::UpdateAccountRequest) --
def update_account request_pb, options = nil
  raise ::ArgumentError, "request must be provided" if request_pb.nil?
  verb, uri, query_string_params, body = ServiceStub.transcode_update_account_request request_pb
  query_string_params = if query_string_params.any?
                          query_string_params.to_h { |p| p.split "=", 2 }
                        else
                          {}
                        end
  response = @client_stub.make_http_request(
    verb,
    uri:     uri,
    body:    body || "",
    params:  query_string_params,
    options: options
  )
  operation = ::Gapic::Rest::TransportOperation.new response
  result = ::Google::Shopping::Merchant::Accounts::V1beta::Account.decode_json response.body, ignore_unknown_fields: true
  yield result, operation if block_given?
  result
end