Navigation Menu

Skip to content

lengio/payu-latam-rails

Repository files navigation

PayU Latam Rails Library

CircleCI Maintainability

Installation

gem "payu-latam-rails", github: "lengio/payu-latam-rails", require: "pay_u_rails"

# Local
gem build payu-latam-rails.gemspec

Usage

Mounting routes

# config/routes.rb
mount PayURails::Engine, at: "/pay_u", as: "pay_u"

Subscribing with blocks

PayURails.subscribe(PayURails::Confirmation::EVENT) do |confirmation|
    # Do something with PayU::Confirmation object
end

PayURails.subscribe(PayURails::Response::EVENT) do |response|
    # Do something with PayU::Response object
end

Subscribing with objects

class Subscriber
    def call(confirmation)
        # Do something with PayU::Confirmation object
    end
end

PayURails.subscribe(PayURails::Confirmation::EVENT, Subscriber.new)

Testing

rspec

Console

bin/console