mercadopago-sdk 0.3.6 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +5 -5
  2. data/.editorconfig +10 -0
  3. data/.github/ISSUE_TEMPLATE/bug_report.md +28 -0
  4. data/.github/ISSUE_TEMPLATE/feature_request.md +19 -0
  5. data/.github/workflows/ruby.yml +35 -0
  6. data/.gitignore +2 -1
  7. data/.rubocop.yml +1 -0
  8. data/.rubocop_todo.yml +104 -0
  9. data/.ruby-version +1 -0
  10. data/CODE_OF_CONDUCT.md +74 -0
  11. data/CODING_GUIDELINES.md +70 -0
  12. data/CONTRIBUTING.md +57 -0
  13. data/Gemfile +8 -0
  14. data/Gemfile.lock +51 -12
  15. data/LICENSE.txt +21 -0
  16. data/README.md +54 -143
  17. data/Rakefile +3 -1
  18. data/docs/CODE_OF_CONDUCT_md.html +154 -0
  19. data/docs/CODING_GUIDELINES_md.html +188 -0
  20. data/docs/CONTRIBUTING_md.html +165 -0
  21. data/docs/LICENSE_txt.html +96 -0
  22. data/docs/Mercadopago.html +123 -0
  23. data/docs/Mercadopago/AdvancedPayment.html +279 -0
  24. data/docs/Mercadopago/Card.html +204 -0
  25. data/docs/Mercadopago/CardToken.html +160 -0
  26. data/docs/Mercadopago/Config.html +266 -0
  27. data/docs/Mercadopago/Customer.html +228 -0
  28. data/docs/Mercadopago/DisbursementRefund.html +183 -0
  29. data/docs/Mercadopago/HttpClient.html +249 -0
  30. data/docs/Mercadopago/IdentificationType.html +136 -0
  31. data/docs/Mercadopago/MPBase.html +316 -0
  32. data/docs/Mercadopago/MerchantOrder.html +209 -0
  33. data/docs/Mercadopago/Payment.html +208 -0
  34. data/docs/Mercadopago/PaymentMethods.html +136 -0
  35. data/docs/Mercadopago/Preference.html +184 -0
  36. data/docs/Mercadopago/Refund.html +160 -0
  37. data/docs/Mercadopago/RequestOptions.html +433 -0
  38. data/docs/Mercadopago/SDK.html +528 -0
  39. data/docs/Mercadopago/User.html +136 -0
  40. data/docs/README_md.html +181 -0
  41. data/docs/created.rid +25 -0
  42. data/docs/css/fonts.css +167 -0
  43. data/docs/css/rdoc.css +619 -0
  44. data/docs/fonts/Lato-Light.ttf +0 -0
  45. data/docs/fonts/Lato-LightItalic.ttf +0 -0
  46. data/docs/fonts/Lato-Regular.ttf +0 -0
  47. data/docs/fonts/Lato-RegularItalic.ttf +0 -0
  48. data/docs/fonts/SourceCodePro-Bold.ttf +0 -0
  49. data/docs/fonts/SourceCodePro-Regular.ttf +0 -0
  50. data/docs/images/add.png +0 -0
  51. data/docs/images/arrow_up.png +0 -0
  52. data/docs/images/brick.png +0 -0
  53. data/docs/images/brick_link.png +0 -0
  54. data/docs/images/bug.png +0 -0
  55. data/docs/images/bullet_black.png +0 -0
  56. data/docs/images/bullet_toggle_minus.png +0 -0
  57. data/docs/images/bullet_toggle_plus.png +0 -0
  58. data/docs/images/date.png +0 -0
  59. data/docs/images/delete.png +0 -0
  60. data/docs/images/find.png +0 -0
  61. data/docs/images/loadingAnimation.gif +0 -0
  62. data/docs/images/macFFBgHack.png +0 -0
  63. data/docs/images/package.png +0 -0
  64. data/docs/images/page_green.png +0 -0
  65. data/docs/images/page_white_text.png +0 -0
  66. data/docs/images/page_white_width.png +0 -0
  67. data/docs/images/plugin.png +0 -0
  68. data/docs/images/ruby.png +0 -0
  69. data/docs/images/tag_blue.png +0 -0
  70. data/docs/images/tag_green.png +0 -0
  71. data/docs/images/transparent.png +0 -0
  72. data/docs/images/wrench.png +0 -0
  73. data/docs/images/wrench_orange.png +0 -0
  74. data/docs/images/zoom.png +0 -0
  75. data/docs/index.html +109 -0
  76. data/docs/js/darkfish.js +84 -0
  77. data/docs/js/navigation.js +105 -0
  78. data/docs/js/navigation.js.gz +0 -0
  79. data/docs/js/search.js +110 -0
  80. data/docs/js/search_index.js +1 -0
  81. data/docs/js/search_index.js.gz +0 -0
  82. data/docs/js/searcher.js +229 -0
  83. data/docs/js/searcher.js.gz +0 -0
  84. data/docs/table_of_contents.html +562 -0
  85. data/lib/mercadopago.rb +24 -349
  86. data/lib/mercadopago/config/config.rb +42 -0
  87. data/lib/mercadopago/config/request_options.rb +85 -0
  88. data/lib/mercadopago/core/mp_base.rb +77 -0
  89. data/lib/mercadopago/http/http_client.rb +74 -0
  90. data/lib/mercadopago/resources/advanced_payment.rb +48 -0
  91. data/lib/mercadopago/resources/card.rb +31 -0
  92. data/lib/mercadopago/resources/card_token.rb +19 -0
  93. data/lib/mercadopago/resources/customer.rb +36 -0
  94. data/lib/mercadopago/resources/disbursement_refund.rb +24 -0
  95. data/lib/mercadopago/resources/identification_type.rb +13 -0
  96. data/lib/mercadopago/resources/merchant_order.rb +32 -0
  97. data/lib/mercadopago/resources/payment.rb +35 -0
  98. data/lib/mercadopago/resources/payment_methods.rb +13 -0
  99. data/lib/mercadopago/resources/preference.rb +26 -0
  100. data/lib/mercadopago/resources/refund.rb +24 -0
  101. data/lib/mercadopago/resources/user.rb +13 -0
  102. data/lib/mercadopago/sdk.rb +85 -0
  103. data/mercadopago.gemspec +15 -15
  104. data/tests/test_card.rb +79 -0
  105. data/tests/test_card_token.rb +39 -0
  106. data/tests/test_customer.rb +54 -0
  107. data/tests/test_identification_type.rb +16 -0
  108. data/tests/test_merchant_order.rb +94 -0
  109. data/tests/test_payment.rb +102 -0
  110. data/tests/test_payment_methods.rb +14 -0
  111. data/tests/test_preference.rb +49 -0
  112. data/tests/test_refund.rb +88 -0
  113. data/tests/test_user.rb +17 -0
  114. data/tests/tests.rb +12 -56
  115. metadata +154 -37
  116. data/examples/checkout-buttons/basic_preference/button.rb +0 -28
  117. data/examples/instant-payment-notifications/receive-ipn.rb +0 -25
  118. data/examples/payment-search/search-approved-payments.rb +0 -23
  119. data/examples/payment-search/search-creditcard-payments.rb +0 -23
  120. data/examples/payment-search/search-funded-payments-by-name.rb +0 -23
  121. data/examples/payment-search/search-payments-from-email-and-date.rb +0 -23
  122. data/examples/payment-search/search-payments.rb +0 -23
  123. data/examples/preapproval-payments/button.rb +0 -42
  124. data/lib/ssl_options_patch.rb +0 -15
  125. data/lib/version.rb +0 -1
  126. data/mercadopago-sdk-0.3.2.gem +0 -0
  127. data/mercadopago-sdk-0.3.3.gem +0 -0
@@ -1,28 +0,0 @@
1
- require 'rubygems'
2
- require 'rack'
3
- $LOAD_PATH << '../../../lib'
4
- require 'mercadopago.rb'
5
-
6
- class Button
7
-
8
- def call(env)
9
- mp = MercadoPago.new('CLIENT_ID', 'CLIENT_SECRET')
10
- preferenceData = {"items" => ["title"=>"testCreate", "quantity"=>1, "unit_price"=>10.2, "currency_id"=>"ARS"]}
11
- preference = mp.create_preference(preferenceData)
12
-
13
- html = '<!doctype html>
14
- <html>
15
- <head>
16
- <title>MercadoPago SDK - Create Preference and Show Checkout Example</title>
17
- </head>
18
- <body>
19
- <a href="' + preference['response']['init_point'] + '" name="MP-Checkout" class="orange-ar-m-sq-arall">Pay</a>
20
- <script type="text/javascript" src="//resources.mlstatic.com/mptools/render.js"></script>
21
- </body>
22
- </html>'
23
-
24
- return [200, {'Content-Type' => 'text/html'}, [html]]
25
- end
26
- end
27
-
28
- Rack::Handler::WEBrick.run(Button.new, :Port => 9000)
@@ -1,25 +0,0 @@
1
- require 'rubygems'
2
- require 'rack'
3
- $LOAD_PATH << '../../lib'
4
- require 'mercadopago.rb'
5
-
6
- class IPN
7
- def call(env)
8
- mp = MercadoPago.new('CLIENT_ID', 'CLIENT_SECRET')
9
-
10
- # Get the payment reported by the IPN. Glossary of attributes response in https://developers.mercadopago.com
11
- payment_info = mp.get_payment_info('ID');
12
-
13
- html = ""
14
- # Show payment information
15
- if (payment_info['status'] == 200)
16
- html = payment_info['response'].inspect
17
- else
18
- html = payment_info['response'].inspect
19
- end
20
-
21
- return [200, {'Content-Type' => 'text/html'}, [html]]
22
- end
23
- end
24
-
25
- Rack::Handler::WEBrick.run(IPN.new, :Port => 9000)
@@ -1,23 +0,0 @@
1
- require 'rubygems'
2
- require 'rack'
3
- $LOAD_PATH << '../../lib'
4
- require 'mercadopago.rb'
5
-
6
- class IPN
7
- def call(env)
8
- mp = MercadoPago.new('CLIENT_ID', 'CLIENT_SECRET')
9
-
10
- # Sets the filters you want
11
- filters = Hash["range"=>"date_created", "begin_date"=>"NOW-1MONTH", "end_date"=>"NOW", "status"=>"approved", "operation_type"=>"regular_payment"]
12
-
13
- # Search payment data according to filters
14
- searchResult = mp.search_payment(filters)
15
-
16
- # Show payment information
17
- html = searchResult.inspect
18
-
19
- return [200, {'Content-Type' => 'text/html'}, [html]]
20
- end
21
- end
22
-
23
- Rack::Handler::WEBrick.run(IPN.new, :Port => 9000)
@@ -1,23 +0,0 @@
1
- require 'rubygems'
2
- require 'rack'
3
- $LOAD_PATH << '../../lib'
4
- require 'mercadopago.rb'
5
-
6
- class IPN
7
- def call(env)
8
- mp = MercadoPago.new('CLIENT_ID', 'CLIENT_SECRET')
9
-
10
- # Sets the filters you want
11
- filters = Hash["range"=>"date_created", "begin_date"=>"2011-10-21T00:00:00Z", "end_date"=>"2011-10-25T24:00:00Z", "payment_type_id"=>"credit_card", "operation_type"=>"regular_payment"]
12
-
13
- # Search payment data according to filters
14
- searchResult = mp.search_payment(filters)
15
-
16
- # Show payment information
17
- html = searchResult.inspect
18
-
19
- return [200, {'Content-Type' => 'text/html'}, [html]]
20
- end
21
- end
22
-
23
- Rack::Handler::WEBrick.run(IPN.new, :Port => 9000)
@@ -1,23 +0,0 @@
1
- require 'rubygems'
2
- require 'rack'
3
- $LOAD_PATH << '../../lib'
4
- require 'mercadopago.rb'
5
-
6
- class IPN
7
- def call(env)
8
- mp = MercadoPago.new('CLIENT_ID', 'CLIENT_SECRET')
9
-
10
- # Sets the filters you want
11
- filters = Hash["installments" => 12, "description"=>"product_name", "operation_type"=>"regular_payment"]
12
-
13
- # Search payment data according to filters
14
- searchResult = mp.search_payment(filters)
15
-
16
- # Show payment information
17
- html = searchResult.inspect
18
-
19
- return [200, {'Content-Type' => 'text/html'}, [html]]
20
- end
21
- end
22
-
23
- Rack::Handler::WEBrick.run(IPN.new, :Port => 9000)
@@ -1,23 +0,0 @@
1
- require 'rubygems'
2
- require 'rack'
3
- $LOAD_PATH << '../../lib'
4
- require 'mercadopago.rb'
5
-
6
- class IPN
7
- def call(env)
8
- mp = MercadoPago.new('CLIENT_ID', 'CLIENT_SECRET')
9
-
10
- # Sets the filters you want
11
- filters = Hash["payer.email" => "mail02@mail02.com", "begin_date"=>"2011-01-01T00:00:00Z", "end_date"=>"2011-02-01T00:00:00Z"]
12
-
13
- # Search payment data according to filters
14
- searchResult = mp.search_payment(filters)
15
-
16
- # Show payment information
17
- html = searchResult.inspect
18
-
19
- return [200, {'Content-Type' => 'text/html'}, [html]]
20
- end
21
- end
22
-
23
- Rack::Handler::WEBrick.run(IPN.new, :Port => 9000)
@@ -1,23 +0,0 @@
1
- require 'rubygems'
2
- require 'rack'
3
- $LOAD_PATH << '../../lib'
4
- require 'mercadopago.rb'
5
-
6
- class IPN
7
- def call(env)
8
- mp = MercadoPago.new('CLIENT_ID', 'CLIENT_SECRET')
9
-
10
- # Sets the filters you want
11
- filters = Hash["external_reference"=>"Bill001"]
12
-
13
- # Search payment data according to filters
14
- searchResult = mp.search_payment(filters)
15
-
16
- # Show payment information
17
- html = searchResult.inspect
18
-
19
- return [200, {'Content-Type' => 'text/html'}, [html]]
20
- end
21
- end
22
-
23
- Rack::Handler::WEBrick.run(IPN.new, :Port => 9000)
@@ -1,42 +0,0 @@
1
- require 'rubygems'
2
- require 'rack'
3
- $LOAD_PATH << '../../lib'
4
- require 'mercadopago.rb'
5
-
6
- class Button
7
-
8
- def call(env)
9
- mp = MercadoPago.new('CLIENT_ID', 'CLIENT_SECRET')
10
- preapprovalPayment_data = Hash[
11
- "payer_email" => "my_customer@my_site.com",
12
- "back_url" => "http://www.my_site.com",
13
- "reason" => "Monthly subscription to premium package",
14
- "external_reference" => "OP-1234",
15
- "auto_recurring" => Hash[
16
- "frequency" => 1,
17
- "frequency_type" => "months",
18
- "transaction_amount" => 60,
19
- "currency_id" => "BRL",
20
- "start_date" => "2012-12-10T14:58:11.778-03:00",
21
- "end_date" => "2013-06-10T14:58:11.778-03:00"
22
- ]
23
- ]
24
-
25
- preapprovalPayment = mp.create_preapproval_payment(preapprovalPayment_data)
26
-
27
- html = '<!doctype html>
28
- <html>
29
- <head>
30
- <title>MercadoPago SDK - Create Preapproval Payment and Show Subscription Example</title>
31
- </head>
32
- <body>
33
- <a href="' + preapprovalPayment['response']['init_point'] + '" name="MP-Checkout" class="orange-ar-m-sq-arall">Pay</a>
34
- <script type="text/javascript" src="//resources.mlstatic.com/mptools/render.js"></script>
35
- </body>
36
- </html>'
37
-
38
- return [200, {'Content-Type' => 'text/html'}, [html]]
39
- end
40
- end
41
-
42
- Rack::Handler::WEBrick.run(Button.new, :Port => 9000)
@@ -1,15 +0,0 @@
1
- # This is a workaround for issue #9450 in Ruby core
2
- # https://bugs.ruby-lang.org/issues/9450
3
- #
4
- # Add an :ssl_options accessor to Net::HTTP, which controls the options
5
- # attribute on the resulting SSLContext. This allows the user to customize
6
- # behavior of SSL connections, like disabling specific protocol versions.
7
-
8
- require 'net/http'
9
-
10
- (Net::HTTP::SSL_IVNAMES << :@ssl_options).uniq!
11
- (Net::HTTP::SSL_ATTRIBUTES << :options).uniq!
12
-
13
- Net::HTTP.class_eval do
14
- attr_accessor :ssl_options
15
- end
data/lib/version.rb DELETED
@@ -1 +0,0 @@
1
- MERCADO_PAGO_VERSION = '0.3.6' unless defined?(MERCADO_PAGO_VERSION)
Binary file
Binary file