class Taric::Client::ParallelClient

Public Class Methods

new(parent) click to toggle source
# File lib/taric/client.rb, line 97
def initialize(parent)
  @parent = parent
  @operations = []
end

Public Instance Methods

execute!() click to toggle source

Processes all chained requests, clears operations, and returns responses with respect to the operations.

@return [Array] of operation responses, default is hash with response status and body.

@example

client.in_parallel.match(id: 1).match(id: 42).featured_games.execute!
# File lib/taric/client.rb, line 109
def execute!
  -> responses {
    @operations.clear
    responses
  }.(@parent.config.parallel_response_handler.(@parent.config.parallel_requestor.(@parent.conn, @operations)))
end

Private Instance Methods

response_for(operation, options = {}) click to toggle source
# File lib/taric/client.rb, line 118
def response_for(operation, options = {})
  @operations << {url: @parent.class.expand_template(region: @parent.region, operation: operation.template_url, options: options), method: operation.method, body: operation.body, headers: operation.headers}
  self
end