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



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

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 An opaque string that represents a user for quota purposes. Must not exceed 40 characters.

Returns:

  • (String)

    An opaque string that represents a user for quota purposes. Must not exceed 40 characters.



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

def quota_user
  @quota_user
end

#user_ipString

Returns Deprecated. Please use quotaUser instead.

Returns:

  • (String)

    Deprecated. Please use quotaUser instead.



47
48
49
# File 'generated/google/apis/appstate_v1/service.rb', line 47

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)

    An opaque string that represents a user for quota purposes. Must not exceed 40 characters.

  • user_ip (String)

    Deprecated. Please use quotaUser instead.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



81
82
83
84
85
86
87
88
89
90
91
# File 'generated/google/apis/appstate_v1/service.rb', line 81

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)

    An opaque string that represents a user for quota purposes. Must not exceed 40 characters.

  • user_ip (String)

    Deprecated. Please use quotaUser instead.

  • 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:



119
120
121
122
123
124
125
126
# File 'generated/google/apis/appstate_v1/service.rb', line 119

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)

    An opaque string that represents a user for quota purposes. Must not exceed 40 characters.

  • user_ip (String)

    Deprecated. Please use quotaUser instead.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



151
152
153
154
155
156
157
158
159
160
# File 'generated/google/apis/appstate_v1/service.rb', line 151

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)

    An opaque string that represents a user for quota purposes. Must not exceed 40 characters.

  • user_ip (String)

    Deprecated. Please use quotaUser instead.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



184
185
186
187
188
189
190
191
192
193
# File 'generated/google/apis/appstate_v1/service.rb', line 184

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)

    An opaque string that represents a user for quota purposes. Must not exceed 40 characters.

  • user_ip (String)

    Deprecated. Please use quotaUser instead.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



225
226
227
228
229
230
231
232
233
234
235
236
237
# File 'generated/google/apis/appstate_v1/service.rb', line 225

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