Ruby client library for Magnum CI API
Add this line to your application's Gemfile:
gem "magnum-client"
And then execute:
bundle
Or install it yourself as:
$ gem install magnum-client
Require client:
require "magnum/client"
Connection with existing API token:
client = Magnum::Client.new("api_token")
Authenticate user:
client = Magnum::Client.new
client.authenticate("email", "password")
# Get user profile details
client.profile
#Update user profile
client.update_profile(login: "jimi", email: "[email protected]")
# Get projects
client.projects
# Get a single project
client.project(12345)
# Create a new project
client.create_project(
name: "foobar",
source_url: "[email protected]:foo/bar.git"
)
# Update existing project
client.update_project(
name: "newname"
source_url: "[email protected]:foo/bar.git"
provider: "gitlab"
)
# Delete existing project
client.delete_project(12345)
project_id = 12345
# Get project builds
client.builds(project_id)
# Get a single build
client.build(project_id, 12345)
# Get build log
client.build_log(project_id, 12345)
# Delete a build
client.delete_build(project_id, 12345)
Send commit payload:
Magnum::Client.send_payload("project token", "data")
To run test suite execute:
bundle exec rake test
The MIT License (MIT)
Copyright (c) 2013-2014 Dan Sosedoff, [email protected]