Class: CardDB::BatchProxy

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

Overview

Proxy class for batching operations on a specific resource

Instance Method Summary collapse

Constructor Details

#initialize(batch, resource) ⇒ BatchProxy

Returns a new instance of BatchProxy.



319
320
321
322
# File 'lib/carddb/batch.rb', line 319

def initialize(batch, resource)
  @batch = batch
  @resource = resource
end

Instance Method Details

#fetch(*args, **kwargs) ⇒ Object

Proxy fetch calls to the batch



325
326
327
328
# File 'lib/carddb/batch.rb', line 325

def fetch(*args, **kwargs)
  @batch.add_operation(resource: @resource, method: :fetch, args: args, kwargs: kwargs)
  nil # Return nil since we're batching
end

#get(*args, **kwargs) ⇒ Object

Proxy get calls to the batch



331
332
333
334
# File 'lib/carddb/batch.rb', line 331

def get(*args, **kwargs)
  @batch.add_operation(resource: @resource, method: :get, args: args, kwargs: kwargs)
  nil # Return nil since we're batching
end