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-2.3.0 lib/siteleaf/job.rb
siteleaf-2.2.1 lib/siteleaf/job.rb
siteleaf-2.2.0 lib/siteleaf/job.rb
siteleaf-1.0.11 lib/siteleaf/job.rb
siteleaf-2.1.2 lib/siteleaf/job.rb
siteleaf-2.1.1 lib/siteleaf/job.rb
siteleaf-1.0.10 lib/siteleaf/job.rb
siteleaf-2.1.0 lib/siteleaf/job.rb
siteleaf-2.0.2 lib/siteleaf/job.rb
siteleaf-1.0.9 lib/siteleaf/job.rb
siteleaf-1.0.8 lib/siteleaf/job.rb
siteleaf-2.0.1 lib/siteleaf/job.rb
siteleaf-2.0.0 lib/siteleaf/job.rb
siteleaf-1.0.7 lib/siteleaf/job.rb
siteleaf-2.0.0.pre.beta9 lib/siteleaf/job.rb
siteleaf-1.0.6 lib/siteleaf/job.rb
siteleaf-1.0.5 lib/siteleaf/job.rb
siteleaf-1.0.4 lib/siteleaf/job.rb
siteleaf-1.0.3 lib/siteleaf/job.rb
siteleaf-1.0.2 lib/siteleaf/job.rb