class Google::Cloud::Storage::HmacKey::List

HmacKey::List is a special case Array with additional values.
#

def self.from_gapi gapi_list, service, service_account_email: nil,

Other tags:
    Private: - New HmacKey::List from a Google API Client
def self.from_gapi gapi_list, service, service_account_email: nil,
                   show_deleted_keys: nil, max: nil, user_project: nil
  hmac_keys = new(Array(gapi_list.items).map do |gapi_object|
    HmacKey.from_gapi_metadata gapi_object, service,
                               user_project: user_project
  end)
  hmac_keys.instance_variable_set :@token, gapi_list.next_page_token
  hmac_keys.instance_variable_set :@service, service
  hmac_keys.instance_variable_set :@service_account_email,
                                  service_account_email
  hmac_keys.instance_variable_set :@show_deleted_keys,
                                  show_deleted_keys
  hmac_keys.instance_variable_set :@max, max
  hmac_keys.instance_variable_set :@user_project, user_project
  hmac_keys
end

def all request_limit: nil, &block

Other tags:
    Example: Limit the number of API calls made: -
    Example: Using the enumerator by not passing a block: -
    Example: Iterating each HMAC key by passing a block: -

Returns:
  • (Enumerator) -

Other tags:
    Yieldparam: key - The HMAC key object.

Other tags:
    Yield: - The block for accessing each HMAC key.

Parameters:
  • request_limit (Integer) -- The upper limit of API requests to
def all request_limit: nil, &block
  request_limit = request_limit.to_i if request_limit
  unless block_given?
    return enum_for :all, request_limit: request_limit
  end
  results = self
  loop do
    results.each(&block)
    if request_limit
      request_limit -= 1
      break if request_limit.negative?
    end
    break unless results.next?
    results = results.next
  end
end

def ensure_service!

Raise an error unless an active connection is available.
#
def ensure_service!
  raise "Must have active connection" unless @service
end

def initialize arr = []

Other tags:
    Private: - Create a new HmacKey::List with an array of values.
def initialize arr = []
  super arr
end

def next

Returns:
  • (HmacKey::List) -
def next
  return nil unless next?
  ensure_service!
  gapi = @service.list_hmac_keys \
    service_account_email: @service_account_email,
    show_deleted_keys: @show_deleted_keys, token: @token, max: @max,
    user_project: @user_project
  HmacKey::List.from_gapi \
    gapi, @service,
    service_account_email: @service_account_email,
    show_deleted_keys: @show_deleted_keys, max: @max,
    user_project: @user_project
end

def next?

Returns:
  • (Boolean) -
def next?
  !token.nil?
end