Class: Celery::Shop
- Inherits:
-
Object
- Object
- Celery::Shop
- Defined in:
- lib/celery/resources/shop.rb
Instance Attribute Summary collapse
-
#api ⇒ Object
Returns the value of attribute api.
Instance Method Summary collapse
-
#check(slug) ⇒ JSON
Returns whether a product slug is being used.
-
#checkout(order) ⇒ JSON
TODO: This seems like a duplicate of Order#new.
-
#checkout_paypal(order) ⇒ JSON
TODO: This seems like a duplicate of Order#new.
-
#find(slug) ⇒ JSON
Retrieves the public details of a Product or Collection that has previously been created.
-
#initialize(api) ⇒ Shop
constructor
A new instance of Shop.
Constructor Details
#initialize(api) ⇒ Shop
Returns a new instance of Shop.
5 6 7 |
# File 'lib/celery/resources/shop.rb', line 5 def initialize(api) @api = api end |
Instance Attribute Details
#api ⇒ Object
Returns the value of attribute api.
3 4 5 |
# File 'lib/celery/resources/shop.rb', line 3 def api @api end |
Instance Method Details
#check(slug) ⇒ JSON
Returns whether a product slug is being used.
42 43 44 |
# File 'lib/celery/resources/shop.rb', line 42 def check(slug) @api.get("slugify", query: {slug: slug}) end |
#checkout(order) ⇒ JSON
TODO: This seems like a duplicate of Order#new. Checkout with credit card and creates a new order object.
69 70 71 |
# File 'lib/celery/resources/shop.rb', line 69 def checkout(order) @api.post("checkout", body: {order: order}) end |
#checkout_paypal(order) ⇒ JSON
TODO: This seems like a duplicate of Order#new. Checkout with PayPal and creates a new order object with PayPal.
96 97 98 |
# File 'lib/celery/resources/shop.rb', line 96 def checkout_paypal(order) @api.post("checkout/paypal", body: {order: order}) end |
#find(slug) ⇒ JSON
Retrieves the public details of a Product or Collection that has previously been created.
23 24 25 |
# File 'lib/celery/resources/shop.rb', line 23 def find(slug) @api.get("shop/#{slug}") end |