Class: Google::Apis::MerchantapiPromotionsV1beta::MerchantService

Inherits:
Core::BaseService
  • Object
show all
Defined in:
lib/google/apis/merchantapi_promotions_v1beta/service.rb

Overview

Merchant API

Programmatically manage your Merchant Center Accounts.

Examples:

require 'google/apis/merchantapi_promotions_v1beta'

Merchantapi = Google::Apis::MerchantapiPromotionsV1beta # Alias the module
service = Merchantapi::MerchantService.new

See Also:

Constant Summary collapse

DEFAULT_ENDPOINT_TEMPLATE =
"https://merchantapi.$UNIVERSE_DOMAIN$/"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMerchantService

Returns a new instance of MerchantService.



47
48
49
50
51
52
# File 'lib/google/apis/merchantapi_promotions_v1beta/service.rb', line 47

def initialize
  super(DEFAULT_ENDPOINT_TEMPLATE, '',
        client_name: 'google-apis-merchantapi_promotions_v1beta',
        client_version: Google::Apis::MerchantapiPromotionsV1beta::GEM_VERSION)
  @batch_path = 'batch'
end

Instance Attribute Details

#keyString

Returns API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.

Returns:

  • (String)

    API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.



40
41
42
# File 'lib/google/apis/merchantapi_promotions_v1beta/service.rb', line 40

def key
  @key
end

#quota_userString

Returns Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

Returns:

  • (String)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.



45
46
47
# File 'lib/google/apis/merchantapi_promotions_v1beta/service.rb', line 45

def quota_user
  @quota_user
end

Instance Method Details

#get_account_promotion(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::MerchantapiPromotionsV1beta::Promotion

Retrieves the promotion from your Merchant Center account. After inserting or updating a promotion input, it may take several minutes before the updated promotion can be retrieved.

Parameters:

  • name (String)

    Required. The name of the promotion to retrieve. Format: accounts/account/ promotions/promotions``

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



77
78
79
80
81
82
83
84
85
# File 'lib/google/apis/merchantapi_promotions_v1beta/service.rb', line 77

def (name, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'promotions/v1beta/{+name}', options)
  command.response_representation = Google::Apis::MerchantapiPromotionsV1beta::Promotion::Representation
  command.response_class = Google::Apis::MerchantapiPromotionsV1beta::Promotion
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#insert_promotion(parent, insert_promotion_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::MerchantapiPromotionsV1beta::Promotion

Inserts a promotion for your Merchant Center account. If the promotion already exists, then it updates the promotion instead.

Parameters:

  • parent (String)

    Required. The account where the promotion will be inserted. Format: accounts/ account

  • insert_promotion_request_object (Google::Apis::MerchantapiPromotionsV1beta::InsertPromotionRequest) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



110
111
112
113
114
115
116
117
118
119
120
# File 'lib/google/apis/merchantapi_promotions_v1beta/service.rb', line 110

def insert_promotion(parent, insert_promotion_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'promotions/v1beta/{+parent}/promotions:insert', options)
  command.request_representation = Google::Apis::MerchantapiPromotionsV1beta::InsertPromotionRequest::Representation
  command.request_object = insert_promotion_request_object
  command.response_representation = Google::Apis::MerchantapiPromotionsV1beta::Promotion::Representation
  command.response_class = Google::Apis::MerchantapiPromotionsV1beta::Promotion
  command.params['parent'] = parent unless parent.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#list_account_promotions(parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::MerchantapiPromotionsV1beta::ListPromotionsResponse

Lists the promotions in your Merchant Center account. The response might contain fewer items than specified by pageSize. Rely on pageToken to determine if there are more items to be requested. After inserting or updating a promotion, it may take several minutes before the updated processed promotion can be retrieved.

Parameters:

  • parent (String)

    Required. The account to list processed promotions for. Format: accounts/ account``

  • page_size (Fixnum) (defaults to: nil)

    Output only. The maximum number of promotions to return. The service may return fewer than this value. The maximum value is 1000; values above 1000 will be coerced to 1000. If unspecified, the maximum number of promotions will be returned.

  • page_token (String) (defaults to: nil)

    Output only. A page token, received from a previous ListPromotions call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to ListPromotions must match the call that provided the page token.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



157
158
159
160
161
162
163
164
165
166
167
# File 'lib/google/apis/merchantapi_promotions_v1beta/service.rb', line 157

def (parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'promotions/v1beta/{+parent}/promotions', options)
  command.response_representation = Google::Apis::MerchantapiPromotionsV1beta::ListPromotionsResponse::Representation
  command.response_class = Google::Apis::MerchantapiPromotionsV1beta::ListPromotionsResponse
  command.params['parent'] = parent unless parent.nil?
  command.query['pageSize'] = page_size unless page_size.nil?
  command.query['pageToken'] = page_token unless page_token.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end