ForteRuby
The ForteRuby provides Ruby APIs for customers, addresses, settlements and transactions resourses using the Forte API.
Installation
Add this line to your application's Gemfile:
gem 'forte_ruby'
And then execute:
$ bundle
Or install it yourself as:
$ gem install forte_ruby
Usage
Create a configuration file(config/forte_ruby.yml
):
development: &default
api_login_id: your_login_id
secure_transaction_key: you_key
account_id: your_account_id
location_id: you_location_id
endpoint: https://sandbox.forte.net/api/v1
test:
<<: *default
production:
api_login_id: your_login_id
secure_transaction_key: you_key
account_id: your_account_id
location_id: you_location_id
endpoint: https://forte.net/api/v1
Get customers list
ForteRuby.customers.all
Update/delete customer
customer = ForteRuby.customers.all.first
customer.update(first_name: 'Bob')
customer.delete
Create new customer
customer = ForteRuby.customers.build_from(first_name: 'Bob')
customer.save
Find customer by id
ForteRuby.customers.find_by_id('cst_123')
Use filters to get customers
ForteRuby.customers.filter(first_name: 'Bob')
Get addresses list
customer = ForteRuby.customers.all.first
addresses = customer.addresses.all
You can use the same methods for transactions and settlements. But this gem provide only read operations for them.
Contributing
- Fork it ( https://github.com/[my-github-username]/forte_ruby/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request