From e80c5b3d34ade73e3022b72b2891f087057ae3d5 Mon Sep 17 00:00:00 2001 From: tinogomes Date: Tue, 9 Aug 2011 19:41:34 -0300 Subject: [PATCH] =?UTF-8?q?Atualiza=C3=A7=C3=A3o=20do=20README,=20adiciona?= =?UTF-8?q?do=20generator=20para=20instala=C3=A7=C3=A3o=20e=20atualiza?= =?UTF-8?q?=C3=A7=C3=A3o=20da=20vers=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 32 +++++++++++++------ .../braspag/install/install_generator.rb | 15 +++++++++ .../install/templates/config/braspag.yml | 17 ++++++++++ lib/rbraspag/version.rb | 2 +- 4 files changed, 56 insertions(+), 10 deletions(-) create mode 100644 lib/generators/braspag/install/install_generator.rb create mode 100644 lib/generators/braspag/install/templates/config/braspag.yml diff --git a/README.md b/README.md index 3efe476..8665de1 100644 --- a/README.md +++ b/README.md @@ -2,22 +2,36 @@ rbraspag gem to use Braspag gateway -# Instalation +* This gem need RACK_ENV environment variable to identify the environment - gem install rbraspag +# How to install -# Example +## for Rails 3 app -## Create a Bill (Boleto/Bloqueto for brazilian guys) - your_merchant_id = '{12341234-1234-1234-1234-123412341234}' - connection = Braspag::Connection.new your_merchant_id - Braspag::Bill.new(connection , { +### Add on your Gemfile + + gem "rbraspag" + +### Create a config/braspag.yml file + + $ rails generate braspag:install + +### Set RACK_ENV (our suggest) + + # add last line in config/environment.rb + # ... + # ENV["RACK_ENV"] ||= ENV["RAILS_ENV"] + +### Edit config/braspag.yml with your Braspag merchant_id + +# Examples + +## to create a Bill (Boleto/Bloqueto for brazilian guys) + @bill = Braspag::Bill.generate({ :order_id => 1, :amount => 3, :payment_method => 10 }) - @response = @bill.generate - # License diff --git a/lib/generators/braspag/install/install_generator.rb b/lib/generators/braspag/install/install_generator.rb new file mode 100644 index 0000000..8bb91c4 --- /dev/null +++ b/lib/generators/braspag/install/install_generator.rb @@ -0,0 +1,15 @@ +module Braspag + module Generators + class InstallGenerator < ::Rails::Generators::Base + desc "Copy braspag.yml file to your application config directory." + + def self.source_root + @source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates')) + end + + def copy_config_file + template "config/braspag.yml" + end + end + end +end \ No newline at end of file diff --git a/lib/generators/braspag/install/templates/config/braspag.yml b/lib/generators/braspag/install/templates/config/braspag.yml new file mode 100644 index 0000000..1ff012d --- /dev/null +++ b/lib/generators/braspag/install/templates/config/braspag.yml @@ -0,0 +1,17 @@ +development: + merchant_id: "{YOUR_MERCHANT_ID_ON_BRASPAG}" + braspag_url: "https://homologacao.pagador.com.br" + crypto_url: "http://localhost:9292" + crypto_key: "1234561246" + +test: + merchant_id: "{YOUR_MERCHANT_ID_ON_BRASPAG}" + braspag_url: "https://homologacao.pagador.com.br" + crypto_url: "http://localhost:9292" + crypto_key: "1234561246" + +production: + merchant_id: "{YOUR_MERCHANT_ID_ON_BRASPAG}" + braspag_url: "https://www.pagador.com.br" + crypto_url: "http://localhost:9292" + crypto_key: "1234561246" diff --git a/lib/rbraspag/version.rb b/lib/rbraspag/version.rb index b0f28a0..f880365 100644 --- a/lib/rbraspag/version.rb +++ b/lib/rbraspag/version.rb @@ -1,3 +1,3 @@ module Braspag - VERSION = "0.0.12" + VERSION = "0.0.13" end