Class: FetchAppAPI::OrderItem
- Defined in:
- lib/fetchapp-api-ruby/order_item.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#id ⇒ Object
Returns the value of attribute id.
Class Method Summary collapse
-
.find(selector, params = {}) ⇒ Object
Finds an Order or orders based on the specified parameters :all or by ID.
Instance Method Summary collapse
-
#downloads(params = {}) ⇒ Object
Returns all the downloads associated with this Order.
-
#expire ⇒ Object
Sets the expiration date to Time.now, stopping future downloads.
- #files(params = {}) ⇒ Object
Methods inherited from Base
basic_auth, can_connect?, #initialize, key, time
Constructor Details
This class inherits a constructor from FetchAppAPI::Base
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class FetchAppAPI::Base
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
4 5 6 |
# File 'lib/fetchapp-api-ruby/order_item.rb', line 4 def attributes @attributes end |
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/fetchapp-api-ruby/order_item.rb', line 4 def id @id end |
Class Method Details
.find(selector, params = {}) ⇒ Object
Finds an Order or orders based on the specified parameters :all or by ID
12 13 14 |
# File 'lib/fetchapp-api-ruby/order_item.rb', line 12 def self.find(selector, params={}) super(selector, params) end |
Instance Method Details
#downloads(params = {}) ⇒ Object
Returns all the downloads associated with this Order
26 27 28 29 30 31 32 33 |
# File 'lib/fetchapp-api-ruby/order_item.rb', line 26 def downloads(params={}) downloads = get("/orders/#{order_id}/order_items/#{id}/downloads") if downloads downloads["downloads"].map { |data| FetchAppAPI::Download.new(data) } else return [] end end |
#expire ⇒ Object
Sets the expiration date to Time.now, stopping future downloads
21 22 23 |
# File 'lib/fetchapp-api-ruby/order_item.rb', line 21 def expire post("/orders/#{order_id}/order_items/#{id}/expire") end |
#files(params = {}) ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/fetchapp-api-ruby/order_item.rb', line 35 def files(params={}) files = get("/orders/#{order_id}/order_items/#{id}/files") if files files["files"].map { |data| FetchAppAPI::File.new(data) } else return [] end end |