class Ecommerce::Resources::Order
A wrapper to Ecommerce
orders API
- API
-
Documentation: myfreecomm.github.io/passaporte-web/ecommerce/api/index.html
Attributes
Public Class Methods
Creates an Order
- API
-
Method:
POST /api/orders/:slug/
Documentation: myfreecomm.github.io/passaporte-web/ecommerce/api/orders.html#criacao-de-ordem-de-compra
# File lib/ecommerce/resources/order.rb, line 24 def self.create(slug, params) client.post("/api/orders/#{slug}/", body: params) do |response| build_order(response) end end
Destroys an Order
- API
-
Method:
DELETE /api/orders/:slug/:order_id/
Documentation: myfreecomm.github.io/passaporte-web/ecommerce/api/orders.html#delete-api-orders-slug-id
# File lib/ecommerce/resources/order.rb, line 68 def self.destroy(order_id, slug) client.delete("/api/orders/#{slug}/#{order_id}/") do |response| build_order(response) end end
Finds an Order
- API
-
Method:
GET /api/orders/:slug/:order_id/
Documentation: myfreecomm.github.io/passaporte-web/ecommerce/api/orders.html#detalhes-de-uma-ordem-de-compra
# File lib/ecommerce/resources/order.rb, line 54 def self.find(order_id, slug) client.get("/api/orders/#{slug}/#{order_id}/") do |response| build_order(response) end end
Lists all Orders of a slug and return a collection with orders and pagination information (represented by Ecommerce::Resources::OrderCollection
)
- API
-
Method:
GET /api/orders/:slug/
Documentation: myfreecomm.github.io/passaporte-web/ecommerce/api/orders.html#listagem-de-ordens-de-compra
# File lib/ecommerce/resources/order.rb, line 39 def self.find_all(slug, page = 1, limit = 20) body = { page: page, limit: limit } client.get("/api/orders/#{slug}/", body: body) do |response| Ecommerce::Resources::OrderCollection.build(response) end end
Updates an Order
client information
- API
-
Method:
PUT /api/orders/:slug/:order_id/
Documentation for available and required fields: myfreecomm.github.io/passaporte-web/ecommerce/api/orders.html#put-api-orders-slug-id
# File lib/ecommerce/resources/order.rb, line 82 def self.update(order_id, slug, order_params={}) client.put("/api/orders/#{slug}/#{order_id}/", body: order_params) do |response| build_order(response) end end
Private Class Methods
# File lib/ecommerce/resources/order.rb, line 90 def self.build_order(response) order_attributes = parsed_body(response) order_attributes.empty? ? {} : new(order_attributes) end