class Syncano::BatchQueueElement

Class representing objects batch requests queued for processing

Attributes

args[RW]
block[RW]
method_name[RW]
resource[RW]

Public Class Methods

new(resource) click to toggle source

Constructor for Syncano::BatchQueueElement @param [Syncano::QueryBuilder, Syncano::Resources::Base] resource

Calls superclass method
# File lib/syncano/batch_queue_element.rb, line 6
def initialize(resource)
  super()
  self.resource = resource.dup
end

Public Instance Methods

method_missing(sym, *args, &block) click to toggle source

Overwritten method_missing used for preparing execution of proper batch method on the resource object @param [Symbol] sym @param [Array] args @param [Proc] block @return [Syncano::BatchQueueElement]

# File lib/syncano/batch_queue_element.rb, line 16
def method_missing(sym, *args, &block)
  self.method_name = 'batch_' + sym.to_s
  self.args = args
  self.block = block
  self
end
perform!(batch_client) click to toggle source

Executes batch method on the resource object

# File lib/syncano/batch_queue_element.rb, line 24
def perform!(batch_client)
  args.unshift(batch_client)
  resource.send(method_name, *args, &block)
end