Skip to content

Commit

Permalink
Merge pull request #25 from compropago/staging
Browse files Browse the repository at this point in the history
Staging
  • Loading branch information
christian8aguirre authored May 2, 2017
2 parents d8fcd4d + 7d8c0cc commit fdc9b45
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 158 deletions.
7 changes: 4 additions & 3 deletions compropago_sdk.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ Dir.glob('./lib/compropago_sdk/tools/*.rb').each do |archivo| li.push archivo en

Gem::Specification.new do |spec|
spec.name = 'compropago_sdk'
spec.version = '3.0.4'
spec.authors = ['Eduardo Aguilar']
spec.email = ['eduardo.aguilar@compropago.com']
spec.version = '3.1.0'
spec.authors = ['Eduardo Aguilar','Christian Aguirre']
spec.email = ['eduardo.aguilar@compropago.com','christian@compropago.com']

spec.summary = %q{Gema para API ComproPago}
spec.description = %q{Provee los servicios de creacion de cargos verificacion etc.}
Expand All @@ -28,4 +28,5 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'bundler'
spec.add_development_dependency 'rake'
spec.add_development_dependency 'minitest'
spec.add_dependency 'easy_request'
end
3 changes: 1 addition & 2 deletions lib/compropago_sdk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
require 'net/http'
require 'json'
require 'base64'
require 'easy_request'

require 'compropago_sdk/client'
require 'compropago_sdk/service'

require 'compropago_sdk/tools/http'
require 'compropago_sdk/tools/request'
require 'compropago_sdk/tools/validations'

require 'compropago_sdk/factory/factory'
Expand Down
16 changes: 8 additions & 8 deletions lib/compropago_sdk/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ def list_providers(limit=0, currency='MXN')
uri = uri+'&currency='+currency
end

response = Request::get(uri, get_auth)
response = EasyRequest::get(uri, get_auth)

Factory::get_instance_of 'ListProviders', response
end

def verify_order(order_id)
response = Request::get( @client.deploy_uri+'charges/'+order_id+'/', get_auth)
response = EasyRequest::get( @client.deploy_uri+'charges/'+order_id+'/', get_auth)

Factory::get_instance_of 'CpOrderInfo', response
end
Expand All @@ -49,43 +49,43 @@ def place_order(order)
:app_client_version => order.app_client_version
}

response = Request::post(@client.deploy_uri+'charges/', params, get_auth)
response = EasyRequest::post(@client.deploy_uri+'charges/', params, get_auth)

Factory::get_instance_of 'NewOrderInfo', response
end

def send_sms_instructions(number, order_id)
params = {customer_phone: number}

response = Request::post(@client.deploy_uri+'charges/'+order_id+'/sms/', params, get_auth)
response = EasyRequest::post(@client.deploy_uri+'charges/'+order_id+'/sms/', params, get_auth)

Factory::get_instance_of 'SmsInfo', response
end

def create_webhook(url)
params = {url: url}

response = Request::post(@client.deploy_uri+'webhooks/stores/', params, get_auth)
response = EasyRequest::post(@client.deploy_uri+'webhooks/stores/', params, get_auth)

Factory::get_instance_of 'Webhook', response
end

def update_webhook(webhook_id, new_url)
params = {url: new_url}

response = Request::put(@client.deploy_uri+'webhooks/stores/'+webhook_id+'/', params, get_auth)
response = EasyRequest::put(@client.deploy_uri+'webhooks/stores/'+webhook_id+'/', params, get_auth)

Factory::get_instance_of 'Webhook', response
end

def delete_webhook(webhook_id)
response = Request::delete(@client.deploy_uri+'webhooks/stores/'+webhook_id, nil, get_auth)
response = EasyRequest::delete(@client.deploy_uri+'webhooks/stores/'+webhook_id, nil, get_auth)

Factory::get_instance_of 'Webhook', response
end

def list_webhooks
response = Request::get(@client.deploy_uri+'webhooks/stores/', get_auth)
response = EasyRequest::get(@client.deploy_uri+'webhooks/stores/', get_auth)

Factory::get_instance_of 'ListWebhooks', response
end
Expand Down
72 changes: 0 additions & 72 deletions lib/compropago_sdk/tools/http.rb

This file was deleted.

72 changes: 0 additions & 72 deletions lib/compropago_sdk/tools/request.rb

This file was deleted.

2 changes: 1 addition & 1 deletion lib/compropago_sdk/tools/validations.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class Validations

def self.eval_auth(client)
response = Request::get(client.deploy_uri+'users/auth/', user: client.get_user, pass: client.get_pass)
response = EasyRequest::get(client.deploy_uri+'users/auth/', user: client.get_user, pass: client.get_pass)
info = Factory.get_instance_of('EvalAuthInfo', response)

if info.code == 200
Expand Down

0 comments on commit fdc9b45

Please sign in to comment.