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.



348
349
350
351
# File 'lib/carddb/batch.rb', line 348

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

Instance Method Details

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

Proxy fetch calls to the batch



354
355
356
357
# File 'lib/carddb/batch.rb', line 354

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



360
361
362
363
# File 'lib/carddb/batch.rb', line 360

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

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



365
366
367
368
# File 'lib/carddb/batch.rb', line 365

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