Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
repos:
# Websec hook is MANDATORY, DO NOT comment it.
- repo: https://github.com/melisource/fury_websec-git-hooks
rev: v2.0.0
hooks:
- id: pre_commit_hook
stages: [commit]
- id: post_commit_hook
stages: [post-commit]

# Datasec hook is MANDATORY, DO NOT comment it.
- repo: https://github.com/melisource/fury_datasec-git-hooks
rev: 1.2.2
hooks:
- id: pre_commit_hook
stages: [commit]
verbose: true
- id: post_commit_hook
stages: [post-commit]
26 changes: 26 additions & 0 deletions examples/preference/create.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
require_relative '../../lib/mercadopago'

sdk = Mercadopago::SDK.new('YOUR_ACCESS_TOKEN')

def create_preference(sdk)
data = {
items: [
{
title: 'Test Item',
quantity: 1,
unit_price: 10.0
}
],
notification_url: 'https://webhook.site/your-dummy-url'
}

preference = sdk.preference.create(data)
puts preference
rescue MercadoPago::MPApiException => e
puts "Status code: #{e.api_response.status_code}"
puts "Content: #{e.api_response.content}"
rescue StandardError => e
puts e.message
end

create_preference(sdk)