Skip to content
Open
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
4 changes: 2 additions & 2 deletions epayco-sdk-ruby.gemspec
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# encoding: utf-8

Gem::Specification.new do |s|
s.name = "epayco-sdk-ruby
s.version = "1.4.0"
s.name = "epayco-sdk-ruby"
s.version = "1.5.0"
s.summary = "Ruby wrapper for Epayco API"
s.description = "API to interact with Epayco\nhttps://epayco.co"
s.authors = ["Epayco development team", "Ricardo Saldarriaga", "Gerson Vasquez"]
Expand Down
33 changes: 19 additions & 14 deletions lib/epayco.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
require 'base64'
require 'open-uri'
require 'socket'

require_relative 'epayco/resources'

module Epayco
Expand Down Expand Up @@ -36,6 +37,8 @@ def each
@api_base = 'https://api.secure.payco.co'
@api_base_secure = 'https://secure.payco.co'
@api_base_apify = "https://apify.epayco.co"
@api_entorno = "/restpagos"


# Init sdk parameters
class << self
Expand All @@ -58,19 +61,21 @@ def self.request(method, url, extra=nil, params={}, headers={}, switch, cashdata

# Switch secure or api or apify
if apify
@tags = JSON.parse(payload)
seted = {}
file = File.read(File.dirname(__FILE__) + '/keylang_apify.json')
data_hash = JSON.parse(file)
@tags.each {
|key, value|
if data_hash[key]
seted[data_hash[key]] = value
else
seted[key] = value
end
}
payload = seted.to_json
if method == :post
@tags = JSON.parse(payload)
seted = {}
file = File.read(File.dirname(__FILE__) + '/keylang_apify.json')
data_hash = JSON.parse(file)
@tags.each {
|key, value|
if data_hash[key]
seted[data_hash[key]] = value
else
seted[key] = value
end
}
payload = seted.to_json
end
url = @api_base_apify + url
elsif switch
if method == :post || method == :patch
Expand All @@ -82,7 +87,7 @@ def self.request(method, url, extra=nil, params={}, headers={}, switch, cashdata
payload = enc.to_json
end
end
url = @api_base_secure + url
url = @api_base_secure + @api_entorno + url
else
if method == :post || method == :patch
rb_hash = JSON.parse(payload)
Expand Down