Ruby Client for the CodePicnic's API.
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install codepicnic
Authentication with Rest API
CodePicnic.client_id = "CLIENT_ID" CodePicnic.client_secret = "CLIENT_SECRET" puts CodePicnic.token
CodePicnic.client_id saves your
CLIENT_ID that is provided in your profile page. The same happens with your
CLIENT_SECRET. Next you generate the access token for authenticate your application.
For more information and examples, check out our API's documentation
Listing all your consoles
results = CodePicnic::Console.all
Saving a new console
console = CodePicnic::Console.new( container_type: "bash", title: "api-spec", container_size: "medium" ) console.save
CodePicnic::Console.new creates a new console with all the necessary parameters and then storage it with the
For a better console customization we offer you the following parameters:
||(optional) Any of user's or Docker Hub's generated Docker image|
||(optional) Pick a name for your console. Make it personal!|
||(optional) Any name you'd like to be used as your console hostname:
||(optional) The mode the console is currently in:
CodePicnic::Console has the following methods:
CodePicnic::Console#start: Start the server attached to the console and returns the result.
CodePicnic::Console#stop: Stop the server attached to the console and returns the result.
CodePicnic::Console#restart: Restart the server attached to the console and returns the result.
CodePicnic::Console#upload_file(file, path = nil): Uploads a File object to the console to the
CodePicnic::Console.find(container_name = ""): Returns a single CodePicnic::Console instance
CodePicnic::Console.forks: Check out the forks the console has.
CodePicnic::Console.file(path = ""): Returns the list of files that has been added to the console.
CodePicnic::Console#exec(commands = ): Execute commands inside the server attached to the console and returns the commands content.
CodePicnic::Console.all: Return an array of consoles created by the user.
After checking out the repo, run
bin/setup to install dependencies. You can also 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, which will create a git tag for the version, push git commits and tags, and push the
.gem file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/codepicnic-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.