Skip to content

pestanko/3scale-api-ruby

 
 

Repository files navigation

This gem aims to expose most of the 3scale APIs with a Ruby interface.

Installation

Add this line to your application's Gemfile:

gem 'ThreeScaleRest', git: 'https://github.com/pestanko/3scale-api'

And then execute:

$ bundle

Or install it yourself as:

$ gem install ThreeScaleRest

Usage

# Initialization
require 'three_scale_api'
client = ThreeScaleApi::Client.new(endpoint: 'https://foo-admin.3scale.net', provider_key: 'foobar', log_level: 'debug')

# Services
services = client.services.list
service = client.services['my_service']
hits = service.metrics['Hits']

# Accounts
org_account = client.accounts.create({ org_name: 'my_org', username: 'john' })
john = org_account.users['john']
john['email'] = 'john@example.com'
john['name'] = 'John Snow'
john.update
john.delete

Design

Design decisions:

  • 0 runtime dependencies
  • thread safety
  • tested

Development

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.

Testing

You need to have set these ENV variables:

ENDPOINT=               # Url to admin pages
PROVIDER_KEY=           # Provider key
THREESCALE_LOG=         # Logging level (debug, warn, error, info)

Contributing

Bug reports and pull requests are welcome on GitHub.

About

3scale API Ruby Client

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%