Sha256: dfc40093f12c6605c0a1563fc1f952a45d214e4195b753e2d85f22c3e4002fcb

Contents?: true

Size: 467 Bytes

Versions: 29

Compression:

Stored size: 467 Bytes

Contents

module Siteleaf
  class Job < Entity
  
    attr_reader :id
    
    def stream(&callback)
      HTTParty.send(:get, Siteleaf.api_url("jobs/#{self.id}"), {
        :basic_auth => {:username => Siteleaf.api_key, :password => Siteleaf.api_secret},
        :stream_body => true
      }) do |fragment|
        if str = fragment.match(/{.*}/)
          if json = JSON.parse(str[0])
            callback.call(json)
          end
        end
      end
    end
    
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
siteleaf-1.0.1 lib/siteleaf/job.rb
siteleaf-1.0.0 lib/siteleaf/job.rb
siteleaf-2.0.0.pre.beta7 lib/siteleaf/job.rb
siteleaf-2.0.0.pre.beta5 lib/siteleaf/job.rb
siteleaf-2.0.0.pre.beta4 lib/siteleaf/job.rb
siteleaf-2.0.0.pre.beta3 lib/siteleaf/job.rb
siteleaf-2.0.0.pre.beta2 lib/siteleaf/job.rb
siteleaf-2.0.0.pre.beta1 lib/siteleaf/job.rb
siteleaf-0.9.23 lib/siteleaf/job.rb