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 = ["amt"]) ⇒ Object
-
#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 = ["amt"]) ⇒ Object
15 16 17 |
# File 'lib/crowdflower/order.rb', line 15 def debit(units_count = 1, channels = ["amt"]) connection.post(resource_uri, {:query => {: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 |