Ruby client for the ServerPilot API
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
lib
spec
.autotest
.gitignore
.rspec
.travis.yml
Gemfile
LICENSE.txt
README.md
Rakefile
ServerPilot.gemspec

README.md

ServerPilot

Ruby client gem for accessing ServerPilot API Current version (0.0.4).

Installation

Add this line to your application's Gemfile:

gem 'ServerPilot'

And then execute:

$ bundle

Or install it yourself as:

$ gem install ServerPilot

Usage

To create a connection require 'ServerPilot' In your code add something like sp = ServerPilot::API.new(api_client, api_key) where client_id and key are your API information from ServerPilot.

If the serverpilot api changes host, port, or scheme you can alter these using calls to properties on the class

sp.scheme = 'http' or 'https'

sp.host = 'newserverpilotaddress.io'

sp.port = 1000

These should be called before you start doing anything with the class

Functions

Commands are issued such as sp.[verb]_[action]

In use it would look something like:

sp.get_servers 'UXOSIYrdtL4cSGp3'

or using hash params:

sp.post_sysusers {serverid: 'UXOSIYrdtL4cSGp3', name: 'abc123', password: '1234'}

This is a list of the ruby functions to call on the server pilot object (e.g sp.get_servers) and matching ServerPilot API methods. [id] is the identifier of the server, app, database that you can retrieve via the API. [params] is a hash of data to send to the api as JSON

Ruby Method Description Serverpilot API
[obj].get_servers Get a list of your servers GET /servers
[obj].post_servers Connect a new server POST /servers
[obj].get_servers [id] Retrieve existing server GET /servers/:id
[obj].delete_servers [id] Delete a server DELETE /servers/:id
[obj].post_servers [id] [params] Update a server POST /server/:id
[obj].get_sysusers List all system users GET /sysusers
[obj].post_sysusers [params] Create new system user POST /sysusers
[obj].get_sysusers [id] Retrieve existing user GET /sysusers/:id
[obj].delete_sysusers [id] Delete a system user DELETE /sysusers/:id
[obj].post_sysusers [id] [params] Update the password of a system user POST /sysusers/:id
[obj].get_apps List all apps GET /apps
[obj].post_apps [params] Create an app POST /apps
[obj].get_apps [id] Retrieve app GET /apps/:id
[obj].delete_apps [id] Delete an app DELETE /apps/:id
[obj].post_apps [id] [params] Update an app POST /apps/:id
[obj].post_ssl [id] [params] Add an SSL POST /apps/:id/ssl
[obj].delete_ssl [id] Delete an SSL DELETE /apps/:id/ssl
[obj].get_dbs Get databases GET /dbs
[obj].post_dbs [params] Create a new database POST /dbs
[obj].get_dbs [id] Retrieve existing db GET /dbs/:id
[obj].delete_dbs [id] Delete a database DELETE /dbs/:id
[obj].post_dbs [id] [params] Update the database user password POST /dbs/:id
[obj].get_actions [id] Get status of action GET /actions/:id

Development

After checking out the repo, run bin/setup to install dependencies. Then, run bin/console for an interactive prompt that will allow you to experiment.

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 to create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

  1. Fork it ( https://github.com/[my-github-username]/ServerPilot/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request