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.



270
271
272
273
# File 'lib/carddb/batch.rb', line 270

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

Instance Method Details

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

Proxy fetch calls to the batch



276
277
278
279
# File 'lib/carddb/batch.rb', line 276

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

#get(**kwargs) ⇒ Object

Proxy get calls to the batch



282
283
284
285
# File 'lib/carddb/batch.rb', line 282

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