Skip to content

Commit

Permalink
Adiciona endpoint de lotes de exportação, métodos para captura de cob…
Browse files Browse the repository at this point in the history
…rança e desarquivamento de clientes (#16)
  • Loading branch information
st3llaris authored Sep 11, 2019
1 parent 6c20ec3 commit 204ba6f
Show file tree
Hide file tree
Showing 15 changed files with 518 additions and 6 deletions.
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Notas das versões


## [v0.0.6 - 11/09/2019](https://github.com/vindi/vindi-ruby/releases/tag/v0.0.6)
- Adiciona endpoint de lotes de exportação
- Adiciona método para captura de uma cobrança
- Adiciona método para desarquivamento de clientes

## [v0.0.5 - 26/04/2019](https://github.com/vindi/vindi-ruby/releases/tag/v0.0.5)


## [v0.0.4 - 25/04/2019](https://github.com/vindi/vindi-ruby/releases/tag/v0.0.4)


## [v0.0.3 - 23/04/2019](https://github.com/vindi/vindi-ruby/releases/tag/v0.0.3)


## [v0.0.2 - 23/04/2019](https://github.com/vindi/vindi-ruby/releases/tag/v0.0.2)


## [v0.0.1 - 23/04/2019](https://github.com/vindi/vindi-ruby/releases/tag/v0.0.1)
- Versão Inicial
1 change: 1 addition & 0 deletions lib/vindi/rest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module Rest
include Vindi::Rest::Invoice
include Vindi::Rest::Message
include Vindi::Rest::ImportBatch
include Vindi::Rest::ExportBatch
include Vindi::Rest::Notification
include Vindi::Rest::Issue
include Vindi::Rest::Merchant
Expand Down
16 changes: 15 additions & 1 deletion lib/vindi/rest/charge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ module Charge
def list_charges(options = {})
get('charges', options)[:charges]
end



# Get a single charge from a merchant
#
# @param charge_id [Integer] ID of the charge
Expand Down Expand Up @@ -89,6 +90,19 @@ def fraud_review(charge_id, options = {})
def delete_charge(charge_id, options = {})
delete("charges/#{charge_id}", options)[:charge]
end


# Capture a charge from merchant vindi
#
# @params charge_id [Integer] ID of the charge
# @option options [Hash] :options charge attributes
#
# @see https://vindi.github.io/api-docs/dist/#!/charges/POST_version_charges_id_capture_format
# @example Capture charge #2
# client.capture_charge(2)
def capture_charge(charge_id, options = {})
post("charges/#{charge_id}/capture", options)[:charge]
end
end
end
end
19 changes: 16 additions & 3 deletions lib/vindi/rest/customer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module Customer
def list_customers(options = {})
get('customers', options)[:customers]
end

# Get a single customer from a merchant
#
# @param customer_id [Integer] ID of the customer
Expand All @@ -24,9 +24,9 @@ def customer(customer_id, options = {})
end

# Create a customer for a merchant vindi
#
#
# @option options [Hash] :options customer attributes
# @see https://vindi.github.io/api-docs/dist/#!/customers/POST_version_customers_format
# @see https://vindi.github.io/api-docs/dist/#!/customers/POST_version_customers_format
# @return [Hash] The customer created
# @example Create a customer for a merchant vindi
# client.create_customer(name: 'John Doe', email: '[email protected]')
Expand Down Expand Up @@ -56,6 +56,19 @@ def update_customer(customer_id, options = {})
def delete_customer(customer_id, options = {})
delete("customers/#{customer_id}", options)[:customer]
end


# Unarchive a customer from merchant vindi
#
# @params customer_id [Integer] ID of the customer
# @option options [Hash] :options customer attributes
#
# @see https://vindi.github.io/api-docs/dist/#!/customers/POST_version_customers_id_unarchive_format
# @example Unarchive customer #2
# client.unarchive_customer(2)
def unarchive_customer(customer_id, options = {})
post("customers/#{customer_id}/unarchive", options)[:customer]
end
end
end
end
52 changes: 52 additions & 0 deletions lib/vindi/rest/export_batch.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
module Vindi
module Rest

# Methods for the export_batches API
# @see https://vindi.github.io/api-docs/dist/#!/export_batches
module ExportBatch

# List export batches for the authenticate user
# @option options [Integer] :page (1) Page number.
# @option options [Integer] :merchant Merchant account
# @return [Array<Hash>] A list of export batches for a merchant.
# @example Get all export batches from merchant vindi
def list_export_batches(options = {})
get('export_batches', options)[:export_batches]
end

# Get a single export batch from a merchant
#
# @param export_batch_id [Integer] ID of the export batch
# @return [Hash] The export batch you requested, if it exists
# @see https://vindi.github.io/api-docs/dist/#!/export_batches/GET_version_export_batches_id_format
# @example Get export batch #154 from vindi
# client.export_batch(154)
def export_batch(export_batch_id, options = {})
get("export_batches/#{export_batch_id}", options)[:export_batch]
end

# Create an export batch for a merchant vindi
#
# @option options [Hash] :options export_batch attributes
# @see https://vindi.github.io/api-docs/dist/#!/export_batches/POST_version_export_batches_format
# @return [Hash] The export batch created
# @example Create an export batch for a merchant vindi
# client.create_export_batch({ "payment_method_code": 2, "payment_company_code": "itau" })
def create_export_batch(options = {})
post('export_batches', options)[:export_batch]
end


# Approve an export batch for a merchant vindi
#
# @option options [Hash] :options export_batch attributes
# @see https://vindi.github.io/api-docs/dist/#!/export_batches/POST_version_export_batches_id_approve_format
# @return [Hash] The export batch approved
# @example Approve an export batch for a merchant vindi
# client.approve_export_batch(2)
def approve_export_batch(export_batch_id, options = {})
post("export_batches/#{export_batch_id}/approve", options)[:export_batch]
end
end
end
end
2 changes: 1 addition & 1 deletion lib/vindi/rest/import_batch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Rest
# @see https://vindi.github.io/api-docs/dist/#!/import_batches
module ImportBatch

# List import_batchs for the authenticate user
# List import_batches for the authenticate user
# @option options [Integer] :page (1) Page number.
# @option options [Integer] :merchant Merchant account
# @return [Array<Hash>] A list of imported batches for a merchant.
Expand Down
57 changes: 57 additions & 0 deletions spec/cassettes/vindi/rest/charges/capture_charge.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 56 additions & 0 deletions spec/cassettes/vindi/rest/customers/unarchive_customer.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 57 additions & 0 deletions spec/cassettes/vindi/rest/export_batches/approve_export_batch.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 57 additions & 0 deletions spec/cassettes/vindi/rest/export_batches/create_export_batch.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 204ba6f

Please sign in to comment.