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.



444
445
446
447
448
# File 'lib/barrister.rb', line 444

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

Instance Attribute Details

#requestsObject

Returns the value of attribute requests.



442
443
444
# File 'lib/barrister.rb', line 442

def requests
  @requests
end

#sentObject

Returns the value of attribute sent.



442
443
444
# File 'lib/barrister.rb', line 442

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.



452
453
454
455
456
457
458
# File 'lib/barrister.rb', line 452

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