Class: CrowdFlower::Order
Instance Attribute Summary collapse
-
#job ⇒ Object
readonly
Returns the value of attribute job.
Attributes inherited from Base
Instance Method Summary collapse
-
#debit(units_count = 1, channels = ["on_demand"]) ⇒ Object
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.
-
#initialize(job) ⇒ Order
constructor
A new instance of Order.
- #resource_uri ⇒ Object
Methods inherited from Base
connect, #connect, connect!, connect_config!, connect_domain!, connection, #connection, delete, get, post, put, verify_response
Constructor Details
#initialize(job) ⇒ Order
Returns a new instance of Order.
5 6 7 8 9 |
# File 'lib/crowdflower/order.rb', line 5 def initialize(job) super job.connection @job = job connect end |
Instance Attribute Details
#job ⇒ Object (readonly)
Returns the value of attribute job.
3 4 5 |
# File 'lib/crowdflower/order.rb', line 3 def job @job end |
Instance Method Details
#debit(units_count = 1, channels = ["on_demand"]) ⇒ Object
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
17 18 19 |
# File 'lib/crowdflower/order.rb', line 17 def debit(units_count = 1, channels = ["on_demand"]) connection.post(resource_uri, {:body => {:debit => {:units_count => units_count}, :channels => channels}}) end |
#resource_uri ⇒ Object
11 12 13 |
# File 'lib/crowdflower/order.rb', line 11 def resource_uri "/jobs/#{@job.id}/orders.json" end |