razorpay / razorpay-ruby

Razorpay Ruby SDK
https://rubygems.org/gems/razorpay
MIT License
64 stars 59 forks source link

Razorpay Ruby bindings

Build Status Gem Version Coverage Status License

This is the base ruby gem for interacting with the Razorpay API. This is primarily meant for users who wish to perform interactions with the Razorpay API programatically.

Installation

Add this line to your application's Gemfile:

gem 'razorpay'

And then execute:

$ bundle

Or install it yourself as:

$ gem install razorpay

Requirements

Ruby 2.6.8 or later

Usage

Remember to require 'razorpay' before anything else.

Next, you need to setup your auth details. This setup can be done via two ways:

Using Private Auth

you need to setup your key and secret using the following:

Razorpay.setup('key_id', 'key_secret')

You can set customer headers for your requests using the following:

Razorpay.headers = {"CUSTOM_APP_HEADER" => "CUSTOM_VALUE"}

Using Access Token

you need to setup your access token using the following

Razorpay.setup_with_oauth('access_token')

You can set customer headers for your requests using the following:

Razorpay.headers = {"CUSTOM_APP_HEADER" => "CUSTOM_VALUE"}

You can find your API keys at https://dashboard.razorpay.com/#/app/keys.

If you are using rails, the right place to do this might be config/initializers/razorpay.rb.

Supported Resources

Development

Contributing

  1. Fork it ( https://github.com/razorpay/razorpay-ruby/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Run rake and rubocop after making your changes to make sure you didn't break anything
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create a new Pull Request

Release

Steps to follow for a release:

  1. Merge the branch with the new code to master.
  2. Bump the Version in lib/razorpay/constants.rb
  3. Rename Unreleased to the new tag in CHANGELOG
  4. Fix links at bottom in CHANGELOG
  5. Commit (message should include version number)
  6. Tag the release and push to GitHub. Get the tag signed using Razorpay GPG key.
  7. Create a release on GitHub using the website with more details about the release
  8. Run gem build razorpay-ruby.gemspec
  9. Run gem push razorpay-{version}.gem

gem push will ask you for credentials, if you are not logged in already.