lifx_api 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +5 -1
- data/README.md +17 -16
- data/lib/lifx_api/endpoints.rb +3 -0
- data/lib/lifx_api/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: bfc68d8f7402d1601df1501e8c1e4651167b4ec3
|
4
|
+
data.tar.gz: 85e218c1af08c463dfc303baf55ed00ddeadbab0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 669bd924831b096444fb8ef7c7b6620776aecfec6fa2a4ed9c636b6598d44ce54b8231af3b540c69f068d390afcb156019a1ad4b0e67d8873b6c8efb90abe0c8
|
7
|
+
data.tar.gz: 3a0803ad3a792973ec00a0629d74f6bf93772a653ed22e7e44070d84a1151742b0bb288ca41ea2319e5a8a5d9e18571fef31e81a2fcb410bf90511de1d733bc1
|
data/CHANGELOG
CHANGED
data/README.md
CHANGED
@@ -48,7 +48,7 @@ See [LIFX HTTP API](https://api.developer.lifx.com/) for the official documentat
|
|
48
48
|
|
49
49
|
Key | Type | Mandatory | Default | Description
|
50
50
|
--- | --- | --- | --- | ---
|
51
|
-
`:selector` | selector | | all |
|
51
|
+
`:selector` | selector | | all | See [selector](https://api.developer.lifx.com/docs/selectors) documentation on the LIFX website
|
52
52
|
|
53
53
|
### set_state
|
54
54
|
|
@@ -56,7 +56,7 @@ Key | Type | Mandatory | Default | Description
|
|
56
56
|
|
57
57
|
Key | Type | Mandatory | Default | Description
|
58
58
|
--- | --- | --- | --- | ---
|
59
|
-
`:selector` | selector | | all |
|
59
|
+
`:selector` | selector | | all | See [selector](https://api.developer.lifx.com/docs/selectors) documentation on the LIFX website
|
60
60
|
`:power` | string | | | The power state you want to set on the selector. on or off
|
61
61
|
`:color` | string | | | The color to set the light to.
|
62
62
|
`:brightness` | numeric | | | The brightness level from 0.0 to 1.0. Overrides any brightness set in color (if any).
|
@@ -69,8 +69,8 @@ Key | Type | Mandatory | Default | Description
|
|
69
69
|
|
70
70
|
Key | Type | Mandatory | Default | Description
|
71
71
|
--- | --- | --- | --- | ---
|
72
|
-
`:states` | | ✔ | |
|
73
|
-
`:defaults` | hash | | |
|
72
|
+
`:states` | array of states | ✔ | | Array of state hashes as per `#set_state`. No more than 50 entries.
|
73
|
+
`:defaults` | hash | | | Default values to use when not specified in each `states[]` hash.
|
74
74
|
|
75
75
|
### stage_delta
|
76
76
|
|
@@ -78,8 +78,8 @@ Key | Type | Mandatory | Default | Description
|
|
78
78
|
|
79
79
|
Key | Type | Mandatory | Default | Description
|
80
80
|
--- | --- | --- | --- | ---
|
81
|
-
`:selector` | selector | | all |
|
82
|
-
`:power` |
|
81
|
+
`:selector` | selector | | all | See [selector](https://api.developer.lifx.com/docs/selectors) documentation on the LIFX website
|
82
|
+
`:power` | string | | | The power state you want to set on the selector. Must be "on" or "off".
|
83
83
|
`:duration` | numeric | | 1.0 | How long in seconds you want the power action to take. Range: 0.0 - 3155760000.0 (100 years)
|
84
84
|
`:infrared` | numeric | | | The maximum brightness of the infrared channel.
|
85
85
|
`:hue` | numeric | | | Rotate the hue by this angle in degrees.
|
@@ -93,7 +93,7 @@ Key | Type | Mandatory | Default | Description
|
|
93
93
|
|
94
94
|
Key | Type | Mandatory | Default | Description
|
95
95
|
--- | --- | --- | --- | ---
|
96
|
-
`:selector` | selector | | all |
|
96
|
+
`:selector` | selector | | all | See [selector](https://api.developer.lifx.com/docs/selectors) documentation on the LIFX website
|
97
97
|
`:duration` | numeric | | 1.0 | The time is seconds to spend perfoming the power toggle.
|
98
98
|
|
99
99
|
### breathe_effect
|
@@ -102,7 +102,7 @@ Key | Type | Mandatory | Default | Description
|
|
102
102
|
|
103
103
|
Key | Type | Mandatory | Default | Description
|
104
104
|
--- | --- | --- | --- | ---
|
105
|
-
`:selector` | selector | | all |
|
105
|
+
`:selector` | selector | | all | See [selector](https://api.developer.lifx.com/docs/selectors) documentation on the LIFX website
|
106
106
|
`:color` | string | ✔ | | The color to use for the breathe effect.
|
107
107
|
`:from_color` | string | | current bulb color | The color to start the effect from. If this parameter is omitted then the color the bulb is currently set to is used instead.
|
108
108
|
`:period` | numeric | | 1.0 | The time in seconds for one cyles of the effect.
|
@@ -117,7 +117,7 @@ Key | Type | Mandatory | Default | Description
|
|
117
117
|
|
118
118
|
Key | Type | Mandatory | Default | Description
|
119
119
|
--- | --- | --- | --- | ---
|
120
|
-
`:selector` | selector | | all |
|
120
|
+
`:selector` | selector | | all | See [selector](https://api.developer.lifx.com/docs/selectors) documentation on the LIFX website
|
121
121
|
`:color` | string | ✔ | | The color to use for the pulse effect.
|
122
122
|
`:from_color` | string | | current bulb color | The color to start the effect from. If this parameter is omitted then the color the bulb is currently set to is used instead.
|
123
123
|
`:period` | numeric | | 1.0 | The time in seconds for one cyles of the effect.
|
@@ -131,9 +131,10 @@ Key | Type | Mandatory | Default | Description
|
|
131
131
|
|
132
132
|
Key | Type | Mandatory | Default | Description
|
133
133
|
--- | --- | --- | --- | ---
|
134
|
-
`:
|
135
|
-
`:
|
136
|
-
`:
|
134
|
+
`:selector` | selector | | all | See [selector](https://api.developer.lifx.com/docs/selectors) documentation on the LIFX website
|
135
|
+
`:states` | array of states | ✔ | | Array of state hashes as per `#set_state`. Must have 2 to 5 entries.
|
136
|
+
`:defaults` | hash | | | Default values to use when not specified in each states[] object.
|
137
|
+
`:direction` | string | | | Direction in which to cycle through the list. Can be "forward" or "backward".
|
137
138
|
|
138
139
|
### list_scenes
|
139
140
|
|
@@ -148,7 +149,7 @@ Key | Type | Mandatory | Default | Description
|
|
148
149
|
`:scene_uuid` | uuid | ✔ | | The UUID for the scene you wish to activate
|
149
150
|
`:duration` | numeric | | 1.0 | The time in seconds to spend performing the scene transition.
|
150
151
|
`:ignore` | array of strings | | | Any of "power", "infrared", "duration", "intensity", "hue", "saturation", "brightness" or "kelvin", specifying that these properties should not be changed on devices when applying the scene.
|
151
|
-
`:overrides` |
|
152
|
+
`:overrides` | hash | | | A state object as per Set State specifying properties to apply to all devices in the scene, overriding those configured in the scene.
|
152
153
|
|
153
154
|
### validate_color
|
154
155
|
|
@@ -156,11 +157,11 @@ Key | Type | Mandatory | Default | Description
|
|
156
157
|
|
157
158
|
Key | Type | Mandatory | Default | Description
|
158
159
|
--- | --- | --- | --- | ---
|
159
|
-
`:color` | string | ✔ | |
|
160
|
+
`:color` | string | ✔ | | Color string you'd like to validate
|
160
161
|
|
161
162
|
## Deviation from the API spec
|
162
163
|
|
163
|
-
Some API endpoints require a mandatory [`selector`](https://api.developer.lifx.com/docs/selectors) parameter, which defines which bulbs to apply your action to. This client will default the `selector` parameter to `'all
|
164
|
+
Some API endpoints require a mandatory [`selector`](https://api.developer.lifx.com/docs/selectors) parameter, which defines which bulbs to apply your action to. This client will default the `selector` parameter to `'all'`, if no selector is provided.
|
164
165
|
|
165
166
|
```ruby
|
166
167
|
# which means that you can call
|
@@ -181,7 +182,7 @@ Run `rake test` to run the tests and `rake console` to start an interactive pry
|
|
181
182
|
|
182
183
|
## TODO
|
183
184
|
|
184
|
-
* Validation of `:state
|
185
|
+
* Validation of `:state` and `:array_of_states` is poor
|
185
186
|
* Validation of endpoints is non-existent
|
186
187
|
|
187
188
|
## Contributing
|
data/lib/lifx_api/endpoints.rb
CHANGED
@@ -89,6 +89,9 @@ class LifxApi
|
|
89
89
|
method_name: :cycle,
|
90
90
|
http_method: :post,
|
91
91
|
path: '/v1/lights/%{selector}/cycle',
|
92
|
+
path_params: {
|
93
|
+
selector: {required: true, type: :selector, default: 'all'},
|
94
|
+
},
|
92
95
|
body_params: {
|
93
96
|
states: {required: true, type: :array_of_states, description: 'Array of state hashes as per Set State. Must have 2 to 5 entries.'},
|
94
97
|
defaults: {type: :state, description: 'Default values to use when not specified in each states[] object.'},
|
data/lib/lifx_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lifx_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- cyclotron3k
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|