Class: Ecommerce::Resources::Order
- Defined in:
- lib/ecommerce/resources/order.rb
Overview
A wrapper to Ecommerce orders API
- API
-
Documentation: myfreecomm.github.io/passaporte-web/ecommerce/api/index.html
Instance Attribute Summary collapse
-
#activated_at ⇒ Object
readonly
Returns the value of attribute activated_at.
-
#activation_expired ⇒ Object
readonly
Returns the value of attribute activation_expired.
-
#active_until ⇒ Object
readonly
Returns the value of attribute active_until.
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#address_city ⇒ Object
readonly
Returns the value of attribute address_city.
-
#address_complement ⇒ Object
readonly
Returns the value of attribute address_complement.
-
#address_number ⇒ Object
readonly
Returns the value of attribute address_number.
-
#address_quarter ⇒ Object
readonly
Returns the value of attribute address_quarter.
-
#address_state ⇒ Object
readonly
Returns the value of attribute address_state.
-
#adjustments_url ⇒ Object
readonly
Returns the value of attribute adjustments_url.
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#api_url ⇒ Object
readonly
Returns the value of attribute api_url.
-
#charge_day ⇒ Object
readonly
Returns the value of attribute charge_day.
-
#checkout_url ⇒ Object
readonly
Returns the value of attribute checkout_url.
-
#client_email ⇒ Object
readonly
Returns the value of attribute client_email.
-
#client_name ⇒ Object
readonly
Returns the value of attribute client_name.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#discounts_url ⇒ Object
readonly
Returns the value of attribute discounts_url.
-
#document_number ⇒ Object
readonly
Returns the value of attribute document_number.
-
#global_account ⇒ Object
readonly
Returns the value of attribute global_account.
-
#invoices_url ⇒ Object
readonly
Returns the value of attribute invoices_url.
-
#is_active ⇒ Object
readonly
Returns the value of attribute is_active.
-
#is_paid ⇒ Object
readonly
Returns the value of attribute is_paid.
-
#is_recurring ⇒ Object
readonly
Returns the value of attribute is_recurring.
-
#is_trial ⇒ Object
readonly
Returns the value of attribute is_trial.
-
#next_payment_at ⇒ Object
readonly
Returns the value of attribute next_payment_at.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#plan_change_urls ⇒ Object
readonly
Returns the value of attribute plan_change_urls.
-
#plan_slug ⇒ Object
readonly
Returns the value of attribute plan_slug.
-
#user_code ⇒ Object
readonly
Returns the value of attribute user_code.
-
#zip_code ⇒ Object
readonly
Returns the value of attribute zip_code.
Class Method Summary collapse
-
.create(slug, params) ⇒ Object
Creates an Order.
-
.destroy(order_id, slug) ⇒ Object
Destroys an Order.
-
.find(order_id, slug) ⇒ Object
Finds an Order.
-
.find_all(slug, page = 1, limit = 20) ⇒ Object
Lists all Orders of a slug and return a collection with orders and pagination information (represented by Ecommerce::Resources::OrderCollection).
-
.update(order_id, slug, order_params = {}) ⇒ Object
Updates an Order client information.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Ecommerce::Resources::Base
Instance Attribute Details
#activated_at ⇒ Object (readonly)
Returns the value of attribute activated_at.
10 11 12 |
# File 'lib/ecommerce/resources/order.rb', line 10 def activated_at @activated_at end |
#activation_expired ⇒ Object (readonly)
Returns the value of attribute activation_expired.
10 11 12 |
# File 'lib/ecommerce/resources/order.rb', line 10 def activation_expired @activation_expired end |
#active_until ⇒ Object (readonly)
Returns the value of attribute active_until.
10 11 12 |
# File 'lib/ecommerce/resources/order.rb', line 10 def active_until @active_until end |
#address ⇒ Object (readonly)
Returns the value of attribute address.
10 11 12 |
# File 'lib/ecommerce/resources/order.rb', line 10 def address @address end |
#address_city ⇒ Object (readonly)
Returns the value of attribute address_city.
10 11 12 |
# File 'lib/ecommerce/resources/order.rb', line 10 def address_city @address_city end |
#address_complement ⇒ Object (readonly)
Returns the value of attribute address_complement.
10 11 12 |
# File 'lib/ecommerce/resources/order.rb', line 10 def address_complement @address_complement end |
#address_number ⇒ Object (readonly)
Returns the value of attribute address_number.
10 11 12 |
# File 'lib/ecommerce/resources/order.rb', line 10 def address_number @address_number end |
#address_quarter ⇒ Object (readonly)
Returns the value of attribute address_quarter.
10 11 12 |
# File 'lib/ecommerce/resources/order.rb', line 10 def address_quarter @address_quarter end |
#address_state ⇒ Object (readonly)
Returns the value of attribute address_state.
10 11 12 |
# File 'lib/ecommerce/resources/order.rb', line 10 def address_state @address_state end |
#adjustments_url ⇒ Object (readonly)
Returns the value of attribute adjustments_url.
10 11 12 |
# File 'lib/ecommerce/resources/order.rb', line 10 def adjustments_url @adjustments_url end |
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
10 11 12 |
# File 'lib/ecommerce/resources/order.rb', line 10 def amount @amount end |
#api_url ⇒ Object (readonly)
Returns the value of attribute api_url.
10 11 12 |
# File 'lib/ecommerce/resources/order.rb', line 10 def api_url @api_url end |
#charge_day ⇒ Object (readonly)
Returns the value of attribute charge_day.
10 11 12 |
# File 'lib/ecommerce/resources/order.rb', line 10 def charge_day @charge_day end |
#checkout_url ⇒ Object (readonly)
Returns the value of attribute checkout_url.
10 11 12 |
# File 'lib/ecommerce/resources/order.rb', line 10 def checkout_url @checkout_url end |
#client_email ⇒ Object (readonly)
Returns the value of attribute client_email.
10 11 12 |
# File 'lib/ecommerce/resources/order.rb', line 10 def client_email @client_email end |
#client_name ⇒ Object (readonly)
Returns the value of attribute client_name.
10 11 12 |
# File 'lib/ecommerce/resources/order.rb', line 10 def client_name @client_name end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
10 11 12 |
# File 'lib/ecommerce/resources/order.rb', line 10 def created_at @created_at end |
#discounts_url ⇒ Object (readonly)
Returns the value of attribute discounts_url.
10 11 12 |
# File 'lib/ecommerce/resources/order.rb', line 10 def discounts_url @discounts_url end |
#document_number ⇒ Object (readonly)
Returns the value of attribute document_number.
10 11 12 |
# File 'lib/ecommerce/resources/order.rb', line 10 def document_number @document_number end |
#global_account ⇒ Object (readonly)
Returns the value of attribute global_account.
10 11 12 |
# File 'lib/ecommerce/resources/order.rb', line 10 def global_account @global_account end |
#invoices_url ⇒ Object (readonly)
Returns the value of attribute invoices_url.
10 11 12 |
# File 'lib/ecommerce/resources/order.rb', line 10 def invoices_url @invoices_url end |
#is_active ⇒ Object (readonly)
Returns the value of attribute is_active.
10 11 12 |
# File 'lib/ecommerce/resources/order.rb', line 10 def is_active @is_active end |
#is_paid ⇒ Object (readonly)
Returns the value of attribute is_paid.
10 11 12 |
# File 'lib/ecommerce/resources/order.rb', line 10 def is_paid @is_paid end |
#is_recurring ⇒ Object (readonly)
Returns the value of attribute is_recurring.
10 11 12 |
# File 'lib/ecommerce/resources/order.rb', line 10 def is_recurring @is_recurring end |
#is_trial ⇒ Object (readonly)
Returns the value of attribute is_trial.
10 11 12 |
# File 'lib/ecommerce/resources/order.rb', line 10 def is_trial @is_trial end |
#next_payment_at ⇒ Object (readonly)
Returns the value of attribute next_payment_at.
10 11 12 |
# File 'lib/ecommerce/resources/order.rb', line 10 def next_payment_at @next_payment_at end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
10 11 12 |
# File 'lib/ecommerce/resources/order.rb', line 10 def number @number end |
#plan_change_urls ⇒ Object (readonly)
Returns the value of attribute plan_change_urls.
10 11 12 |
# File 'lib/ecommerce/resources/order.rb', line 10 def plan_change_urls @plan_change_urls end |
#plan_slug ⇒ Object (readonly)
Returns the value of attribute plan_slug.
10 11 12 |
# File 'lib/ecommerce/resources/order.rb', line 10 def plan_slug @plan_slug end |
#user_code ⇒ Object (readonly)
Returns the value of attribute user_code.
10 11 12 |
# File 'lib/ecommerce/resources/order.rb', line 10 def user_code @user_code end |
#zip_code ⇒ Object (readonly)
Returns the value of attribute zip_code.
10 11 12 |
# File 'lib/ecommerce/resources/order.rb', line 10 def zip_code @zip_code end |
Class Method Details
.create(slug, params) ⇒ Object
Creates an Order
- API
-
Method:
POST /api/orders/:slug/
Documentation: myfreecomm.github.io/passaporte-web/ecommerce/api/orders.html#criacao-de-ordem-de-compra
24 25 26 27 28 |
# 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 |
.destroy(order_id, slug) ⇒ Object
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
68 69 70 71 72 |
# 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 |
.find(order_id, slug) ⇒ Object
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
54 55 56 57 58 |
# 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 |
.find_all(slug, page = 1, limit = 20) ⇒ Object
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
39 40 41 42 43 44 |
# 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 |
.update(order_id, slug, order_params = {}) ⇒ Object
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
82 83 84 85 86 |
# 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 |