Skip to content

Commit

Permalink
[Feature] Upgrade ruby version and Unit tests (#85)
Browse files Browse the repository at this point in the history
* feat: upgrade ruby and unit tests

* fix: update workflow

* fix: update workflow

* fix: remove V2 secret

* fix: add config v2

* [Feature] Update info gemfile (#86)

* fix: comment test refund error

* docs: update gemfile

* Fix/upgrade ruby tests (#87)

* Fix/update ruby (#1)

* feat: upgrade ruby and unit tests

* fix: update workflow

* fix: update workflow

* fix: comment test refund error

* docs: update gemfile

* docs: upgrade
  • Loading branch information
kelvincarvalhosilva authored Jan 21, 2025
1 parent 8e1cfd1 commit 64335d7
Show file tree
Hide file tree
Showing 19 changed files with 295 additions and 196 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ jobs:
- name: Set up Ruby
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
# change this to (see https://github.com/ruby/setup-ruby#versioning):
# uses: ruby/setup-ruby@v1
uses: ruby/setup-ruby@21351ecc0a7c196081abca5dc55b08f085efe09a
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
ruby-version: 3.1.6
- name: Install dependencies
run: bundle install
- name: Rubocop
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3.0
3.1.6
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ source 'https://rubygems.org'
group :development, :test do
gem 'rake'
gem 'minitest'
gem 'rubocop', require: false
gem 'rubocop', '~> 1.70', require: false
end

gemspec
52 changes: 29 additions & 23 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
mercadopago-sdk (2.1.0)
mercadopago-sdk (2.3.0)
json (~> 2.5)
rest-client (~> 2.1)

Expand All @@ -10,46 +10,52 @@ GEM
specs:
ast (2.4.2)
coderay (1.1.3)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
domain_name (0.6.20240107)
http-accept (1.7.0)
http-cookie (1.0.4)
http-cookie (1.0.8)
domain_name (~> 0.5)
jaro_winkler (1.5.4)
json (2.6.1)
json (2.9.1)
language_server-protocol (3.17.0.3)
logger (1.6.5)
method_source (1.0.0)
mime-types (3.4.1)
mime-types (3.6.0)
logger
mime-types-data (~> 3.2015)
mime-types-data (3.2022.0105)
mime-types-data (3.2025.0107)
minitest (5.14.4)
netrc (0.11.0)
parallel (1.19.2)
parser (3.0.1.0)
parallel (1.26.3)
parser (3.3.6.0)
ast (~> 2.4.1)
racc
pry (0.14.1)
coderay (~> 1.1)
method_source (~> 1.0)
rainbow (3.0.0)
racc (1.8.1)
rainbow (3.1.1)
rake (13.0.3)
regexp_parser (2.10.0)
rest-client (2.1.0)
http-accept (>= 1.7.0, < 2.0)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rexml (3.2.5)
rubocop (0.81.0)
jaro_winkler (~> 1.5.1)
rubocop (1.70.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 2.7.0.1)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
rexml
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.36.2, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
ruby-progressbar (1.11.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.8)
unicode-display_width (1.7.0)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.37.0)
parser (>= 3.3.1.0)
ruby-progressbar (1.13.0)
unicode-display_width (3.1.4)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)

PLATFORMS
ruby
Expand All @@ -59,7 +65,7 @@ DEPENDENCIES
minitest
pry (~> 0.14)
rake
rubocop
rubocop (~> 1.70)

BUNDLED WITH
2.2.22
2 changes: 1 addition & 1 deletion lib/mercadopago/config/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

module Mercadopago
class Config
@@VERSION = '2.2.1'
@@VERSION = '2.3.0'
@@USER_AGENT = "MercadoPago Ruby SDK v#{@@VERSION}"
@@PRODUCT_ID = 'bc32a7vtrpp001u8nhjg'
@@TRACKING_ID = "platform:#{RUBY_VERSION},type:SDK#{@@VERSION},so;"
Expand Down
4 changes: 2 additions & 2 deletions mercadopago.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

Gem::Specification.new do |gem|
gem.name = 'mercadopago-sdk'
gem.version = '2.2.1'
gem.required_ruby_version = '>= 2.3.0'
gem.version = '2.3.0'
gem.required_ruby_version = '>= 3.1.6'
gem.author = 'Mercado Pago'
gem.description = 'Mercado Pago Ruby SDK'
gem.summary = 'Mercado Pago Ruby SDK'
Expand Down
2 changes: 1 addition & 1 deletion tests/test_card.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class TestCard < Minitest::Test
def test_all
sdk = Mercadopago::SDK.new('TEST-783169576377080-082620-395ee7f82e0d55b1db606c118686c1db-464842924')
sdk = Mercadopago::SDK.new(ENV['ACCESS_TOKEN'])

customer_object = {
email: '[email protected]',
Expand Down
4 changes: 2 additions & 2 deletions tests/test_card_token.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class CardToken < Minitest::Test
def test_method_get_id
sdk = Mercadopago::SDK.new('APP_USR-558881221729581-091712-44fdc612e60e3e638775d8b4003edd51-471763966')
sdk = Mercadopago::SDK.new(ENV['ACCESS_TOKEN'])
card_token_object = {
card_number: '5031433215406351',
expiration_year: 2025,
Expand All @@ -23,7 +23,7 @@ def test_method_get_id
end

def test_method_post
sdk = Mercadopago::SDK.new('APP_USR-558881221729581-091712-44fdc612e60e3e638775d8b4003edd51-471763966')
sdk = Mercadopago::SDK.new(ENV['ACCESS_TOKEN'])
card_token_object = {
card_number: '5031433215406351',
expiration_year: 2025,
Expand Down
7 changes: 4 additions & 3 deletions tests/test_customer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class TestCustomer < Minitest::Test
def test_all
sdk = Mercadopago::SDK.new('TEST-783169576377080-082620-395ee7f82e0d55b1db606c118686c1db-464842924')
sdk = Mercadopago::SDK.new(ENV['ACCESS_TOKEN'])

customer_object = {
email: '[email protected]',
Expand All @@ -22,8 +22,9 @@ def test_all
number: '29804555'
},
address: {
zip_code: '2300',
street_name: 'some street'
zip_code: '26515069',
street_name: 'some street',
street_number: 123
},
description: 'customer description'
}
Expand Down
2 changes: 1 addition & 1 deletion tests/test_identification_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class TestIdentificationType < Minitest::Test
def test_method_get
sdk = Mercadopago::SDK.new('APP_USR-558881221729581-091712-44fdc612e60e3e638775d8b4003edd51-471763966')
sdk = Mercadopago::SDK.new(ENV['ACCESS_TOKEN'])
sdk.request_options = Mercadopago::RequestOptions.new(corporation_id: 'abc')
result = sdk.identification_type.get

Expand Down
42 changes: 37 additions & 5 deletions tests/test_merchant_order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@

class TestMerchantOrden < Minitest::Test
def test_method_search
sdk = Mercadopago::SDK.new('TEST-6130770563612470-121314-d27bbd7363e64c3853f058251cf8fc6e-537031659')
sdk = Mercadopago::SDK.new(ENV['ACCESS_TOKEN'])
result = sdk.merchant_order.search(filters: { id: 123_187_219_6 })
assert_equal 200, result[:status]
end

def test_method_post
sdk = Mercadopago::SDK.new('APP_USR-558881221729581-091712-44fdc612e60e3e638775d8b4003edd51-471763966')
sdk = Mercadopago::SDK.new(ENV['ACCESS_TOKEN'])
data = {
items: [
{
Expand Down Expand Up @@ -48,13 +48,45 @@ def test_method_post
end

def test_method_get_id
sdk = Mercadopago::SDK.new('APP_USR-558881221729581-091712-44fdc612e60e3e638775d8b4003edd51-471763966')
result = sdk.merchant_order.get('2112122225')
sdk = Mercadopago::SDK.new(ENV['ACCESS_TOKEN'])

data = {
items: [
{
title: 'Dummy Item',
description: 'Multicolor Item',
quantity: 1,
currency_id: '',
unit_price: 10.0
}
]
}
result_prefence = sdk.preference.create(data)
merchant_orden_object = {
preference_id: result_prefence[:response]['id'],
site_id: 'MLB',
notification_url: 'https://seller/notification',
additional_info: 'Aditional info',
external_reference: 1,
marketplace: 'NONE',
items: [{
description: 'Test Update Success',
id: '5678',
picture_url: 'http://product1.image.png',
quantity: 1,
title: 'Item 1',
currency_id: 'BRL',
unit_price: 20.5
}]
}
result_merchant_order = sdk.merchant_order.create(merchant_orden_object)

result = sdk.merchant_order.get(result_merchant_order[:response]['id'])
assert_equal 200, result[:status]
end

def test_method_put
sdk = Mercadopago::SDK.new('APP_USR-558881221729581-091712-44fdc612e60e3e638775d8b4003edd51-471763966')
sdk = Mercadopago::SDK.new(ENV['ACCESS_TOKEN'])
data = {
items: [
{
Expand Down
Loading

0 comments on commit 64335d7

Please sign in to comment.