Class: Freelabster::Cart
- Inherits:
-
Object
- Object
- Freelabster::Cart
- Defined in:
- lib/freelabster/cart.rb
Overview
Builds a Cart of 3D files for a user.
Example:
cart = Freelabster::Cart.new(file_urls: "http://example.com/file.stl")
Instance Method Summary collapse
-
#initialize(file_urls:, api: API.new) ⇒ Cart
constructor
A new instance of Cart.
-
#url(params = {}) ⇒ Object
Returns the user-facing URL for the cart Takes extra custom parameters you may want to add to the URL.
Constructor Details
Instance Method Details
#url(params = {}) ⇒ Object
Returns the user-facing URL for the cart Takes extra custom parameters you may want to add to the URL.
Example:
cart.url
# => "https://www.freelabster.com/dashboard/order/?token=zaef..."
cart.url(foo: 1)
# => "https://www.freelabster.com/dashboard/order/?foo=1&token=zaef..."
20 21 22 23 24 |
# File 'lib/freelabster/cart.rb', line 20 def url(params = {}) uri = URI("https://www.freelabster.com/dashboard/order/cart") uri.query = URI.encode_www_form(params.merge(token: token)) uri.to_s end |