Sha256: 10807a73e8e7be3287b75e3833ea43866639475204499ac2f5f3736de0192b85
Contents?: true
Size: 818 Bytes
Versions: 2
Compression:
Stored size: 818 Bytes
Contents
module SauceWhisk class Assets extend RestRequestBuilder def self.resource "#{SauceWhisk.username}/jobs" end def self.fetch(job_id, asset, type=nil) retries ||= SauceWhisk.asset_fetch_retries attempts ||= 1 data = get "#{job_id}/assets/#{asset}" Asset.new({:name => asset, :data => data, :job_id => job_id, :type => type}) rescue RestClient::ResourceNotFound => e if attempts <= retries attempts += 1 sleep(5) retry else raise e end end end class Asset attr_reader :asset_type, :name, :data, :job def initialize(parameters={}) @asset_type = parameters[:type] || :screenshot @name = parameters[:name] @data = parameters[:data] @job = parameters[:job_id] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sauce_whisk-0.0.13 | lib/sauce_whisk/assets.rb |
sauce_whisk-0.0.12 | lib/sauce_whisk/assets.rb |