def wait_until_ready(max_trials, seconds_between_tries = 2)
      # pessimistically assume the server is not ready
      num_trials = 0
      begin
        self.refresh_details()

        parent_ready = !(has_sl_property? :transactionId) || (self[:transactionId] == "")
        children_ready = (nil == self['children'].find { |child| child['transactionId'] != "" })

        ready = parent_ready && children_ready
        yield ready if block_given?

        num_trials = num_trials + 1
        sleep(seconds_between_tries) if !ready && (num_trials <= max_trials)
      end until ready || (num_trials >= max_trials)

      ready
    end
def wait_until_ready(max_trials, seconds_between_tries = 2)
      # pessimistically assume the server is not ready
      num_trials = 0
      begin
        self.refresh_details()

        parent_ready = !(has_sl_property? :transactionId) || (self[:transactionId] == "")
        children_ready = (nil == self['children'].find { |child| child['transactionId'] != "" })

        ready = parent_ready && children_ready
        yield ready if block_given?

        num_trials = num_trials + 1
        sleep(seconds_between_tries) if !ready && (num_trials <= max_trials)
      end until ready || (num_trials >= max_trials)

      ready
    end
def wait_until_ready ( max_trials , seconds_between_tries = 2 ) # pessimistically assume the server is not ready num_trials = 0 begin self . refresh_details ( ) parent_ready = ! ( has_sl_property? :transactionId ) || ( self [ :transactionId ] == "" ) children_ready = ( nil == self [ 'children' ] . find { | child | child [ 'transactionId' ] != "" } ) ready = parent_ready && children_ready yield ready if block_given? num_trials = num_trials + 1 sleep ( seconds_between_tries ) if ! ready && ( num_trials <= max_trials ) end until ready || ( num_trials >= max_trials ) ready end
Repeatedly poll the network API until transactions related to this image
 template are finished

 A template is not 'ready' until all the transactions on the template
 itself, and all its children are complete.

 At each trial, the routine will yield to a block if one is given
 The block is passed one parameter, a boolean flag indicating
 whether or not the image template is 'ready'.
Repeatedly poll the network API until transactions related to this image template are finished