Class: Barrister::BatchTransport

Inherits:
Object
  • Object
show all
Defined in:
lib/barrister.rb

Overview

Internal transport used by the BatchClient. You shouldn’t create this directly.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ BatchTransport

Returns a new instance of BatchTransport.



437
438
439
440
441
# File 'lib/barrister.rb', line 437

def initialize(client)
  @client   = client
  @requests = [ ]
  @sent     = false
end

Instance Attribute Details

#requestsObject

Returns the value of attribute requests.



435
436
437
# File 'lib/barrister.rb', line 435

def requests
  @requests
end

#sentObject

Returns the value of attribute sent.



435
436
437
# File 'lib/barrister.rb', line 435

def sent
  @sent
end

Instance Method Details

#request(req) ⇒ Object

Request simply stores the req object in an interal Array When send() is called on the BatchClient, these are sent to the server.



445
446
447
448
449
450
451
# File 'lib/barrister.rb', line 445

def request(req)
  if @sent
    raise "Batch has already been sent!"
  end
  @requests << req
  return nil
end