Sha256: 5a830cfc8401c23cb0f79e8fe5af8ca80ea61c328c455c6e7dbb007ed7216efd
Contents?: true
Size: 1.66 KB
Versions: 1
Compression:
Stored size: 1.66 KB
Contents
class Blitline require 'yajl' require 'blitline/attribute_jsonizer' require 'blitline/function' require 'blitline/job' require 'blitline/save' require 'blitline/s3_destination' require 'blitline/http_poster' include AttributeJsonizer attr_accessor :jobs def initialize @jobs = [] end # Heroku users don't need to specify application_id if they have ENV['BLITLINE_URL'] defined def add_job(image_source, function_name, function_params, image_identifier, application_id = nil) job = Blitline::Job.new(image_source) environment_app_id = ENV['BLITLINE_URL'] && ENV['BLITLINE_URL'].split("/").last job.application_id = environment_app_id || application_id job.add_function(function_name, function_params, image_identifier) @jobs << job end # Heroku users don't need to specify application_id if they have ENV['BLITLINE_URL'] defined def add_job_with_callback(image_source, function_name, function_params, image_identifier, postback_url, application_id = nil) job = Blitline::Job.new(image_source) environment_app_id = ENV['BLITLINE_URL'] && ENV['BLITLINE_URL'].split("/").last job.application_id = environment_app_id || application_id job.add_function(function_name, function_params, image_identifier) job.postback_url = postback_url @jobs << job end def validate raise "At least 1 job must be present to run" if @jobs.length < 1 @jobs.each { |j| j.validate } end def post_jobs validate puts "@jobs = #{Yajl::Encoder.encode(@jobs)}" result = Blitline::HttpPoster.post("http://api.blitline.com/job", { :json => Yajl::Encoder.encode(@jobs)}) return Yajl::Parser.parse(result) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
blitline-1.2.2 | lib/blitline.rb |