Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mattheworiordan/jsbin-client
JSBin Ruby API
https://github.com/mattheworiordan/jsbin-client
Last synced: 3 months ago
JSON representation
JSBin Ruby API
- Host: GitHub
- URL: https://github.com/mattheworiordan/jsbin-client
- Owner: mattheworiordan
- License: mit
- Created: 2013-05-23T12:47:13.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-05-29T06:12:41.000Z (over 11 years ago)
- Last Synced: 2024-10-07T09:23:59.877Z (3 months ago)
- Language: Ruby
- Size: 137 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
jsbin-client
============[![Build Status](https://travis-ci.org/mattheworiordan/jsbin-client.png)](https://travis-ci.org/mattheworiordan/jsbin-client)
jsbin-client is a simple Ruby client for JSBin [http://jsbin.com/](http://jsbin.com/). It provides basic CRUD methods to retrieve a bin, create a bin, and create a revision for an existing bin.
The library supports anonymous or token authentication if required by the server.
Please see [https://github.com/remy/jsbin/pull/605](https://github.com/remy/jsbin/pull/605) for more information on JSBin's support API requests
Installation
------------Using Bundler, add the following to your Gemfile
gem 'jsbin-client'
or install manually using Ruby Gems:
gem install jsbin-client
Code example
------------```ruby
client = JsBinClient.new(host: 'jsbin.com', port: 80, ssl: false)bin = client.create(html: '', javascript: 'console.log("init");', css: 'body { color: red }')
# => {
# "html"=>"",
# "javascript": "console.log(\"init\");",
# "css": "body { color: red }'",
# "settings": "{ processors: {} }",
# "url": "[unique-id]",
# "revision": 1,
# "streamingKey": "[key]",
# "id": 7
# }bin.get(bin[:url])
# returns JSON representation of binbin.create_revision(bin[:url], html: 'updated html')
# returns JSON representation of new bin revisionbin.url_for(bin[:url])
# => 'http://jsbin.com:80/[unique-id]/edit'bin.url_for(bin[:url], preview: true)
# => 'http://jsbin.com:80/[unique-id]'bin.url_for(bin[:url], embed: true, panels: ['javascript', 'live'])
# => 'http://jsbin.com:80/[unique-id]/embed?javascript,live'
```Repository
----------Please fork, submit patches or feedback at [https://github.com/mattheworiordan/jsbin-client](https://github.com/mattheworiordan/jsbin-client)
The gem details on RubyGems.org can be found at [https://rubygems.org/gems/jsbin-client](https://rubygems.org/gems/jsbin-client)
About
-----This gem was written by **Matthew O'Riordan**
- [http://mattheworiordan.com](http://mattheworiordan.com)
- [@mattheworiordan](http://twitter.com/#!/mattheworiordan)
- [Linked In](http://www.linkedin.com/in/lemon)License
-------Copyright © 2013 Matthew O'Riordan, inc. It is free software, and may be redistributed under the terms specified in the LICENSE file.