Skip to content

Repository files navigation

Fedapay::Ruby

Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file lib/fedapay/ruby. To experiment with that code, run bin/console for an interactive prompt.

TODO: Delete this and the text above, and describe your gem

Installation

Add this line to your application's Gemfile:

gem'fedapay-ruby'

And then execute:

$ bundle

Or install it yourself as:

$ gem install fedapay-ruby

Usage

requirefedapay# configure FedaPay libraryFedaPay.api_key=''# Your secret api keyFedaPay.environment=''# sandbox or live

Customer operations

# customers listcustomers=FedaPay::Customer.list# get a customer by idcustomer=FedaPay::Customer.retrieve1# create a customerphone={country: 'bj',number: '66000001'}customer=FedaPay::Customer.createfirstname: 'firstname',lastname: 'lastname',email: 'email@test.com',phone_number: phone# update a customer instancecustomer.firstname='My Firstname'customer.save# orcustomer.savefistname: 'My Firstname',lastname: 'My Lastname'# Update a customer by idcustomer=FedaPay::Customer.update202,email: 'myemail@test.com'# Delete a customer by instancecustomer.delete

Transaction operations

# transactions listtransactions=FedaPay::Transaction.list# Get a transactiontransaction=FedaPay::Transaction.retrieve2# Create a transaction with existing customer instancecurrencies=FedaPay::Currency.listcustomer=FedaPay::Customer.retrieve2transaction=FedaPay::Transaction.createamount: 1000,currency: currencies.first.to_hash,customer=customer.to_hash,description: ''# Create a transaction with existing customer by id or emailcustomer={id: 1,# Or emailemail: 'customer@test.com'}currency={iso: 'XOF',# Or code,code: '952'}transaction=FedaPay::Transaction.createamount: 1000,currency: currencies,customer=customer,description: ''# New customer can also be created when creating a transactioncustomer={email: 'customer@test.com',firstname: 'New firstname',lastname: 'New Lastname'}
...
# Update a transaction instancetransaction.amount=5000transaction.save# Ortransaction.saveamount: 5000# Update a transaction by idFedaPay.update2,amount: 5000# Delete a transactiontransaction.delete# Generate a secured payment link for a transaction or get it tokendata=transaction.generate_token# data structure is :# {# token: '',# url: 'https://...'# }

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/fedapay-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Fedapay::Ruby project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

About

Ruby library for FedaPay Api

Resources

Code of conduct

Stars

1 star

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages