Skip to content

Commit

Permalink
Updated README and added notifier to Rails helper.
Browse files Browse the repository at this point in the history
  • Loading branch information
nbibler committed Dec 12, 2008
1 parent 3aed75c commit ba34f42
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 17 deletions.
51 changes: 34 additions & 17 deletions README.rdoc
Expand Up @@ -20,27 +20,44 @@ The following services are coming someday (hopefully soon):

== SYNOPSIS:

Set up the gem requirement in your environment:

(in config/environment.rb)

config.gem "simplepay"

Configure the gem with your Amazon credentials:

(in config/initializers/simplepay.rb)

Simplepay.aws_access_key_id = 'MYAMAZONACCESSKEYID'
Simplepay.aws_secret_access_key = 'MYAMAZONSECRETACCESSKEY'
Simplepay.account_id = 'ACCOUNTIDFORAMAZONPAYMENTS'
(in config/initializers/simplepay.rb)

Simplepay.aws_access_key_id = 'MYAMAZONACCESSKEYID'
Simplepay.aws_secret_access_key = 'MYAMAZONSECRETACCESSKEY'
Simplepay.account_id = 'ACCOUNTIDFORAMAZONPAYMENTS'

Then, let Rails know about the Simplepay::Helpers:

(potentially in app/controllers/application[_controller].rb or really anywhere else)

require 'simplepay/rails'


=== Generating your Simple Pay forms

Generally, this library will then be used directly from one (or more) of your
views, like so:

<%= simplepay_form_for(:standard, {
:amount => 10.95,
:description => "Profit!"
}) %>

<%= simplepay_form_for(:subscription, {
:amount => 10.95,
:description => "MORE Profit!",
:recurring_frequency => "1 month"
}) %>
views. Depending on the type of Simple Pay service you're using (see
Simplepay::Services), some form values will be required, while others may be
optional. This is done like so:

<%= simplepay_form_for(:standard, {
:amount => 10.95,
:description => "Profit!"
}) %>

<%= simplepay_form_for(:subscription, {
:amount => 10.95,
:description => "MORE Profit!",
:recurring_frequency => "1 month"
}) %>

== REQUIREMENTS:

Expand Down
4 changes: 4 additions & 0 deletions lib/simplepay/rails.rb
@@ -1,5 +1,9 @@
require 'simplepay'
require 'simplepay/helpers/rails_helper'
require 'simplepay/helpers/notification_helper'

# Inject helper into Rails ActionView.
ActionView::Base.__send__(:include, Simplepay::Helpers::RailsHelper)

# Inject notification helper into ActionController
ActionController::Base.__send__(:include, Simplepay::Helpers::NotificationHelper)

0 comments on commit ba34f42

Please sign in to comment.