Class: Google::Apis::AppstateV1::AppStateService

Inherits:
Core::BaseService show all
Defined in:
generated/google/apis/appstate_v1/service.rb

Overview

Google App State API

The Google App State API.

Examples:

require 'google/apis/appstate_v1'

Appstate = Google::Apis::AppstateV1 # Alias the module
service = Appstate::AppStateService.new

See Also:

Instance Attribute Summary collapse

Attributes inherited from Core::BaseService

#authorization, #base_path, #batch_path, #client, #client_options, #request_options, #root_url, #upload_path

Instance Method Summary collapse

Methods inherited from Core::BaseService

#batch, #batch_upload, #fetch_all, #http

Methods included from Core::Logging

#logger

Constructor Details

#initializeAppStateService

Returns a new instance of AppStateService



51
52
53
54
# File 'generated/google/apis/appstate_v1/service.rb', line 51

def initialize
  super('https://www.googleapis.com/', 'appstate/v1/')
  @batch_path = 'batch/appstate/v1'
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.



38
39
40
# File 'generated/google/apis/appstate_v1/service.rb', line 38

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. Overrides userIp if both are provided.

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. Overrides userIp if both are provided.



44
45
46
# File 'generated/google/apis/appstate_v1/service.rb', line 44

def quota_user
  @quota_user
end

#user_ipString

Returns IP address of the site where the request originates. Use this if you want to enforce per-user limits.

Returns:

  • (String)

    IP address of the site where the request originates. Use this if you want to enforce per-user limits.



49
50
51
# File 'generated/google/apis/appstate_v1/service.rb', line 49

def user_ip
  @user_ip
end

Instance Method Details

#clear_state(state_key, current_data_version: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::AppstateV1::WriteResult

Clears (sets to empty) the data for the passed key if and only if the passed version matches the currently stored version. This method results in a conflict error on version mismatch.

Parameters:

  • state_key (Fixnum)

    The key for the data to be retrieved.

  • current_data_version (String)

    The version of the data to be cleared. Version strings are returned by the server.

  • fields (String)

    Selector specifying which fields to include in a partial response.

  • quota_user (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. Overrides userIp if both are provided.

  • user_ip (String)

    IP address of the site where the request originates. Use this if you want to enforce per-user limits.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



85
86
87
88
89
90
91
92
93
94
95
# File 'generated/google/apis/appstate_v1/service.rb', line 85

def clear_state(state_key, current_data_version: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
  command =  make_simple_command(:post, 'states/{stateKey}/clear', options)
  command.response_representation = Google::Apis::AppstateV1::WriteResult::Representation
  command.response_class = Google::Apis::AppstateV1::WriteResult
  command.params['stateKey'] = state_key unless state_key.nil?
  command.query['currentDataVersion'] = current_data_version unless current_data_version.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  command.query['userIp'] = user_ip unless user_ip.nil?
  execute_or_queue_command(command, &block)
end

#delete_state(state_key, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... }

This method returns an undefined value.

Deletes a key and the data associated with it. The key is removed and no longer counts against the key quota. Note that since this method is not safe in the face of concurrent modifications, it should only be used for development and testing purposes. Invoking this method in shipping code can result in data loss and data corruption.

Parameters:

  • state_key (Fixnum)

    The key for the data to be retrieved.

  • fields (String)

    Selector specifying which fields to include in a partial response.

  • quota_user (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. Overrides userIp if both are provided.

  • user_ip (String)

    IP address of the site where the request originates. Use this if you want to enforce per-user limits.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

  • result (NilClass)

    No result returned for this method

  • err (StandardError)

    error object if request failed

Raises:



125
126
127
128
129
130
131
132
# File 'generated/google/apis/appstate_v1/service.rb', line 125

def delete_state(state_key, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
  command =  make_simple_command(:delete, 'states/{stateKey}', options)
  command.params['stateKey'] = state_key unless state_key.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  command.query['userIp'] = user_ip unless user_ip.nil?
  execute_or_queue_command(command, &block)
end

#get_state(state_key, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::AppstateV1::GetResponse

Retrieves the data corresponding to the passed key. If the key does not exist on the server, an HTTP 404 will be returned.

Parameters:

  • state_key (Fixnum)

    The key for the data to be retrieved.

  • fields (String)

    Selector specifying which fields to include in a partial response.

  • quota_user (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. Overrides userIp if both are provided.

  • user_ip (String)

    IP address of the site where the request originates. Use this if you want to enforce per-user limits.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



159
160
161
162
163
164
165
166
167
168
# File 'generated/google/apis/appstate_v1/service.rb', line 159

def get_state(state_key, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
  command =  make_simple_command(:get, 'states/{stateKey}', options)
  command.response_representation = Google::Apis::AppstateV1::GetResponse::Representation
  command.response_class = Google::Apis::AppstateV1::GetResponse
  command.params['stateKey'] = state_key unless state_key.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  command.query['userIp'] = user_ip unless user_ip.nil?
  execute_or_queue_command(command, &block)
end

#list_states(include_data: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::AppstateV1::ListResponse

Lists all the states keys, and optionally the state data.

Parameters:

  • include_data (Boolean)

    Whether to include the full data in addition to the version number

  • fields (String)

    Selector specifying which fields to include in a partial response.

  • quota_user (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. Overrides userIp if both are provided.

  • user_ip (String)

    IP address of the site where the request originates. Use this if you want to enforce per-user limits.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



194
195
196
197
198
199
200
201
202
203
# File 'generated/google/apis/appstate_v1/service.rb', line 194

def list_states(include_data: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
  command =  make_simple_command(:get, 'states', options)
  command.response_representation = Google::Apis::AppstateV1::ListResponse::Representation
  command.response_class = Google::Apis::AppstateV1::ListResponse
  command.query['includeData'] = include_data unless include_data.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  command.query['userIp'] = user_ip unless user_ip.nil?
  execute_or_queue_command(command, &block)
end

#update_state(state_key, update_request_object = nil, current_state_version: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::AppstateV1::WriteResult

Update the data associated with the input key if and only if the passed version matches the currently stored version. This method is safe in the face of concurrent writes. Maximum per-key size is 128KB.

Parameters:

  • state_key (Fixnum)

    The key for the data to be retrieved.

  • update_request_object (Google::Apis::AppstateV1::UpdateRequest) (defaults to: nil)
  • current_state_version (String)

    The version of the app state your application is attempting to update. If this does not match the current version, this method will return a conflict error. If there is no data stored on the server for this key, the update will succeed irrespective of the value of this parameter.

  • fields (String)

    Selector specifying which fields to include in a partial response.

  • quota_user (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. Overrides userIp if both are provided.

  • user_ip (String)

    IP address of the site where the request originates. Use this if you want to enforce per-user limits.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



237
238
239
240
241
242
243
244
245
246
247
248
249
# File 'generated/google/apis/appstate_v1/service.rb', line 237

def update_state(state_key, update_request_object = nil, current_state_version: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
  command =  make_simple_command(:put, 'states/{stateKey}', options)
  command.request_representation = Google::Apis::AppstateV1::UpdateRequest::Representation
  command.request_object = update_request_object
  command.response_representation = Google::Apis::AppstateV1::WriteResult::Representation
  command.response_class = Google::Apis::AppstateV1::WriteResult
  command.params['stateKey'] = state_key unless state_key.nil?
  command.query['currentStateVersion'] = current_state_version unless current_state_version.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  command.query['userIp'] = user_ip unless user_ip.nil?
  execute_or_queue_command(command, &block)
end