Straight-API

Straight API is a API wrapper for Straight Server for ruby and ruby on rails.

Installation

Add this line to your application's Gemfile:

gem 'straight-api'

And then execute:

$ bundle

Or install it yourself as:

$ gem install straight-api

and then require it in your ruby application:

require 'straight-api'

Usage

Initialize

Create a new instance of Straight:

straight = Straight.new("http://localhost:9696", 1)

The first parameter the host of your Straight Server instance, and the second parameter is the gateway ID. You can include any extra parameters which will be included in every request.

Create an Order

You can create a new order:

order = straight.new(1, :currency => "USD")

The first parameter is the amount. You can include any extra parameters (currency, etc.) which will be included in the request.

You can access the ID, status, tid, amount and address of your new order:

id = order.id
status = order.status
tid = order.tid
amount = order.amount
address = order.address

Get an Order

You can get the information of an order:

order = straight.get(1)

The first parameter is the order's ID. You can include any extra parameters which will be included in the request.

You can access the ID, status, tid, amount and address of the order:

id = order.id
status = order.status
tid = order.tid
amount = order.amount
address = order.address

Contributing

  1. Fork it ( https://github.com/[my-github-username]/straight-api/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Add your features and write tests for them
  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