Class: Ecommerce::Resources::InvoiceOrder

Inherits:
Base
  • Object
show all
Defined in:
lib/ecommerce/resources/invoice_order.rb

Overview

A wrapper to Ecommerce orders invoice API

API

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

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from Base

client, #initialize

Constructor Details

This class inherits a constructor from Ecommerce::Resources::Base

Instance Attribute Details

#activated_atObject (readonly)

Returns the value of attribute activated_at.



10
11
12
# File 'lib/ecommerce/resources/invoice_order.rb', line 10

def activated_at
  @activated_at
end

#amountObject (readonly)

Returns the value of attribute amount.



10
11
12
# File 'lib/ecommerce/resources/invoice_order.rb', line 10

def amount
  @amount
end

#amount_with_adjustmentsObject (readonly)

Returns the value of attribute amount_with_adjustments.



10
11
12
# File 'lib/ecommerce/resources/invoice_order.rb', line 10

def amount_with_adjustments
  @amount_with_adjustments
end

#charge_dateObject (readonly)

Returns the value of attribute charge_date.



10
11
12
# File 'lib/ecommerce/resources/invoice_order.rb', line 10

def charge_date
  @charge_date
end

#created_atObject (readonly)

Returns the value of attribute created_at.



10
11
12
# File 'lib/ecommerce/resources/invoice_order.rb', line 10

def created_at
  @created_at
end

#next_payment_dateObject (readonly)

Returns the value of attribute next_payment_date.



10
11
12
# File 'lib/ecommerce/resources/invoice_order.rb', line 10

def next_payment_date
  @next_payment_date
end

#numberObject (readonly)

Returns the value of attribute number.



10
11
12
# File 'lib/ecommerce/resources/invoice_order.rb', line 10

def number
  @number
end

#order_urlObject (readonly)

Returns the value of attribute order_url.



10
11
12
# File 'lib/ecommerce/resources/invoice_order.rb', line 10

def order_url
  @order_url
end

Returns the value of attribute paid.



10
11
12
# File 'lib/ecommerce/resources/invoice_order.rb', line 10

def paid
  @paid
end

#payment_methodObject (readonly)

Returns the value of attribute payment_method.



10
11
12
# File 'lib/ecommerce/resources/invoice_order.rb', line 10

def payment_method
  @payment_method
end

#plan_dataObject (readonly)

Returns the value of attribute plan_data.



10
11
12
# File 'lib/ecommerce/resources/invoice_order.rb', line 10

def plan_data
  @plan_data
end

#redeemed_adjustmentsObject (readonly)

Returns the value of attribute redeemed_adjustments.



10
11
12
# File 'lib/ecommerce/resources/invoice_order.rb', line 10

def redeemed_adjustments
  @redeemed_adjustments
end

#urlObject (readonly)

Returns the value of attribute url.



10
11
12
# File 'lib/ecommerce/resources/invoice_order.rb', line 10

def url
  @url
end

#user_dataObject (readonly)

Returns the value of attribute user_data.



10
11
12
# File 'lib/ecommerce/resources/invoice_order.rb', line 10

def user_data
  @user_data
end

Class Method Details

.find(invoice_order_id, order_id, slug) ⇒ Object

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



38
39
40
41
42
# 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) ⇒ Object

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



23
24
25
26
27
28
# 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