class Google::APIClient::Service::Result

Handles an API result. Wraps around the Google::APIClient::Result class, making it easier to handle the result (e.g. pagination) and keeping it in line with the rest of the Service programming interface.

Attributes

request[R]

@return [Google::APIClient::Service::Request] Original request object

Public Class Methods

new(request, base_result) click to toggle source

Init the result.

@param [Google::APIClient::Service::Request] request

The original request

@param [Google::APIClient::Result] base_result

The base result to be wrapped
# File lib/google/api_client/service/result.rb, line 33
def initialize(request, base_result)
  @request = request
  @base_result = base_result
end

Public Instance Methods

@base_result() click to toggle source

Get the content type of the response @!attribute [r] media_type @return [String]

Value of content-type header
# File lib/google/api_client/service/result.rb, line 54
def_delegators :@base_result, :media_type
next_page() click to toggle source

Build a request for fetching the next page of data

@return [Google::APIClient::Service::Request]

API request for retrieving next page
# File lib/google/api_client/service/result.rb, line 139
def next_page
  request = @request.clone
  # Make a deep copy of the parameters.
  request.parameters = Marshal.load(Marshal.dump(request.parameters))
  request.parameters[page_token_param] = self.next_page_token
  return request
end
prev_page() click to toggle source

Build a request for fetching the previous page of data

@return [Google::APIClient::Service::Request]

API request for retrieving previous page
# File lib/google/api_client/service/result.rb, line 152
def prev_page
  request = @request.clone
  # Make a deep copy of the parameters.
  request.parameters = Marshal.load(Marshal.dump(request.parameters))
  request.parameters[page_token_param] = self.prev_page_token
  return request
end
resumable_upload() click to toggle source

@!attribute [r] #resumable_upload

# File lib/google/api_client/service/result.rb, line 129
def resumable_upload
  # TODO(sgomes): implement resumable_upload for Service::Result
  raise NotImplementedError
end