Class: FetchAPI::Order
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#id ⇒ Object
Returns the value of attribute id.
Class Method Summary collapse
-
.create(options = {}) ⇒ Object
Creates a new order.
-
.find(selector, params = {}) ⇒ Object
– Class Methods ############### –.
Instance Method Summary collapse
-
#destroy ⇒ Object
Permanently deletes the order.
-
#expire ⇒ Object
Sets the expiration date to Time.now, stopping future downloads.
-
#send_email(options = {}) ⇒ Object
Delivers the email containing the download instructions.
-
#update(options = {}) ⇒ Object
Immediately updates the order with the new parameters.
Methods inherited from Base
Constructor Details
This class inherits a constructor from FetchAPI::Base
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class FetchAPI::Base
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
4 5 6 |
# File 'lib/fetchapi/order.rb', line 4 def attributes @attributes end |
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/fetchapi/order.rb', line 4 def id @id end |
Class Method Details
.create(options = {}) ⇒ Object
Creates a new order
27 28 29 |
# File 'lib/fetchapi/order.rb', line 27 def self.create(={}) execute(:post, "/orders/create", :order => ) end |
.find(selector, params = {}) ⇒ Object
– Class Methods ############### –
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/fetchapi/order.rb', line 10 def self.find(selector, params={}) case selector when :current params.merge!(:filter => "current") execute(:get, "/#{pluralized_class_name}?#{params.to_params}")[pluralized_class_name].map { |data| new(data) } when :manual params.merge!(:filter => "manual") execute(:get, "/#{pluralized_class_name}?#{params.to_params}")[pluralized_class_name].map { |data| new(data) } when :expired params.merge!(:filter => "expired") execute(:get, "/#{pluralized_class_name}?#{params.to_params}")[pluralized_class_name].map { |data| new(data) } else super end end |
Instance Method Details
#destroy ⇒ Object
Permanently deletes the order
36 37 38 |
# File 'lib/fetchapi/order.rb', line 36 def destroy delete("/orders/#{id}/delete") end |
#expire ⇒ Object
Sets the expiration date to Time.now, stopping future downloads
41 42 43 |
# File 'lib/fetchapi/order.rb', line 41 def expire post("/orders/#{id}/expire") end |
#send_email(options = {}) ⇒ Object
Delivers the email containing the download instructions. Optional params:
reset_expiration (true/false): Reset the order's expiration. Defaults to true.
expiration_date (2009-04-30T15:03:46+00:00): Manually sets the order's expiration date
49 50 51 |
# File 'lib/fetchapi/order.rb', line 49 def send_email(={}) post("/orders/#{id}/send_email", ) end |
#update(options = {}) ⇒ Object
Immediately updates the order with the new parameters
54 55 56 |
# File 'lib/fetchapi/order.rb', line 54 def update(={}) put("/orders/#{id}", :order => ) end |