StraightServerKit is the official StraightServer API client. It supports everything the API can do with a simple interface written in Ruby.
Add this line to your application's Gemfile:
gem 'straight-server-kit'
And then execute:
$ bundle
Or install it yourself as:
$ gem install straight-server-kit
client = StraightServerKit::Client.new(gateway_id: 'gateway_id', secret: 'secret', url: 'http://gear.loc')
client = StraightServerKit::Client.new(gateway_id: 1, secret: 'secret')
client.orders #=> StraightServerKit::OrderResource
Actions supported:
client.orders.create(order)
client.orders.find(id: 'id')
client.orders.cancel(id: 'id')
order = StraightServerKit::Order.new(amount: 0.01, callback_data: '123', keychain_id: 1)
client.orders.create(order)
if StraightServerKit.valid_callback?(signature: env['HTTP_X_SIGNATURE'], request_uri: (URI(env['REQUEST_URI']).request_uri rescue env['REQUEST_URI']), secret: gateway_secret)
# params can be trusted
end
- Fork it ( https://github.com/MyceliumGear/straight-server-kit )
- 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