class Parse::BatchHttpClient

Attributes

after_blocks[RW]
requests[RW]

Public Class Methods

new(host) click to toggle source
# File lib/parse/batch_http_client.rb, line 5
def initialize host
  @host = host
  @requests = []
  @after_blocks = []
end

Public Instance Methods

request(method, endpoint, headers={}) click to toggle source
# File lib/parse/batch_http_client.rb, line 11
def request method, endpoint, headers={}, body=nil, &block
  raise 'find cannot be in a batch request.' if method.to_s.upcase == 'GET'

  @after_blocks << block
  @requests << {
    "method" => method.to_s.upcase,
    "path" => endpoint,
    "body" => JSON.parse(body) # TODO: ??
  }
end