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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 89495678416603a35547582361f007bebb19d11d
4
- data.tar.gz: 4ff15007633d63649cd97d86dbd6e76e2b6411fd
2
+ SHA256:
3
+ metadata.gz: 40a42ea53dd82c6c9932c0c603b23920bf03c89d6823a3779a99f778b99d361d
4
+ data.tar.gz: 1c8bea06955578aff4de9afcd4ae03f4a375ae3f1a2bda31014c301148997740
5
5
  SHA512:
6
- metadata.gz: 3ba1dca8bf70df2e3da0eef2436e8c3f14572541fd4f6b9e9cde4f533fe2f6864f80512cfba081eb4813b58a0791a596f5832fdfac5102b65381e71571d2a222
7
- data.tar.gz: 1f04c650559dd8398b22d19272956b69af5fbd6b1b297eeca8d8acfa6a7b59269e6c796eed3c2d3f2192c564d197d4450560d166fdab4e065de124b590a557a8
6
+ metadata.gz: f1da53205f33babf2452c51a242b2cd2e8b87d069cfe8b61fc634ec04a53c46f5cbee8e0c88cf86fb7b6fe3dcc1e596e028b2255bd6a1ee738b551ee09f43d16
7
+ data.tar.gz: eca076db10b08db2074d4703dbd69bd645855e06a23847f4ef05f8625276f4188eef81ed4c8175f9cb28074a40e895a10b051eb8ce92559964e39428564c0968
data/.gitignore CHANGED
@@ -3,4 +3,4 @@ bin/
3
3
  config/*yml
4
4
  pkg/
5
5
  *.log
6
- *.gem
6
+ *.gem
data/README.md CHANGED
@@ -1,37 +1,24 @@
1
- # MercadoPago SDK module for Payments integration
1
+ # Mercado Pago SDK for Ruby
2
2
 
3
- * [Install](#install)
4
- * [Basic checkout](#basic-checkout)
5
- * [Customized checkout](#custom-checkout)
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
- <a name="install"></a>
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
- ```gem install mercadopago-sdk```
9
+ ## 💡 Requirements
12
10
 
13
- <a name="basic-checkout"></a>
14
- ## Basic checkout
11
+ The SDK Supports Ruby from version v0
15
12
 
16
- ### Configure your credentials
13
+ ## 📲 Installation
17
14
 
18
- * Get your **CLIENT_ID** and **CLIENT_SECRET** in the following address:
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
- ```ruby
27
- require 'mercadopago.rb'
17
+ 1. Run ```gem install mercadopago-sdk```
28
18
 
29
- $mp = MercadoPago.new('CLIENT_ID', 'CLIENT_SECRET')
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
- ### Preferences
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
- #### Create a Checkout preference
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
- "items": [
48
- {
49
- "title": "testCreate",
50
- "quantity": 1,
51
- "unit_price": 10.2,
52
- "currency_id": "ARS"
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
- ### Get customer
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
- * View more Custom checkout related APIs in Developers Site
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
- <a name="generic-methods"></a>
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
@@ -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
  {
@@ -1,2 +1,2 @@
1
- MERCADO_PAGO_VERSION = '1.1.0' unless defined?(MERCADO_PAGO_VERSION)
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.1.0
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-01-21 00:00:00.000000000 Z
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
- rubyforge_project:
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