class Ecommerce::Resources::InvoiceOrder

A wrapper to Ecommerce orders invoice API

API

Documentation: myfreecomm.github.io/passaporte-web/ecommerce/api/index.html

Attributes

activated_at[R]
amount[R]
amount_with_adjustments[R]
charge_date[R]
created_at[R]
next_payment_date[R]
number[R]
order_url[R]
paid[R]
payment_method[R]
plan_data[R]
redeemed_adjustments[R]
url[R]
user_data[R]

Public Class Methods

find(invoice_order_id, order_id, slug) click to toggle source

Finds an invoice of an order

API

Method: GET /api/orders/:slug/:order_id/invoices/:id/

Documentation: myfreecomm.github.io/passaporte-web/ecommerce/api/orders.html#listagem-das-ordens-de-compra-de-uma-conta

# File lib/ecommerce/resources/invoice_order.rb, line 38
def self.find(invoice_order_id, order_id, slug)
  client.get("/api/orders/#{slug}/#{order_id}/invoices/#{invoice_order_id}/") do |response|
    build_invoice(response)
  end
end
find_all(order_id, slug, page = 1, limit = 20) click to toggle source

Lists all invoice of an orders and return a collection of invoice with pagination information (represented by Ecommerce::Resources::InvoiceOrderCollection)

API

Method: GET /api/orders/:slug/:id/invoices/

Documentation: myfreecomm.github.io/passaporte-web/ecommerce/api/orders.html#listagem-das-ordens-de-compra-de-uma-conta

# File lib/ecommerce/resources/invoice_order.rb, line 23
def self.find_all(order_id, slug, page = 1, limit = 20)
  body = { page: page, limit: limit }
  client.get("/api/orders/#{slug}/#{order_id}/invoices/", body: body) do |response|
    Ecommerce::Resources::InvoiceOrderCollection.build(response)
  end
end

Private Class Methods

build_invoice(response) click to toggle source
# File lib/ecommerce/resources/invoice_order.rb, line 46
def self.build_invoice(response)
  invoice_attributes = parsed_body(response)
  invoice_attributes.empty? ? {} : new(invoice_attributes)
end