mercadopago-sdk 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -1
- data/README.md +27 -44
- data/lib/mercadopago.rb +32 -0
- data/lib/version.rb +2 -2
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 40a42ea53dd82c6c9932c0c603b23920bf03c89d6823a3779a99f778b99d361d
|
4
|
+
data.tar.gz: 1c8bea06955578aff4de9afcd4ae03f4a375ae3f1a2bda31014c301148997740
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1da53205f33babf2452c51a242b2cd2e8b87d069cfe8b61fc634ec04a53c46f5cbee8e0c88cf86fb7b6fe3dcc1e596e028b2255bd6a1ee738b551ee09f43d16
|
7
|
+
data.tar.gz: eca076db10b08db2074d4703dbd69bd645855e06a23847f4ef05f8625276f4188eef81ed4c8175f9cb28074a40e895a10b051eb8ce92559964e39428564c0968
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,37 +1,24 @@
|
|
1
|
-
#
|
1
|
+
# Mercado Pago SDK for Ruby
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
* [Generic methods](#generic-methods)
|
3
|
+
[![Gem](https://img.shields.io/gem/v/mercadopago-sdk)](https://rubygems.org/gems/mercadopago-sdk)
|
4
|
+
[![Gem](https://img.shields.io/gem/dt/mercadopago-sdk)](https://rubygems.org/gems/mercadopago-sdk)
|
5
|
+
[![APM](https://img.shields.io/apm/l/vim-mode)](https://github.com/mercadopago/sdk-ruby)
|
7
6
|
|
8
|
-
|
9
|
-
## Install
|
7
|
+
This library provides developers with a simple set of bindings to help you integrate Mercado Pago API to a website and start receiving payments.
|
10
8
|
|
11
|
-
|
9
|
+
## 💡 Requirements
|
12
10
|
|
13
|
-
|
14
|
-
## Basic checkout
|
11
|
+
The SDK Supports Ruby from version v0
|
15
12
|
|
16
|
-
|
13
|
+
## 📲 Installation
|
17
14
|
|
18
|
-
|
19
|
-
* Argentina: [https://www.mercadopago.com/mla/herramientas/aplicaciones](https://www.mercadopago.com/mla/herramientas/aplicaciones)
|
20
|
-
* Brazil: [https://www.mercadopago.com/mlb/ferramentas/aplicacoes](https://www.mercadopago.com/mlb/ferramentas/aplicacoes)
|
21
|
-
* México: [https://www.mercadopago.com/mlm/herramientas/aplicaciones](https://www.mercadopago.com/mlm/herramientas/aplicaciones)
|
22
|
-
* Venezuela: [https://www.mercadopago.com/mlv/herramientas/aplicaciones](https://www.mercadopago.com/mlv/herramientas/aplicaciones)
|
23
|
-
* Colombia: [https://www.mercadopago.com/mco/herramientas/aplicaciones](https://www.mercadopago.com/mco/herramientas/aplicaciones)
|
24
|
-
* Chile: [https://www.mercadopago.com/mlc/herramientas/aplicaciones](https://www.mercadopago.com/mlc/herramientas/aplicaciones)
|
15
|
+
First time using Mercado Pago? Create your [Mercado Pago account](https://www.mercadopago.com), if you don’t have one already.
|
25
16
|
|
26
|
-
```
|
27
|
-
require 'mercadopago.rb'
|
17
|
+
1. Run ```gem install mercadopago-sdk```
|
28
18
|
|
29
|
-
|
30
|
-
```
|
19
|
+
2. Copy the access_token in the [credentials](https://www.mercadopago.com/mlb/account/credentials) section of the page and replace YOUR_ACCESS_TOKEN with it.
|
31
20
|
|
32
|
-
|
33
|
-
|
34
|
-
#### Get an existent Checkout preference
|
21
|
+
Thats all, you have Mercado Pago SDK installed.
|
35
22
|
|
36
23
|
```ruby
|
37
24
|
preference = $mp.get_preference('PREFERENCE_ID')
|
@@ -39,19 +26,22 @@ preference = $mp.get_preference('PREFERENCE_ID')
|
|
39
26
|
puts $preferenceResult
|
40
27
|
```
|
41
28
|
|
42
|
-
|
29
|
+
## 🌟 Getting Started
|
30
|
+
|
31
|
+
Simple usage looks like:
|
43
32
|
|
44
33
|
```ruby
|
34
|
+
require 'mercadopago.rb'
|
35
|
+
|
36
|
+
$mp = MercadoPago.new('YOUR_ACCESS_TOKEN')
|
45
37
|
|
46
38
|
preference_data = {
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
}
|
54
|
-
]
|
39
|
+
"items": [
|
40
|
+
{
|
41
|
+
"title": "testCreate",
|
42
|
+
"quantity": 1,
|
43
|
+
"unit_price": 10.2,
|
44
|
+
"currency_id": "ARS"
|
55
45
|
}
|
56
46
|
preference = $mp.create_preference(preference_data)
|
57
47
|
|
@@ -136,22 +126,15 @@ $mp.post ("/v1/payments", payment_data);
|
|
136
126
|
$mp.post ("/v1/customers", Hash["email" => "email@test.com"]);
|
137
127
|
```
|
138
128
|
|
139
|
-
|
129
|
+
Check our official code reference to explore all available functionalities.
|
140
130
|
|
141
131
|
```ruby
|
142
132
|
$mp.get ("/v1/customers/CUSTOMER_ID");
|
143
133
|
```
|
144
134
|
|
145
|
-
|
146
|
-
* Argentina: [https://www.mercadopago.com.ar/developers](https://www.mercadopago.com.ar/developers)
|
147
|
-
* Brazil: [https://www.mercadopago.com.br/developers](https://www.mercadopago.com.br/developers)
|
148
|
-
* Mexico: [https://www.mercadopago.com.mx/developers](https://www.mercadopago.com.mx/developers)
|
149
|
-
* Venezuela: [https://www.mercadopago.com.ve/developers](https://www.mercadopago.com.ve/developers)
|
150
|
-
* Colombia: [https://www.mercadopago.com.co/developers](https://www.mercadopago.com.co/developers)
|
135
|
+
If you require technical support, please contact our support team at [developers.mercadopago.com](https://developers.mercadopago.com)
|
151
136
|
|
152
|
-
|
153
|
-
## Generic methods
|
154
|
-
You can access any other resource from the MercadoPago API using the generic methods:
|
137
|
+
## 🏻 License
|
155
138
|
|
156
139
|
```ruby
|
157
140
|
// Get a resource, with optional URL params. Also you can disable authentication for public APIs
|
data/lib/mercadopago.rb
CHANGED
@@ -30,6 +30,18 @@ class MercadoPago
|
|
30
30
|
@rest_client.set_debug_logger(debug_logger)
|
31
31
|
end
|
32
32
|
|
33
|
+
def set_platform_id(platform_id)
|
34
|
+
@rest_client.set_platform_id(platform_id)
|
35
|
+
end
|
36
|
+
|
37
|
+
def set_integrator_id(integrator_id)
|
38
|
+
@rest_client.set_integrator_id(integrator_id)
|
39
|
+
end
|
40
|
+
|
41
|
+
def set_corporation_id(corporation_id)
|
42
|
+
@rest_client.set_corporation_id(corporation_id)
|
43
|
+
end
|
44
|
+
|
33
45
|
def sandbox_mode(enable=nil)
|
34
46
|
if not enable.nil?
|
35
47
|
@sandbox = enable
|
@@ -311,12 +323,28 @@ class MercadoPago
|
|
311
323
|
end
|
312
324
|
|
313
325
|
@http.set_debug_output debug_logger if debug_logger
|
326
|
+
|
327
|
+
@platform_id = nil
|
328
|
+
@integrator_id = nil
|
329
|
+
@corporation_id = nil
|
314
330
|
end
|
315
331
|
|
316
332
|
def set_debug_logger(debug_logger)
|
317
333
|
@http.set_debug_output debug_logger
|
318
334
|
end
|
319
335
|
|
336
|
+
def set_platform_id(platform_id)
|
337
|
+
@platform_id = platform_id
|
338
|
+
end
|
339
|
+
|
340
|
+
def set_integrator_id(integrator_id)
|
341
|
+
@integrator_id = integrator_id
|
342
|
+
end
|
343
|
+
|
344
|
+
def set_corporation_id(corporation_id)
|
345
|
+
@corporation_id = corporation_id
|
346
|
+
end
|
347
|
+
|
320
348
|
def exec(method, uri, data, content_type)
|
321
349
|
if not data.nil? and content_type == MIME_JSON
|
322
350
|
data = data.to_json
|
@@ -330,6 +358,10 @@ class MercadoPago
|
|
330
358
|
'Accept' => MIME_JSON
|
331
359
|
}
|
332
360
|
|
361
|
+
headers['x-platform-id'] = @platform_id if @platform_id != nil
|
362
|
+
headers['x-integrator-id'] = @integrator_id if @integrator_id != nil
|
363
|
+
headers['x-corporation-id'] = @corporation_id if @corporation_id != nil
|
364
|
+
|
333
365
|
api_result = @http.send_request(method, uri, data, headers)
|
334
366
|
|
335
367
|
{
|
data/lib/version.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
MERCADO_PAGO_VERSION = '1.
|
2
|
-
PRODUCT_ID = 'bc32a7vtrpp001u8nhjg'
|
1
|
+
MERCADO_PAGO_VERSION = '1.2.0' unless defined?(MERCADO_PAGO_VERSION)
|
2
|
+
PRODUCT_ID = 'bc32a7vtrpp001u8nhjg'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mercadopago-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- maticompiano
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -97,8 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
97
|
- !ruby/object:Gem::Version
|
98
98
|
version: '0'
|
99
99
|
requirements: []
|
100
|
-
|
101
|
-
rubygems_version: 2.5.2.3
|
100
|
+
rubygems_version: 3.0.3
|
102
101
|
signing_key:
|
103
102
|
specification_version: 4
|
104
103
|
summary: MercadoPago Ruby SDK
|