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.



386
387
388
389
# File 'lib/carddb/batch.rb', line 386

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

Instance Method Details

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

Proxy fetch calls to the batch



392
393
394
395
# File 'lib/carddb/batch.rb', line 392

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



398
399
400
401
# File 'lib/carddb/batch.rb', line 398

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



403
404
405
406
# File 'lib/carddb/batch.rb', line 403

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

#valuation(**kwargs) ⇒ Object

Proxy valuation calls to the batch



409
410
411
412
# File 'lib/carddb/batch.rb', line 409

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