{"id":13799790,"url":"https://github.com/adafruit/io-client-ruby","last_synced_at":"2025-10-05T20:28:26.146Z","repository":{"id":14505402,"uuid":"17218776","full_name":"adafruit/io-client-ruby","owner":"adafruit","description":"Adafruit IO Ruby Client","archived":false,"fork":false,"pushed_at":"2021-05-26T15:54:04.000Z","size":134,"stargazers_count":27,"open_issues_count":1,"forks_count":6,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-01-28T22:37:51.439Z","etag":null,"topics":["adafruit-io"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adafruit.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-02-26T17:24:15.000Z","updated_at":"2024-10-16T20:55:59.000Z","dependencies_parsed_at":"2022-07-15T18:00:35.366Z","dependency_job_id":null,"html_url":"https://github.com/adafruit/io-client-ruby","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adafruit%2Fio-client-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adafruit%2Fio-client-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adafruit%2Fio-client-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adafruit%2Fio-client-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adafruit","download_url":"https://codeload.github.com/adafruit/io-client-ruby/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237181551,"owners_count":19268056,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adafruit-io"],"created_at":"2024-08-04T00:01:06.129Z","updated_at":"2025-10-05T20:28:26.044Z","avatar_url":"https://github.com/adafruit.png","language":"Ruby","funding_links":[],"categories":["Code"],"sub_categories":[],"readme":"![Build Status](https://travis-ci.org/adafruit/io-client-ruby.svg?branch=master)\n\n# adafruit-io\n\nA [Ruby][1] client for use with with [io.adafruit.com][2].\n\nNote, this documentation covers the gem supporting V2 of the API, which is currently under active development and may be missing some features. It also breaks support for code that used version \u003c= 1.0.4 of this library.\n\nOlder releases are available at these links:\n\n* [1.0.4](https://github.com/adafruit/io-client-ruby/tree/v1.0.4)\n* [1.0.3](https://github.com/adafruit/io-client-ruby/tree/v1.0.3)\n* [1.0.0](https://github.com/adafruit/io-client-ruby/tree/v1.0.0)\n\nThis is a near complete rewrite and strip-down of the library intended to support V2 of the Adafruit IO API with less code, maintenance, and stress.\n\nWhy rewrite? This lets us the replace the existing, custom ActiveRecord-based interface with a flat, stateless API client returning plain hashes based on the JSON returned from API. Instead of writing a bunch of Ruby to make it feel like we're in a Rails app, we're just providing hooks into the API and a thin wrapper around Faraday.\n\nThe API is not very complex, code that uses it shouldn't be either.\n\n\n## Roadmap\n\nIt is our goal to eventually support all API V2 methods, but that will happen in stages.\n\n- [x] Feeds `2.0.0.beta.1`\n- [x] Data `2.0.0.beta.1`\n- [x] Groups `2.0.0.beta.1`\n- [x] MQTT `2.0.0.beta.3`\n- [x] Tokens `2.0.0.beta.4`\n- [x] Blocks `2.0.0.beta.4`\n- [x] Dashboards `2.0.0.beta.4`\n- [x] Activities `2.0.0.beta.5`\n- [x] Permissions `2.0.0.beta.5`\n- [x] Triggers `2.0.0.beta.6`\n\nStill needing complete tests:\n\n- [ ] MQTT\n\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n    gem 'adafruit-io'\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install adafruit-io\n\n\n\n## Basic Usage\n\nEach time you use the library, you'll have to pass your [Adafruit IO Key][4] to the client.\n\n\n```ruby\nrequire 'adafruit/io'\n\n# create an instance\naio = Adafruit::IO::Client.new key: 'KEY'\n```\n\nSince every API request requires a username, you can also pass a username to the client initializer to use it for every request.\n\n\n```ruby\nrequire 'adafruit/io'\n\n# create an instance\naio = Adafruit::IO::Client.new key: 'KEY', username: 'USERNAME'\n```\n\n\n\n### Environment Variables\n\nWhenever possible, we recommend you keep your Adafruit IO API credentials out of your application code by using environment variables. All the examples\n\n[Others](http://blog.honeybadger.io/ruby-guide-environment-variables/) have written about using environment variables in Ruby, so we're not going to go into detail. We recommend the [dotenv](https://github.com/bkeepers/dotenv) gem if you're building a Ruby project.\n\n\n\n### API Response Values\n\nAll return values are **plain Ruby hashes** based on the JSON response returned by the API. Most basic requests should get back a Hash with a `key` field. The key can be used in subsequent requests. API requests that return a list of objects will return a simple array of hashes. Feeds, Groups, and Dashboards all rely on the `key` value, other endpoints (Blocks, Permissions, Tokens, Triggers) use `id`.\n\nYou can find the current API documentation at [https://io.adafruit.com/api/docs/](https://io.adafruit.com/api/docs/). This library implements v2 of the Adafruit IO API.\n\n\n\n### API Error Responses\n\nAs of **v2.0.0**, this library raises an `Adafruit::IO::RequestError` on any non HTTP 200 status responses. Generally, this means your code should wrap API calls in `begin...rescue...end` blocks.\n\n```ruby\nrequire 'adafruit/io'\n\napi_key = ENV['IO_KEY']\nusername = ENV['IO_USER']\n\napi = Adafruit::IO::Client.new key: api_key, username: username\n\n\n\n```\n\n## Example\n\nHere's an example of creating, adding data to, and deleting a feed.\n\n\n```ruby\nrequire 'adafruit/io'\n\napi_key = ENV['IO_KEY']\nusername = ENV['IO_USER']\n\napi = Adafruit::IO::Client.new key: api_key, username: username\n\n# create a feed\nputs \"create\"\ngarbage = api.create_feed(name: \"Garbage 123\")\n\n# add data\nputs \"add data\"\napi.send_data garbage, 'something'\napi.send_data garbage, 'goes here'\n\n# load data\nputs \"load data\"\ndata = api.data(garbage)\nputs \"#{data.size} points: #{ data.map {|d| d['value']}.join(', ') }\"\n\n# get details\nputs \"read\"\nputs JSON.pretty_generate(api.feed_details(garbage))\n\n# delete feed\nputs \"delete\"\napi.delete_feed(garbage)\n\n# try reading\nputs \"read?\"\n# ... get nothing\nputs api.feed(garbage['key']).inspect\n```\n\n\nThis code and more is available in [the examples/ directory](examples/).\n\n## License\n\nCopyright (c) 2018 Adafruit Industries. Licensed under the MIT license.\n\n[Adafruit](https://adafruit.com) invests time and resources providing this open source code. Please support Adafruit and open-source hardware by purchasing products from [Adafruit](https://adafruit.com).\n\n## Contributing\n\n1. Fork it ( http://github.com/adafruit/io-client-ruby/fork )\n1. Create your feature branch (`git checkout -b my-new-feature`)\n1. Write tests, write code, and run the tests (`bundle exec rspec`)\n1. Commit your changes (`git commit -am 'Add some feature'`)\n1. Push to the branch (`git push origin my-new-feature`)\n1. Create a new Pull Request\n\nIf you'd like to contribute and don't know where to start, [reach out on the Adafruit IO forum](https://forums.adafruit.com/viewforum.php?f=56) or in the [adafruit-io channel on our Discord server](https://discord.gg/adafruit).\n\n[1]: https://www.ruby-lang.org\n[2]: https://io.adafruit.com\n[3]: https://learn.adafruit.com/adafruit-io/feeds\n[4]: https://learn.adafruit.com/adafruit-io/api-key\n[5]: https://learn.adafruit.com/adafruit-io/groups\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadafruit%2Fio-client-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadafruit%2Fio-client-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadafruit%2Fio-client-ruby/lists"}