Compare commits

..

No commits in common. "main" and "get-fix-2" have entirely different histories.

15 changed files with 97 additions and 129 deletions

View file

@ -8,7 +8,7 @@ jobs:
deploy:
runs-on: ubuntu-latest
env:
ruby-version: 3.2.2
ruby-version: 2.6.5
steps:
- uses: actions/checkout@v2
@ -17,7 +17,7 @@ jobs:
with:
ruby-version: ${{ env.ruby-version }}
- uses: actions/cache@v4
- uses: actions/cache@v2
with:
path: vendor/bundle
key: gems-${{ runner.os }}-${{ matrix.ruby-version }}-${{ hashFiles('**/Gemfile.lock') }}

View file

@ -1,4 +1,4 @@
FROM ruby:3.2.2
FROM ruby:2.6.5
COPY . /usr/src/app
VOLUME /usr/src/app
EXPOSE 4567

19
Gemfile
View file

@ -1,17 +1,14 @@
ruby '>= 3.2.2'
ruby '>= 2.6.5'
source 'https://rubygems.org'
# Middleman
gem 'ffi', '~> 1.16.3'
gem 'middleman', '~> 4.5.0'
gem 'middleman-autoprefixer', '~> 3.0.0'
gem 'ffi', '~> 1.14.2'
gem 'middleman', '~> 4.3.4'
gem 'middleman-autoprefixer', '~> 2.10.0'
gem 'middleman-sprockets', '~> 4.1.1'
gem 'middleman-syntax', '~> 3.2.0'
gem 'nokogiri', '~> 1.18.8'
gem 'rack', '~> 2.2.13'
gem 'redcarpet', '~> 3.6.0'
gem 'rouge', '~> 3.30.0'
gem 'nokogiri', '~> 1.13.10'
gem 'rack', '~> 2.2.6'
gem 'redcarpet', '~> 3.5.1'
gem 'rouge', '~> 3.26.0'
# middleman-syntax won't work with haml6
# See: https://github.com/middleman/middleman-syntax/issues/80
gem 'haml', '< 6.0.0'

View file

@ -1,59 +1,59 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (7.0.8)
activesupport (5.2.4.5)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0)
autoprefixer-rails (10.4.15.0)
execjs (~> 2)
backports (3.24.1)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
autoprefixer-rails (9.8.6.5)
execjs
backports (3.20.2)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.2.2)
contracts (0.16.1)
dotenv (2.8.1)
concurrent-ruby (1.1.8)
contracts (0.13.0)
dotenv (2.7.6)
erubis (2.7.0)
execjs (2.9.1)
fast_blank (1.0.1)
fastimage (2.2.7)
ffi (1.16.3)
haml (5.2.2)
execjs (2.7.0)
fast_blank (1.0.0)
fastimage (2.2.3)
ffi (1.14.2)
haml (5.2.1)
temple (>= 0.8.0)
tilt
hamster (3.0.0)
concurrent-ruby (~> 1.0)
hashie (3.6.0)
i18n (1.6.0)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
kramdown (2.4.0)
kramdown (2.3.1)
rexml
listen (3.8.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
listen (3.0.8)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
memoist (0.16.2)
middleman (4.5.0)
middleman (4.3.11)
coffee-script (~> 2.2)
haml (>= 4.0.5)
kramdown (>= 2.3.0)
middleman-cli (= 4.5.0)
middleman-core (= 4.5.0)
middleman-autoprefixer (3.0.0)
autoprefixer-rails (~> 10.0)
middleman-core (>= 4.0.0)
middleman-cli (4.5.0)
middleman-cli (= 4.3.11)
middleman-core (= 4.3.11)
middleman-autoprefixer (2.10.1)
autoprefixer-rails (~> 9.1)
middleman-core (>= 3.3.3)
middleman-cli (4.3.11)
thor (>= 0.17.0, < 2.0)
middleman-core (4.5.0)
activesupport (>= 6.1, < 7.1)
addressable (~> 2.4)
middleman-core (4.3.11)
activesupport (>= 4.2, < 6.0)
addressable (~> 2.3)
backports (~> 3.6)
bundler (~> 2.0)
contracts (~> 0.13)
bundler
contracts (~> 0.13.0)
dotenv
erubis
execjs (~> 2.0)
@ -61,79 +61,74 @@ GEM
fastimage (~> 2.0)
hamster (~> 3.0)
hashie (~> 3.4)
i18n (~> 1.6.0)
listen (~> 3.0)
i18n (~> 0.9.0)
listen (~> 3.0.0)
memoist (~> 0.14)
padrino-helpers (~> 0.15.0)
padrino-helpers (~> 0.13.0)
parallel
rack (>= 1.4.5, < 3)
sassc (~> 2.0)
servolux
tilt (~> 2.0.9)
toml
uglifier (~> 3.0)
webrick
middleman-sprockets (4.1.1)
middleman-core (~> 4.0)
sprockets (>= 3.0)
middleman-syntax (3.2.0)
middleman-core (>= 3.2)
rouge (~> 3.2)
mini_portile2 (2.8.8)
minitest (5.20.0)
nokogiri (1.18.8)
mini_portile2 (~> 2.8.2)
mini_portile2 (2.8.1)
minitest (5.14.4)
nokogiri (1.13.10)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
padrino-helpers (0.15.3)
i18n (>= 0.6.7, < 2)
padrino-support (= 0.15.3)
padrino-helpers (0.13.3.4)
i18n (~> 0.6, >= 0.6.7)
padrino-support (= 0.13.3.4)
tilt (>= 1.4.1, < 3)
padrino-support (0.15.3)
parallel (1.23.0)
parslet (2.0.0)
public_suffix (5.0.3)
racc (1.8.1)
rack (2.2.13)
rb-fsevent (0.11.2)
padrino-support (0.13.3.4)
activesupport (>= 3.1)
parallel (1.20.1)
public_suffix (4.0.6)
racc (1.6.2)
rack (2.2.6.2)
rb-fsevent (0.10.4)
rb-inotify (0.10.1)
ffi (~> 1.0)
redcarpet (3.6.0)
rexml (3.3.9)
rouge (3.30.0)
redcarpet (3.5.1)
rexml (3.2.5)
rouge (3.26.0)
sassc (2.4.0)
ffi (~> 1.9)
servolux (0.13.0)
sprockets (4.0.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
temple (0.10.3)
thor (1.2.2)
tilt (2.0.11)
toml (0.3.0)
parslet (>= 1.8.0, < 3.0.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
temple (0.8.2)
thor (1.1.0)
thread_safe (0.3.6)
tilt (2.0.10)
tzinfo (1.2.10)
thread_safe (~> 0.1)
uglifier (3.2.0)
execjs (>= 0.3.0, < 3)
webrick (1.8.2)
PLATFORMS
ruby
DEPENDENCIES
ffi (~> 1.16.3)
haml (< 6.0.0)
middleman (~> 4.5.0)
middleman-autoprefixer (~> 3.0.0)
ffi (~> 1.14.2)
middleman (~> 4.3.4)
middleman-autoprefixer (~> 2.10.0)
middleman-sprockets (~> 4.1.1)
middleman-syntax (~> 3.2.0)
nokogiri (~> 1.18.8)
rack (~> 2.2.13)
redcarpet (~> 3.6.0)
rouge (~> 3.30.0)
nokogiri (~> 1.13.10)
rack (~> 2.2.6)
redcarpet (~> 3.5.1)
rouge (~> 3.26.0)
RUBY VERSION
ruby 3.2.2p53
ruby 2.6.5p114
BUNDLED WITH
2.1.4

View file

@ -1,7 +1,6 @@
services:
app:
build: .
ports:
- 4567:4567
volumes:
- .:/usr/src/app
app:
build: .
ports:
- 4567:4567
volumes:
- .:/usr/src/app

View file

@ -29,7 +29,6 @@ includes:
- cookbook/images.md.erb
- cookbook/sending_json.md.erb
- cookbook/webhook_receivers.md.erb
- cookbook/securing_io_account.md.erb
search: true
---

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View file

@ -1,10 +1,10 @@
# Authentication
Your Adafruit IO Key is used to restrict or grant access to your data. The key is unique and covers every use of the Adafruit IO API for your account. You can access your key on any IO page by clicking on the golden key icon:
Your Adafruit IO Key is used to restrict or grant access to your data. The key is unique and covers every use of the Adafruit IO API for your account. You can access your key any dashboard by clicking on the golden key icon:
<%= image_tag "images/authentication/aio-key-dashboard-link.png" %>
Or by clicking on the "View Adafruit IO Key" link in the small screen drop-down menu while you're visiting Adafruit IO.
Or by clicking on the "View AIO Key" link in the sidebar while you're visiting Adafruit IO.
<%= image_tag "images/authentication/aio-key-sidebar-link.png" %>
@ -34,5 +34,3 @@ api = Adafruit::IO::Client.new key: api_key, username: username
When making HTTP requests to Adafruit IO, you can include the API key as a query parameter named `x-aio-key` or as a request header named `X-AIO-Key`. In both cases, "X-AIO-Key" is case insensitive.
**NOTE**: if you regenerate your AIO key, your old key will be immediately invalidated, so you'll have to replace it in any scripts or sketches where it is in use.
**NOTE**: it is a best practice to avoid including your API key in the URL as a query parameter. Some situations may require this, but try to avoid it if you can.

View file

@ -9,7 +9,6 @@ Error Code | Meaning
403 | Forbidden -- This action is not permitted.
404 | Not Found -- The specified record could not be found.
406 | Not Acceptable -- You requested a format that we don't serve.
422 | Unprocessable Entity -- You've sent data we can't accept/understand. Is the value field (string/number) missing?
429 | Too Many Requests -- You're sending or requesting data too quickly! Slow down!
500 | Internal Server Error -- We had a problem with our server. Try again later.
503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later.

View file

@ -1,17 +0,0 @@
# Securing your IO Account
Your IO Account includes a secret API key. This key is private and should not be shared with anyone.
But, a common pitfalls of the key is it may be accidentally shared by posted code on GitHub or social media. If anyone gains access to your key, **they will have access to your Adafruit IO account**.
## I accidentially shared my key, what do I do now?
You'll need to generate a new key. This process is simple, but not reversable. Once you generate a new key for your Adafruit IO account,
all devices using the previous Adafruit IO key will need to be updated to the new key.
To rengenerate your Adafruit IO Key:
* Navigate to io.adafruit.com and log into your account.
* Click the key icon on the header.
* Click the "Regenerate Key" button and confirm the action.
* The value of "Active Key" will change to a new key. Replace all instances of the previous key with the new one.

View file

@ -88,4 +88,4 @@ atob("eyJzb21ldGhpbmciOiJoZXJlIn0=")
```
<% end %>
This solution is also ideal if you want to store or send binary data with Adafruit IO. You won't get to see any pretty charts (although we do display base64 encoded images), but your data will remain exactly the way you left it.
This solution is also ideal if you want to store or send binary data with Adafruit IO. You won't get to see any pretty charts, but your data will remain exactly the way you left it.

View file

@ -6,7 +6,7 @@ You can create, read, update, or delete data records. Every **CREATE**, **UPDATE
Data points belong to feeds, so every Data API call starts with a Feed URL.
Note that there are endpoints for submitting multiple data points to a feed, and multiple feed values to a group, see **feeds/{feed_key}/batch** and **groups/{groupname}/data** endpoints.
## Create Data
@ -14,8 +14,8 @@ Note that there are endpoints for submitting multiple data points to a feed, and
> <div class="http"><span class="method-post">POST</span><code class="path">/api/v2/{username}/feeds/{feed_key}/data</code></div>
```shell
# Send new data with a value of 42 (note: using single quotes instead prevents variable expansion etc in bash)
$ curl -F "value=42" -H "X-AIO-Key: {io_key}" https://io.adafruit.com/api/v2/{username}/feeds/{feed_key}/data
# Send new data with a value of 42
$ curl -F 'value=42' -H "X-AIO-Key: {io_key}" https://io.adafruit.com/api/v2/{username}/feeds/{feed_key}/data
# Send new data with a value of 42 and include optional location metadata
curl -H "Content-Type: application/json" -d '{"value": 42, "lat": 23.1, "lon": "-73.3"}' -H "X-AIO-Key: {io_key}" https://io.adafruit.com/api/v2/{username}/feeds/{feed_key}/data
@ -76,7 +76,7 @@ feed_key | string | true | a valid feed key
Parameter | Type | Required | Description
--------- | ------- | --------- | -----------------------
<b>Request Body</b> | object | true | Data record (datum) including a `value` field (required) and optionally including: `lat`, `lon`, `ele` (latitude, longitude, and elevation values), and `created_at` (a date/time string).
datum | object | true | Data record including a `value` field (required) and optionally including: `lat`, `lon`, `ele` (latitude, longitude, and elevation values), and `created_at` (a date/time string).
@ -562,7 +562,7 @@ id | string | true |
Parameter | Type | Required | Description
--------- | ------- | --------- | -----------------------
<b>Request Body</b> | object | true | Data record (datum) including a `value` field (required) and optionally including: `lat`, `lon`, `ele` (latitude, longitude, and elevation values), and `created_at` (a date/time string).
datum | object | true | Data record including a `value` field (required) and optionally including: `lat`, `lon`, `ele` (latitude, longitude, and elevation values), and `created_at` (a date/time string).
@ -655,8 +655,8 @@ Example for `group_feed_data` in the body is as follows: `{ feeds: [ { key: stri
> <div class="http"><span class="method-get">GET</span><code class="path">/api/v2/{username}/groups/{group_key}/feeds/{feed_key}/data</code></div>
```shell
# Get data from the given Feed in the given Group
$ curl -H "X-AIO-Key: {io_key}" https://io.adafruit.com/api/v2/{username}/groups/{group_key}/feeds/{feed_key}/data
# Send new data with a value of 42 to the group's feeds as json
$ curl -H "X-AIO-Key: {io_key}" https://io.adafruit.com/api/v2/{username}/groups/{group_key}/data.json -d '{"feeds":[{"key":"{feed_key}","value":42}]}'
```
```python
@ -724,7 +724,7 @@ feed_key | string | true | a valid feed key
Parameter | Type | Required | Description
--------- | ------- | --------- | -----------------------
<b>Request Body</b> | object | true | Data record (datum) including a `value` field (required) and optionally including: `lat`, `lon`, `ele` (latitude, longitude, and elevation values), and `created_at` (a date/time string).
datum | object | true | Data record including a `value` field (required) and optionally including: `lat`, `lon`, `ele` (latitude, longitude, and elevation values), and `created_at` (a date/time string).
@ -767,3 +767,4 @@ feed_key | string | true | a valid feed key
Parameter | Type | Required | Description
--------- | ------- | --------- | -----------------------
data | array | true | A collection of data records including `value` (required) and optionally including: `lat`, `lon`, `ele` (latitude, longitude, and elevation values), and `created_at` (a date/time string).

View file

@ -6,8 +6,6 @@ You will need to create one feed for each unique source of data you send to Adaf
You can create, read, update, or delete feeds. Every **CREATE**, **UPDATE**, or **DELETE** action on a feed record counts against your rate limit.
There are also endpoints for submitting multiple data points to a feed, or multiple feed values to a group, see **feeds/{feed_key}/batch** and **groups/{groupname}/data** endpoints.
## All Feeds
> HTTP Request

View file

@ -53,7 +53,6 @@ For example, if you are building a weather station, you would add feeds for `hum
You can create, read, update, or delete group records. Every **CREATE**, **UPDATE**, or **DELETE** action on a group record counts against your rate limit.
There is also an endpoint for submitting multiple feed values to a group, see the **groups/{groupname}/data** endpoint.
## Get All Groups