adafruit-io 2.0.0.beta.6 → 2.0.0.beta.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -0
- data/lib/adafruit/io/client/blocks.rb +39 -7
- data/lib/adafruit/io/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4e361c9a85392c933fe7c35fda6bfd98f6f80cd
|
4
|
+
data.tar.gz: 9a68f813bfff5fedee4511bb6fcd7b940ebfb1e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 730d7000307a9569797d6904f7fa5fba72e7cf6ec507b753fdad266584b1fed8bfdfbe29ae569f2d8b00fe129cf42f93687d1d202816a2944f457121a94f65a2
|
7
|
+
data.tar.gz: a61eb95bc77ff2aaab6d5893f9d16779e4d60acf1ab9612ba186e395bb73ab93c2e98af86f2f4fcbe518a44fa5f44c863ca12ac2fa3ed8a64ffd99a81ff2d75b
|
data/README.md
CHANGED
@@ -33,6 +33,19 @@ It is our goal to eventually support all API V2 methods, but that will happen in
|
|
33
33
|
- [x] Permissions `2.0.0.beta.5`
|
34
34
|
- [x] Triggers `2.0.0.beta.6`
|
35
35
|
|
36
|
+
Still needing complete tests:
|
37
|
+
|
38
|
+
- [x] Feeds
|
39
|
+
- [x] Data
|
40
|
+
- [x] Tokens
|
41
|
+
- [x] Blocks
|
42
|
+
- [ ] Dashboards *has pending*
|
43
|
+
- [ ] Groups *has pending*
|
44
|
+
- [ ] Activities
|
45
|
+
- [ ] Permissions
|
46
|
+
- [ ] Triggers
|
47
|
+
- [ ] MQTT
|
48
|
+
|
36
49
|
## Installation
|
37
50
|
|
38
51
|
Add this line to your application's Gemfile:
|
@@ -15,37 +15,69 @@ module Adafruit
|
|
15
15
|
def block(*args)
|
16
16
|
username, arguments = extract_username(args)
|
17
17
|
dashboard_key = require_argument(arguments, :dashboard_key)
|
18
|
-
block_id =
|
18
|
+
block_id = get_key_from_arguments(arguments)
|
19
19
|
|
20
20
|
get api_url(username, 'dashboards', dashboard_key, 'blocks', block_id)
|
21
21
|
end
|
22
22
|
|
23
|
+
# Create a block
|
23
24
|
def create_block(*args)
|
24
25
|
username, arguments = extract_username(args)
|
25
26
|
dashboard_key = require_argument(arguments, :dashboard_key)
|
26
|
-
block_attrs = arguments
|
27
|
+
block_attrs = valid_block_attrs(arguments)
|
27
28
|
|
28
|
-
post api_url(username, '
|
29
|
+
post api_url(username, 'dashboards', dashboard_key, 'blocks'), block_attrs
|
29
30
|
end
|
30
31
|
|
32
|
+
# Delete a block
|
31
33
|
def delete_block(*args)
|
32
34
|
username, arguments = extract_username(args)
|
33
35
|
dashboard_key = require_argument(arguments, :dashboard_key)
|
34
|
-
block_id =
|
36
|
+
block_id = get_key_from_arguments(arguments)
|
35
37
|
|
36
38
|
delete api_url(username, 'dashboards', dashboard_key, 'blocks', block_id)
|
37
39
|
end
|
38
40
|
|
41
|
+
# Update a block
|
39
42
|
def update_block(*args)
|
40
43
|
username, arguments = extract_username(args)
|
41
44
|
dashboard_key = require_argument(arguments, :dashboard_key)
|
42
|
-
block_id =
|
45
|
+
block_id = get_key_from_arguments(arguments)
|
46
|
+
block_attrs = valid_block_attrs(arguments)
|
43
47
|
|
44
|
-
|
48
|
+
put api_url(username, 'dashboards', dashboard_key, 'blocks', block_id), block_attrs
|
49
|
+
end
|
50
|
+
|
51
|
+
# The list of every valid property name that can be stored by Adafruit IO.
|
52
|
+
#
|
53
|
+
# Not every property applies to every block. Boolean values should be
|
54
|
+
# stored as the string "yes" or "no".
|
55
|
+
def valid_block_properties
|
56
|
+
%w(
|
57
|
+
text value release fontSize onText offText backgroundColor onColor
|
58
|
+
offColor min max step label orientation handle minValue maxValue
|
59
|
+
ringWidth label xAxisLabel yAxisLabel yAxisMin yAxisMax tile
|
60
|
+
fontColor showName showTimestamp errors historyHours showNumbers
|
61
|
+
showLocation
|
62
|
+
)
|
63
|
+
end
|
45
64
|
|
46
|
-
|
65
|
+
# The list of every valid block type that can be presented by Adafruit IO.
|
66
|
+
def valid_block_visual_types
|
67
|
+
%w(
|
68
|
+
toggle_button slider momentary_button gauge line_chart text
|
69
|
+
color_picker map stream image remote_control
|
70
|
+
)
|
47
71
|
end
|
48
72
|
|
73
|
+
private
|
74
|
+
|
75
|
+
def valid_block_attrs(arguments)
|
76
|
+
get_query_from_arguments(
|
77
|
+
arguments,
|
78
|
+
%w(name properties visual_type column row size_x size_y block_feeds)
|
79
|
+
)
|
80
|
+
end
|
49
81
|
end
|
50
82
|
end
|
51
83
|
end
|
data/lib/adafruit/io/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adafruit-io
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.beta.
|
4
|
+
version: 2.0.0.beta.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Cooper
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2018-04-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|