<commit_before>= RedLine

Braintree via Redline: riding the rails

Automatically makes creation/deletion/update scripts for your model, translating and syncing them with a Braintree customer profile.

Planning on adding extremely light-weight subscription support.


  class User < ActiveRecord::Base
    acts_as_braintree_customer :business_name => :company, :firstname => :first_name, :lastname => :last_name
    attr_accessible :firstname, :lastname, :website, :email, :business_name, :password, :password_confirmation
  end

acts_as_braintree_customer takes an optional series of attributes that represent an attribute[] mapper

  james = User.find(1) #=> <User id: 1, firstname: "James", lastname: "Daniels", business_name: "MarginLeft, LLC", email: '<EMAIL>', website: 'http://www.marginleft.com', crypted_password: "<PASSWORD>...", persistence_token: "<PASSWORD>...", ...>
  james.customer #=> <Braintree::Customer id: "9999999", first_name: "James", last_name: "Daniels", company: "MarginLeft, LLC", email: "<EMAIL>", website: "http://www.marginleft.com", ..., addresses: [], credit_cards: []>

More to come.

== Note on Patches/Pull Requests
 
* Fork the project.
* Make your feature addition or bug fix.
* Add tests for it. This is important so I don't break it in a<commit_msg>Updated the readme<commit_after>= RedLine

Braintree via Redline: riding the rails

Redline helps you with Braintree on Rails, it automatically makes creation/deletion/update scripts for your model, translating and syncing them with a Braintree customer profile. In the future I plan to increase the capabilities with helpers for Braintree models and light-weight subscription support, perhaps using Braintree's reoccurring billing.

== Getting started

Set up the gem dependancies in environment.rb:

  config.gem 'braintree'
  config.gem 'redline'

Run your install task:

  $ rake gems:install

Configure Braintree normally in an initializer:

  Braintree::Configuration.environment = CONFIG[:braintree][:environment].to_sym
  Braintree::Configuration.merchant_id = CONFIG[:braintree][:merchant_id]
  Braintree::Configuration.public_key  = CONFIG[:braintree][:public_key]
  Braintree::Configuration.private_key = CONFIG[:braintree][:private_key]

Add acts_as_braintree_customer and a column customer_id:integer to a model of your choice:

  add_column :users, :customer_id, :integer

  Class User < ActiveRecord::Base
    acts_as_braintree_customer
  end

== Example and configuration

Planning on adding extremely light-weight subscription support.


  class User < ActiveRecord::Base
    acts_as_braintree_customer :business_name => :company, :firstname => :first_name, :lastname => :last_name
    attr_accessible :firstname, :lastname, :website, :email, :business_name, :password, :password_confirmation
  end

acts_as_braintree_customer takes an optional series of attributes that represent an attribute[] mapper

  james = User.find(1) #=> <User id: 1, firstname: "James", lastname: "Daniels", business_name: "MarginLeft, LLC", email: '<EMAIL>', website: 'http://www.marginleft.com', crypted_password: "<PASSWORD>...", persistence_token: "<PASSWORD>...", ...>
  james.customer #=> <Braintree::Customer id: "9999999", first_name: "James", last_name: "Daniels", company: "MarginLeft, LLC", email: "<EMAIL>", website: "http://www.marginleft.com", ..., addresses: [], credit_cards: []>

More to come.

== Note on Patches/Pull Requests
 
* Fork the project.
* Make your feature addition or bug fix.
* Add tests for it. This is important so I don't break it in a
{'fraction_non_alphanumeric': 0.11317567567567567, 'fraction_numerical': 0.005067567567567568, 'mean_word_length': 5.448275862068965, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1240963', 'n_tokens_mistral': 1082, 'n_tokens_neox': 1035, 'n_words': 349}