Skip to content

krallin/aptible-billing-ruby

 
 

Repository files navigation

Aptible::Billing

Gem Version Build Status Dependency Status

Ruby client for billing.aptible.com. Aptible's billing server is built on top of OAuth 2.0 and HAL+JSON, and so this client is just a thin layer on top of the oauth2 and HyperResource gems.

Installation

Add the following line to your application's Gemfile.

gem 'aptible-billing'

And then run bundle install.

Usage

First, get a token:

token = Aptible::Auth::Token.create(email: 'user0@example.com', password: 'password')

From here, you can interact with the Billing API however you wish:

billing_details = Aptible::Billing::BillingDetail.find(id: '1', token: token)
billing_details.href
# => "http://localhost:4000/billing_details/1"

Configuration

Parameter Description Default
root_url Root URL of the billing server ENV['APTIBLE_BILLING_ROOT_URL'] or https://billing.aptible.com

To point the client at a different billing server (e.g., during development), add the following to your application's initializers (or set the APTIBLE_BILLING_ROOT_URL environment variable):

Aptible::Billing.configure do |config|
  config.root_url = 'http://some.other.url'
end

Contributing

  1. Fork the project.
  2. Commit your changes, with specs.
  3. Ensure that your code passes specs (rake spec) and meets Aptible's Ruby style guide (rake rubocop).
  4. Create a new pull request on GitHub.

Copyright and License

MIT License, see LICENSE for details.

Copyright (c) 2015 Aptible, and contributors.

@blakepettersson

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%