Class: Google::Apis::AppstateV1::AppStateService
- Inherits:
-
Core::BaseService
- Object
- Core::BaseService
- Google::Apis::AppstateV1::AppStateService
- Defined in:
- generated/google/apis/appstate_v1/service.rb
Overview
Google App State API
The Google App State API.
Instance Attribute Summary collapse
-
#key ⇒ String
API key.
-
#quota_user ⇒ String
Available to use for quota purposes for server-side applications.
-
#user_ip ⇒ String
IP address of the site where the request originates.
Attributes inherited from Core::BaseService
#authorization, #base_path, #batch_path, #client, #client_options, #request_options, #root_url, #upload_path
Instance Method Summary collapse
-
#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.
-
#delete_state(state_key, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... }
Deletes a key and the data associated with it.
-
#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.
-
#initialize ⇒ AppStateService
constructor
A new instance of AppStateService.
-
#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.
-
#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.
Methods inherited from Core::BaseService
#batch, #batch_upload, #fetch_all, #http
Methods included from Core::Logging
Constructor Details
#initialize ⇒ AppStateService
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
#key ⇒ String
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.
38 39 40 |
# File 'generated/google/apis/appstate_v1/service.rb', line 38 def key @key end |
#quota_user ⇒ String
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.
44 45 46 |
# File 'generated/google/apis/appstate_v1/service.rb', line 44 def quota_user @quota_user end |
#user_ip ⇒ String
Returns 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.
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', ) 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.
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}', ) 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.
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}', ) 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.
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', ) 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.
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}', ) 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 |