0.0
No commit activity in last 3 years
No release in over 3 years
Iugu Gem
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.16
~> 10.0

Runtime

~> 10.0.2
~> 0.12.1
 Project Readme

Simple Iugu

Gem to consume IuguApi

obs: the ACCOUNT_ACCESS_TOKEN constant don't need to be send if the action does not involve a sub-account

Installation

Add this line to your application's Gemfile:

gem 'simple_iugu'

And then execute:

$ bundle

Or install it yourself as:

$ gem install simple_iugu

Add this to simple_iugu.rb Initializer:

SimpleIugu.api_key = YOUR_LIVE_API_TOKEN
SimpleIugu.api_key_test = YOUR_TEST_API_TOKEN
SimpleIugu.iugu_account_id = YOUR_ACCOUNT_ID
SimpleIugu.is_test = TRUE_OR_FALSE

Customer

Create

SimpleIugu::Customer.create({
    email: 'email@example.com',
    name: 'example'
}, ACCOUNT_ACCESS_TOKEN)
Documentation https://dev.iugu.com/v1.0/reference#testinput-2

Update

SimpleIugu::Customer.update(CUSTOMER_ID, {
    email: 'email@example.com',
    name: 'example'
}, ACCOUNT_ACCESS_TOKEN)
Documentation https://dev.iugu.com/v1.0/reference#alterarr

Destroy

SimpleIugu::Customer.delete(CUSTOMER_ID, ACCOUNT_ACCESS_TOKEN)
Documentation https://dev.iugu.com/v1.0/reference#remover-1

Index

SimpleIugu::Customer.index(ACCOUNT_ACCESS_TOKEN)
Documentation https://dev.iugu.com/v1.0/reference#listar-1

Show

SimpleIugu::Customer.show(CUSTOMER_ID, ACCOUNT_ACCESS_TOKEN)
Documentation https://dev.iugu.com/v1.0/reference#

Payment Token

Create

SimpleIugu::PaymentToken.create({
    method: credit_card,
    test: TRUE_OR_FALSE,
    data: {
        number: CREDIT_CARD_NUMBER,
        verification_value: CREDIT_CARD_CVV,
        first_name: CREDIT_CARD_FIRST_NAME,
        last_name: CREDIT_CARD_LAST_NAME,
        month: CREDIT_CARD_MONTH_EXPIRATION,
        year: CREDIT_CARD_YEAR_EXPIRATION
    }
}, ACCOUNT_ACCESS_TOKEN)
Documentation https://dev.iugu.com/v1.0/reference#testinput

Payment Method

Create

SimpleIugu::PaymentMethod.create(customer_id: CUSTOMER_ID,{
    description: 'My credit card',
    token: PAYMENT_TOKEN,
    set_as_default: TRUE_OR_FALSE
}, ACCOUNT_ACCESS_TOKEN)
Documentation https://dev.iugu.com/v1.0/reference#testinput-3

Update

SimpleIugu::PaymentMethod.update(customer_id: CUSTOMER_ID, id: ID, {
    description: 'My credit card',
    set_as_default: TRUE_OR_FALSE
}, ACCOUNT_ACCESS_TOKEN)
Documentation https://dev.iugu.com/v1.0/reference#alterar

Destroy

SimpleIugu::PaymentMethod.delete(customer_id: CUSTOMER_ID, id: ID, ACCOUNT_ACCESS_TOKEN)
Documentation https://dev.iugu.com/v1.0/reference#remover-2

Show

SimpleIugu::PaymentMethod.show(customer_id: CUSTOMER_ID, id: ID, ACCOUNT_ACCESS_TOKEN)
Documentation https://dev.iugu.com/v1.0/reference#testinput-4

Index

SimpleIugu::PaymentMethod.index(customer_id: CUSTOMER_ID, ACCOUNT_ACCESS_TOKEN)
Documentation https://dev.iugu.com/v1.0/reference#listar-2

Invoice

Create

SimpleIugu::Invoice.create({
    email: 'email@example.com',
    due_date: "AAA-MM-DD",
    items: [
        {
            description: ITEM_DESCRIPTION,
            quantity: ITEM_QUANTITY,
            price_cents: UNITY_PRICE_CENTS
        }
    ]
}, ACCOUNT_ACCESS_TOKEN)
Documentation https://dev.iugu.com/v1.0/reference#criar-fatura

Duplicate

SimpleIugu::Invoice.duplicate(INVOICE_ID, {
    due_date: "AAA-MM-DD"
}, ACCOUNT_ACCESS_TOKEN)
Documentation https://dev.iugu.com/v1.0/reference#gerar-segunda-via

Capture

SimpleIugu::Invoice.capture(INVOICE_ID, ACCOUNT_ACCESS_TOKEN)
Documentation https://dev.iugu.com/v1.0/reference#capturar-fatura

Show

SimpleIugu::Invoice.show(INVOICE_ID, ACCOUNT_ACCESS_TOKEN)
Documentation https://dev.iugu.com/v1.0/reference#detalhes

Index

SimpleIugu::Invoice.index({
    limit: 50
}, ACCOUNT_ACCESS_TOKEN)
Documentation https://dev.iugu.com/v1.0/reference#listar-faturas

Cancel

SimpleIugu::Invoice.cancel(INVOICE_ID, ACCOUNT_ACCESS_TOKEN)
Documentation https://dev.iugu.com/v1.0/reference#cancelar

Refund

SimpleIugu::Invoice.refund(INVOICE_ID, ACCOUNT_ACCESS_TOKEN)
Documentation https://dev.iugu.com/v1.0/reference#reembolsar-fatura

Charge

Create

SimpleIugu::Charge.create({
    customer_payment_method_id: CUSTOMER_PAYMENT_METHOD
}, ACCOUNT_ACCESS_TOKEN)
 Documentation https://dev.iugu.com/v1.0/reference#cobranca-direta

Sub Account

Create

SimpleIugu::SubAccount.create({
    name: PARTNER_NAME,
    comission: {
        percent: SOME_PERCENT
    }
}, ACCOUNT_ACCESS_TOKEN)
 Documentation https://dev.iugu.com/v1.0/reference#criar-conta

Verify

SimpleIugu::SubAccount.verify(IUGU_ACCOUNT_ID, {
    data: {
    }
}, ACCOUNT_ACCESS_TOKEN)
 Documentation https://dev.iugu.com/v1.0/reference#enviar-verificacao-de-conta

Update

SimpleIugu::SubAccount.update({
    name: OTHER_NAME
}, ACCOUNT_ACCESS_TOKEN)
 Documentation https://dev.iugu.com/v1.0/reference#configurar-conta

Show

SimpleIugu::SubAccount.show(IUGU_ACCOUNT_ID, ACCOUNT_ACCESS_TOKEN)
 Documentation https://dev.iugu.com/v1.0/reference#informacoes-da-conta

Index

SimpleIugu::SubAccount.index({
    limit: 50
}, ACCOUNT_ACCESS_TOKEN)
 Documentation https://dev.iugu.com/v1.0/reference#listar-as-contas

Bank

Create

SimpleIugu::Bank.create({
    agency: AGENCY_NUMBER,
    account: ACCOUNT_NUMBER,
    account_type: CC_OR_CP,
    bank: BANK_NUMBER,
}, ACCOUNT_ACCESS_TOKEN)
 Documentation https://dev.iugu.com/v1.0/reference#adicionar-domicilio-bancario

Index

SimpleIugu::Bank.index(ACCOUNT_ACCESS_TOKEN)
 Documentation https://dev.iugu.com/v1.0/reference#verificar-envio-de-domic%C3%ADlio-banc%C3%A1rio

Transfer

Create

SimpleIugu::Transfer.create({
    receiver_id: ACCOUNT_ID,
    amount_cents: AMOUNT_CENTS
}, ACCOUNT_ACCESS_TOKEN)
 Documentation https://dev.iugu.com/v1.0/reference#transferir-valor

Withdrawal

Create

SimpleIugu::Withdrawal.create(ACCOUNT_ID, {
    amount: AMOUNT
}, ACCOUNT_ACCESS_TOKEN)
 Documentation https://dev.iugu.com/v1.0/reference#pedido-de-saque

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/henriqjanuario/simple_iugu.