Sha256: 4a5076a4d201016df9b1cd8f859fdfbe9eced42eb707b5d46598d14a62370de9

Contents?: true

Size: 597 Bytes

Versions: 2

Compression:

Stored size: 597 Bytes

Contents

module CrowdFlower
  class Order < Base
    attr_reader :job
    
    def initialize(job)
      super job.connection
      @job = job
      connect
    end

    def resource_uri
      "/jobs/#{@job.id}/orders.json"
    end
    
    # defaults to on_demand; pass in diff channel name to launch job with that channel
    # use job.enable_channels("channel_name") if you to keep on_demand and add another channel
    def debit(units_count = 1, channels = ["on_demand"])
      connection.post(resource_uri, {:body => {:debit => {:units_count => units_count}, :channels => channels}})
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
crowdflower-0.12.0 lib/crowdflower/order.rb
crowdflower-0.11.0 lib/crowdflower/order.rb