Sha256: 259567a243ee5486980f6aef4c7a31cd47570b82bcc5fd4d0b0fd73c91fba70f
Contents?: true
Size: 1.36 KB
Versions: 1
Compression:
Stored size: 1.36 KB
Contents
require_relative 'api_client' module IronWorkerNG class ClientProxyCaller def initialize(client, prefix) @client = client @prefix = prefix end def method_missing(name, *args, &block) full_name = @prefix.to_s + '_' + name.to_s if @client.respond_to?(full_name) @client.send(full_name, *args, &block) else super end end end class Client attr_reader :api def initialize(token, project_id, params = {}) @api = IronWorkerNG::APIClient.new(token, project_id, params) end def method_missing(name, *args, &block) if args.length == 0 IronWorkerNG::ClientProxyCaller.new(self, name) else super end end def codes_create(code) zip_file = code.create_zip @api.codes_create(code.name, zip_file, code.runtime, code.runner) File.unlink(zip_file) true end def tasks_create(code_name, params = {}, options = {}) res = @api.tasks_create(code_name, {:project_id => @api.project_id, :token => @api.token, :params => params}.to_json, options) res['tasks'][0]['id'] end def schedules_create(code_name, params = {}, options = {}) res = @api.schedules_create(code_name, {:project_id => @api.project_id, :token => @api.token, :params => params}.to_json, options) res['schedules'][0]['id'] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
iron_worker_ng-0.1.2 | lib/iron_worker_ng/client.rb |