lifx_api 0.1.3 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: bfc68d8f7402d1601df1501e8c1e4651167b4ec3
4
- data.tar.gz: 85e218c1af08c463dfc303baf55ed00ddeadbab0
2
+ SHA256:
3
+ metadata.gz: 0dcc8bfc7bb623baf95b44cdd9e822aeefcf1e2fae6f6204d1e5e6875030b9a3
4
+ data.tar.gz: 8e326e904ed90c4ef575f3a722a426cd3569f9371f09d505c00a0e46bdc8728e
5
5
  SHA512:
6
- metadata.gz: 669bd924831b096444fb8ef7c7b6620776aecfec6fa2a4ed9c636b6598d44ce54b8231af3b540c69f068d390afcb156019a1ad4b0e67d8873b6c8efb90abe0c8
7
- data.tar.gz: 3a0803ad3a792973ec00a0629d74f6bf93772a653ed22e7e44070d84a1151742b0bb288ca41ea2319e5a8a5d9e18571fef31e81a2fcb410bf90511de1d733bc1
6
+ metadata.gz: a6b3657d033c9e8845fd088d985406037eb78b96881317a1f2d9d7e356d91039a5ebbb2b0389762fb7f9d5932b3acd229116952c52e5b28b30b60fa4689c9b0d
7
+ data.tar.gz: b46765d79a097ad2162abe4ccdfbd2a15ce71d34e8df3130c957e03a5c360c7eb2705a8c1c2c742dccc407faad24719099e5c10ac7c0eb6c6e8be7bb4add3480
@@ -0,0 +1,10 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.5
6
+ - 2.6
7
+ - 2.7
8
+ - jruby
9
+ script:
10
+ - bundle exec rake test
data/CHANGELOG CHANGED
@@ -1,3 +1,12 @@
1
+ === 0.2.0
2
+
3
+ * Add `fast` parameter to `LifxApi#set_state` and `LifxApi#set_states`
4
+ * Add `LifxApi#state_delta`, and deprecate `LifxApi#stage_delta`
5
+ * Add `LifxApi#move_effect`
6
+ * Add `LifxApi#morph_effect`
7
+ * Add `LifxApi#flame_effect`
8
+ * Add `LifxApi#effects_off`
9
+
1
10
  === 0.1.3
2
11
 
3
12
  * Fix documentation and specification of `cycle` endpoint
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # LifxApi
1
+ # LifxApi [![Build Status](https://travis-ci.org/cyclotron3k/lifx_api.svg?branch=master)](https://travis-ci.org/cyclotron3k/lifx_api)
2
2
 
3
3
  A Ruby client for the LIFX API.
4
4
 
@@ -57,11 +57,12 @@ Key | Type | Mandatory | Default | Description
57
57
  Key | Type | Mandatory | Default | Description
58
58
  --- | --- | --- | --- | ---
59
59
  `:selector` | selector | | all | See [selector](https://api.developer.lifx.com/docs/selectors) documentation on the LIFX website
60
- `:power` | string | | | The power state you want to set on the selector. on or off
61
- `:color` | string | | | The color to set the light to.
60
+ `:power` | string | | | The power state you want to set on the selector. Must be `on` or `off`.
61
+ `:color` | color | | | 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).
63
63
  `:duration` | numeric | | 1.0 | How long in seconds you want the power action to take. Range: 0.0 - 3155760000.0 (100 years)
64
- `:infrared` | numeric | | | The maximum brightness of the infrared channel.
64
+ `:infrared` | numeric | | | The maximum brightness of the infrared channel from `0.0` to `1.0`.
65
+ `:fast` | boolean | | false | Execute the query fast, without initial state checks and wait for no results.
65
66
 
66
67
  ### set_states
67
68
 
@@ -69,23 +70,40 @@ Key | Type | Mandatory | Default | Description
69
70
 
70
71
  Key | Type | Mandatory | Default | Description
71
72
  --- | --- | --- | --- | ---
72
- `:states` | array of states | ✔ | | Array of state hashes as per `#set_state`. No more than 50 entries.
73
+ `:states` | array of hashes | ✔ | | Array of state hashes as per `#set_state`. No more than 50 entries.
73
74
  `:defaults` | hash | | | Default values to use when not specified in each `states[]` hash.
75
+ `:fast` | boolean | | false | Execute the query fast, without initial state checks and wait for no results.
76
+
77
+ ### state_delta
78
+
79
+ #### Parameters
80
+
81
+ Key | Type | Mandatory | Default | Description
82
+ --- | --- | --- | --- | ---
83
+ `:selector` | selector | | all | See [selector](https://api.developer.lifx.com/docs/selectors) documentation on the LIFX website
84
+ `:power` | string | | | The power state you want to set on the selector. Must be `on` or `off`.
85
+ `:duration` | numeric | | 1.0 | How long in seconds you want the power action to take. Range: `0.0` - `3155760000.0` (100 years)
86
+ `:infrared` | numeric | | | The maximum brightness of the infrared channel.
87
+ `:hue` | numeric | | | Rotate the hue by this angle in degrees. Range: `-360.0` - `360.0` degrees.
88
+ `:saturation` | numeric | | | Change the saturation by this additive amount; the resulting saturation is clipped to `[0, 1]`.
89
+ `:brightness` | numeric | | | Change the brightness by this additive amount; the resulting brightness is clipped to `[0, 1]`.
90
+ `:kelvin` | numeric | | | Change the kelvin by this additive amount; the resulting kelvin is clipped to `[2500, 9000]`.
74
91
 
75
92
  ### stage_delta
93
+ [DEPRECATED] `#stage_delta` is deprecated, please use `#state_delta` instead
76
94
 
77
95
  #### Parameters
78
96
 
79
97
  Key | Type | Mandatory | Default | Description
80
98
  --- | --- | --- | --- | ---
81
99
  `: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
- `:duration` | numeric | | 1.0 | How long in seconds you want the power action to take. Range: 0.0 - 3155760000.0 (100 years)
100
+ `:power` | string | | | The power state you want to set on the selector. Must be `on` or `off`.
101
+ `:duration` | numeric | | 1.0 | How long in seconds you want the power action to take. Range: `0.0` - `3155760000.0` (100 years)
84
102
  `:infrared` | numeric | | | The maximum brightness of the infrared channel.
85
- `:hue` | numeric | | | Rotate the hue by this angle in degrees.
86
- `:saturation` | numeric | | | Change the saturation by this additive amount; the resulting saturation is clipped to [0, 1].
87
- `:brightness` | numeric | | | Change the brightness by this additive amount; the resulting brightness is clipped to [0, 1].
88
- `:kelvin` | numeric | | | Change the kelvin by this additive amount; the resulting kelvin is clipped to [2500, 9000].
103
+ `:hue` | numeric | | | Rotate the hue by this angle in degrees. Range: `-360.0` - `360.0` degrees.
104
+ `:saturation` | numeric | | | Change the saturation by this additive amount; the resulting saturation is clipped to `[0, 1]`.
105
+ `:brightness` | numeric | | | Change the brightness by this additive amount; the resulting brightness is clipped to `[0, 1]`.
106
+ `:kelvin` | numeric | | | Change the kelvin by this additive amount; the resulting kelvin is clipped to `[2500, 9000]`.
89
107
 
90
108
  ### toggle_power
91
109
 
@@ -103,13 +121,48 @@ Key | Type | Mandatory | Default | Description
103
121
  Key | Type | Mandatory | Default | Description
104
122
  --- | --- | --- | --- | ---
105
123
  `:selector` | selector | | all | See [selector](https://api.developer.lifx.com/docs/selectors) documentation on the LIFX website
106
- `:color` | string | ✔ | | The color to use for the breathe effect.
124
+ `:color` | color | ✔ | | The color to use for the breathe effect.
107
125
  `: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
126
  `:period` | numeric | | 1.0 | The time in seconds for one cyles of the effect.
109
127
  `:cycles` | numeric | | 1.0 | The number of times to repeat the effect.
110
- `:persist` | boolean | | false | If false set the light back to its previous value when effect ends, if true leave the last effect color.
111
- `:power_on` | boolean | | true | If true, turn the bulb on if it is not already on.
112
- `:peak` | numeric | | 0.5 | Defines where in a period the target color is at its maximum. Minimum 0.0, maximum 1.0.
128
+ `:persist` | boolean | | false | If `false` set the light back to its previous value when effect ends, if true leave the last effect color.
129
+ `:power_on` | boolean | | true | If `true`, turn the bulb on if it is not already on.
130
+ `:peak` | numeric | | 0.5 | Defines where in a period the target color is at its maximum. Minimum `0.0`, maximum `1.0`.
131
+
132
+ ### move_effect
133
+
134
+ #### Parameters
135
+
136
+ Key | Type | Mandatory | Default | Description
137
+ --- | --- | --- | --- | ---
138
+ `:selector` | selector | | all | See [selector](https://api.developer.lifx.com/docs/selectors) documentation on the LIFX website
139
+ `:direction` | string | | forward | Move direction, can be `forward` or `backward`.
140
+ `:period` | numeric | | 1.0 | The time in seconds for one cyles of the effect.
141
+ `:cycles` | numeric | | infinite | The number of times to move the pattern across the device. Special cases are `0` to switch the effect off, and unspecified to continue indefinitely.
142
+ `:power_on` | boolean | | true | Switch any selected device that is off to on before performing the effect.
143
+
144
+ ### morph_effect
145
+
146
+ #### Parameters
147
+
148
+ Key | Type | Mandatory | Default | Description
149
+ --- | --- | --- | --- | ---
150
+ `:selector` | selector | | all | See [selector](https://api.developer.lifx.com/docs/selectors) documentation on the LIFX website
151
+ `:period` | numeric | | 5.0 | This controls how quickly the morph runs. It is measured in seconds. A lower number means the animation is faster.
152
+ `:duration` | numeric | | infinite | How long the animation lasts for in seconds. Not specifying a duration makes the animation never stop. Specifying `0` makes the animation stop. Note that there is a known bug where the tile remains in the animation once it has completed if duration is nonzero.
153
+ `:palette` | array of colors | | 7 colours across the spectrum | You can control the colors in the animation by specifying a list of color specifiers. For example `["red", "hue:100 saturation:1"]`.
154
+ `:power_on` | boolean | | true | Switch any selected device that is off to on before performing the effect.
155
+
156
+ ### flame_effect
157
+
158
+ #### Parameters
159
+
160
+ Key | Type | Mandatory | Default | Description
161
+ --- | --- | --- | --- | ---
162
+ `:selector` | selector | | all | See [selector](https://api.developer.lifx.com/docs/selectors) documentation on the LIFX website
163
+ `:period` | numeric | | 5.0 | This controls how quickly the flame runs. It is measured in seconds. A lower number means the animation is faster.
164
+ `:duration` | numeric | | infinite | How long the animation lasts for in seconds. Not specifying a duration makes the animation never stop. Specifying `0` makes the animation stop. Note that there is a known bug where the tile remains in the animation once it has completed if duration is nonzero.
165
+ `:power_on` | boolean | | true | Switch any selected device that is off to on before performing the effect.
113
166
 
114
167
  ### pulse_effect
115
168
 
@@ -122,8 +175,17 @@ Key | Type | Mandatory | Default | Description
122
175
  `: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
176
  `:period` | numeric | | 1.0 | The time in seconds for one cyles of the effect.
124
177
  `:cycles` | numeric | | 1.0 | The number of times to repeat the effect.
125
- `:persist` | boolean | | false | If false set the light back to its previous value when effect ends, if true leave the last effect color.
126
- `:power_on` | boolean | | true | If true, turn the bulb on if it is not already on.
178
+ `:persist` | boolean | | false | If `false` set the light back to its previous value when effect ends, if true leave the last effect color.
179
+ `:power_on` | boolean | | true | If `true`, turn the bulb on if it is not already on.
180
+
181
+ ### effects_off
182
+
183
+ #### Parameters
184
+
185
+ Key | Type | Mandatory | Default | Description
186
+ --- | --- | --- | --- | ---
187
+ `:selector` | selector | | all | See [selector](https://api.developer.lifx.com/docs/selectors) documentation on the LIFX website
188
+ `:power_off` | boolean | | false | If `true`, the devices will also be turned off.
127
189
 
128
190
  ### cycle
129
191
 
@@ -132,9 +194,9 @@ Key | Type | Mandatory | Default | Description
132
194
  Key | Type | Mandatory | Default | Description
133
195
  --- | --- | --- | --- | ---
134
196
  `: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".
197
+ `:states` | array of hashes | ✔ | | Array of state hashes as per `#set_state`. Must have 2 to 5 entries.
198
+ `:defaults` | hash | | | Default values to use when not specified in each `states[]` object.
199
+ `:direction` | direction | | forward | Direction in which to cycle through the list. Can be `forward` or `backward`.
138
200
 
139
201
  ### list_scenes
140
202
 
@@ -148,8 +210,8 @@ Key | Type | Mandatory | Default | Description
148
210
  --- | --- | --- | --- | ---
149
211
  `:scene_uuid` | uuid | ✔ | | The UUID for the scene you wish to activate
150
212
  `:duration` | numeric | | 1.0 | The time in seconds to spend performing the scene transition.
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.
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.
213
+ `: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.
214
+ `:overrides` | hash | | | A state hash as per `#set_state` specifying properties to apply to all devices in the scene, overriding those configured in the scene.
153
215
 
154
216
  ### validate_color
155
217
 
@@ -157,7 +219,8 @@ Key | Type | Mandatory | Default | Description
157
219
 
158
220
  Key | Type | Mandatory | Default | Description
159
221
  --- | --- | --- | --- | ---
160
- `:color` | string | ✔ | | Color string you'd like to validate
222
+ `:color` | color | ✔ | | Color string you'd like to validate
223
+
161
224
 
162
225
  ## Deviation from the API spec
163
226
 
@@ -174,7 +237,7 @@ client.list_bulbs selector: 'all'
174
237
 
175
238
  ## Exceptions
176
239
 
177
- If there is an error, LifxApi will raise an exception. The exception message will usually give a good indication of what went wrong, but you can also rescue the exception and access the request, response and decoded JSON objects, via the `request`, `response` and `data` methods.
240
+ If there is an error, `LifxApi` will raise an exception. The exception message will usually give a good indication of what went wrong, but you can also rescue the exception and access the request, response and decoded JSON objects, via the `request`, `response` and `data` methods.
178
241
 
179
242
  ## Development
180
243
 
@@ -183,6 +246,7 @@ Run `rake test` to run the tests and `rake console` to start an interactive pry
183
246
  ## TODO
184
247
 
185
248
  * Validation of `:state` and `:array_of_states` is poor
249
+ * Validation of `:color` and `:array_of_colors` is poor
186
250
  * Validation of endpoints is non-existent
187
251
 
188
252
  ## Contributing
@@ -24,6 +24,9 @@ class LifxApi
24
24
 
25
25
  ENDPOINTS.each do |endpoint_spec|
26
26
  define_method endpoint_spec[:method_name], Proc.new { |params={}|
27
+ if endpoint_spec[:deprecation_message]
28
+ warn "[DEPRECATED] #{endpoint_spec[:deprecation_message]}"
29
+ end
27
30
  parsed_params = parse_params endpoint_spec, params
28
31
  request = create_request endpoint_spec, parsed_params
29
32
  process_request request
@@ -70,6 +73,8 @@ class LifxApi
70
73
  value.is_a?(String) and ['forward', 'backward'].include? value
71
74
  when :array_of_states
72
75
  value.is_a?(Array) and value.count <= 50 and value.all? { |state| valid? state, :state }
76
+ when :array_of_colors
77
+ value.is_a?(Array) and value.all? { |state| valid? state, :color }
73
78
  when :state
74
79
  value.is_a?(Hash) and (value.keys - [:selector, :power, :color, :brightness, :duration, :infrared]).empty? and value.all? { |k, v| valid? v, k }
75
80
  else
@@ -14,36 +14,55 @@ class LifxApi
14
14
  selector: {required: true, type: :selector, default: 'all'},
15
15
  },
16
16
  body_params: {
17
- power: {type: :string, description: 'The power state you want to set on the selector. on or off'},
18
- color: {type: :string, description: 'The color to set the light to.'},
17
+ power: {type: :string, description: 'The power state you want to set on the selector. Must be `on` or `off`.'},
18
+ color: {type: :color, description: 'The color to set the light to.'},
19
19
  brightness: {type: :numeric, description: 'The brightness level from 0.0 to 1.0. Overrides any brightness set in color (if any).'},
20
20
  duration: {type: :numeric, default_description: '1.0', description: 'How long in seconds you want the power action to take. Range: 0.0 - 3155760000.0 (100 years)'},
21
- infrared: {type: :numeric, description: 'The maximum brightness of the infrared channel.'},
21
+ infrared: {type: :numeric, description: 'The maximum brightness of the infrared channel from `0.0` to `1.0`.'},
22
+ fast: {type: :boolean, default_description: 'false', description: 'Execute the query fast, without initial state checks and wait for no results.'},
22
23
  },
23
24
  }, {
24
25
  method_name: :set_states,
25
26
  http_method: :put,
26
27
  path: '/v1/lights/states',
27
28
  body_params: {
28
- states: {required: true, type: :array_of_states},
29
- defaults: {type: :hash},
29
+ states: {required: true, type: :array_of_states, description: 'Array of state hashes as per `#set_state`. No more than 50 entries.'},
30
+ defaults: {type: :hash, description: 'Default values to use when not specified in each `states[]` hash.'},
31
+ fast: {type: :boolean, default_description: 'false', description: 'Execute the query fast, without initial state checks and wait for no results.'},
30
32
  },
31
33
  }, {
32
- method_name: :stage_delta,
34
+ method_name: :state_delta,
33
35
  http_method: :post,
34
36
  path: '/v1/lights/%{selector}/state/delta',
35
37
  path_params: {
36
38
  selector: {required: true, type: :selector, default: 'all'}
37
39
  },
38
40
  body_params: {
39
- power: {type: :on_off, description: 'The power state you want to set on the selector. on or off'},
40
- duration: {type: :numeric, default_description: '1.0', description: 'How long in seconds you want the power action to take. Range: 0.0 - 3155760000.0 (100 years)'},
41
+ power: {type: :on_off, description: 'The power state you want to set on the selector. Must be `on` or `off`.'},
42
+ duration: {type: :numeric, default_description: '1.0', description: 'How long in seconds you want the power action to take. Range: `0.0` - `3155760000.0` (100 years)'},
41
43
  infrared: {type: :numeric, description: 'The maximum brightness of the infrared channel.'},
42
- hue: {type: :numeric, description: 'Rotate the hue by this angle in degrees.'},
43
- saturation: {type: :numeric, description: 'Change the saturation by this additive amount; the resulting saturation is clipped to [0, 1].'},
44
- brightness: {type: :numeric, description: 'Change the brightness by this additive amount; the resulting brightness is clipped to [0, 1].'},
45
- kelvin: {type: :numeric, description: 'Change the kelvin by this additive amount; the resulting kelvin is clipped to [2500, 9000].'},
44
+ hue: {type: :numeric, description: 'Rotate the hue by this angle in degrees. Range: `-360.0` - `360.0` degrees.'},
45
+ saturation: {type: :numeric, description: 'Change the saturation by this additive amount; the resulting saturation is clipped to `[0, 1]`.'},
46
+ brightness: {type: :numeric, description: 'Change the brightness by this additive amount; the resulting brightness is clipped to `[0, 1]`.'},
47
+ kelvin: {type: :numeric, description: 'Change the kelvin by this additive amount; the resulting kelvin is clipped to `[2500, 9000]`.'},
48
+ }
49
+ }, {
50
+ method_name: :stage_delta,
51
+ deprecation_message: '`#stage_delta` is deprecated, please use `#state_delta` instead',
52
+ http_method: :post,
53
+ path: '/v1/lights/%{selector}/state/delta',
54
+ path_params: {
55
+ selector: {required: true, type: :selector, default: 'all'}
46
56
  },
57
+ body_params: {
58
+ power: {type: :on_off, description: 'The power state you want to set on the selector. Must be `on` or `off`.'},
59
+ duration: {type: :numeric, default_description: '1.0', description: 'How long in seconds you want the power action to take. Range: `0.0` - `3155760000.0` (100 years)'},
60
+ infrared: {type: :numeric, description: 'The maximum brightness of the infrared channel.'},
61
+ hue: {type: :numeric, description: 'Rotate the hue by this angle in degrees. Range: `-360.0` - `360.0` degrees.'},
62
+ saturation: {type: :numeric, description: 'Change the saturation by this additive amount; the resulting saturation is clipped to `[0, 1]`.'},
63
+ brightness: {type: :numeric, description: 'Change the brightness by this additive amount; the resulting brightness is clipped to `[0, 1]`.'},
64
+ kelvin: {type: :numeric, description: 'Change the kelvin by this additive amount; the resulting kelvin is clipped to `[2500, 9000]`.'},
65
+ }
47
66
  }, {
48
67
  method_name: :toggle_power,
49
68
  http_method: :post,
@@ -52,7 +71,7 @@ class LifxApi
52
71
  selector: {required: true, type: :selector, default: 'all'},
53
72
  },
54
73
  body_params: {
55
- duration: {type: :numeric, default_description: '1.0', description: 'The time is seconds to spend perfoming the power toggle.'},
74
+ duration: {type: :numeric, default_description: '1.0', description: 'The time is seconds to spend perfoming the power toggle.'},
56
75
  },
57
76
  }, {
58
77
  method_name: :breathe_effect,
@@ -62,13 +81,51 @@ class LifxApi
62
81
  selector: {required: true, type: :selector, default: 'all'},
63
82
  },
64
83
  body_params: {
65
- color: {required: :true, type: :string, description: 'The color to use for the breathe effect.'},
84
+ color: {required: :true, type: :color, description: 'The color to use for the breathe effect.'},
66
85
  from_color: {type: :string, default_description: 'current bulb color', description: 'The color to start the effect from. If this parameter is omitted then the color the bulb is currently set to is used instead.'},
67
86
  period: {type: :numeric, default_description: '1.0', description: 'The time in seconds for one cyles of the effect.'},
68
87
  cycles: {type: :numeric, default_description: '1.0', description: 'The number of times to repeat the effect.'},
69
- persist: {type: :boolean, default_description: 'false', description: 'If false set the light back to its previous value when effect ends, if true leave the last effect color.'},
70
- power_on: {type: :boolean, default_description: 'true', description: 'If true, turn the bulb on if it is not already on.'},
71
- peak: {type: :numeric, default_description: '0.5', description: 'Defines where in a period the target color is at its maximum. Minimum 0.0, maximum 1.0.'},
88
+ persist: {type: :boolean, default_description: 'false', description: 'If `false` set the light back to its previous value when effect ends, if true leave the last effect color.'},
89
+ power_on: {type: :boolean, default_description: 'true', description: 'If `true`, turn the bulb on if it is not already on.'},
90
+ peak: {type: :numeric, default_description: '0.5', description: 'Defines where in a period the target color is at its maximum. Minimum `0.0`, maximum `1.0`.'},
91
+ }
92
+ }, {
93
+ method_name: :move_effect,
94
+ http_method: :post,
95
+ path: '/v1/lights/%{selector}/effects/move',
96
+ path_params: {
97
+ selector: {required: true, type: :selector, default: 'all'},
98
+ },
99
+ body_params: {
100
+ direction: {type: :string, default_description: 'forward', description: 'Move direction, can be `forward` or `backward`.'},
101
+ period: {type: :numeric, default_description: '1.0', description: 'The time in seconds for one cyles of the effect.'},
102
+ cycles: {type: :numeric, default_description: 'infinite', description: 'The number of times to move the pattern across the device. Special cases are `0` to switch the effect off, and unspecified to continue indefinitely.'},
103
+ power_on: {type: :boolean, default_description: 'true', description: 'Switch any selected device that is off to on before performing the effect.'},
104
+ }
105
+ }, {
106
+ method_name: :morph_effect,
107
+ http_method: :post,
108
+ path: '/v1/lights/%{selector}/effects/morph',
109
+ path_params: {
110
+ selector: {required: true, type: :selector, default: 'all'},
111
+ },
112
+ body_params: {
113
+ period: {type: :numeric, default_description: '5.0', description: 'This controls how quickly the morph runs. It is measured in seconds. A lower number means the animation is faster.'},
114
+ duration: {type: :numeric, default_description: 'infinite', description: 'How long the animation lasts for in seconds. Not specifying a duration makes the animation never stop. Specifying `0` makes the animation stop. Note that there is a known bug where the tile remains in the animation once it has completed if duration is nonzero.'},
115
+ palette: {type: :array_of_colors, default_description: '7 colours across the spectrum', description: 'You can control the colors in the animation by specifying a list of color specifiers. For example `["red", "hue:100 saturation:1"]`.'},
116
+ power_on: {type: :boolean, default_description: 'true', description: 'Switch any selected device that is off to on before performing the effect.'},
117
+ }
118
+ }, {
119
+ method_name: :flame_effect,
120
+ http_method: :post,
121
+ path: '/v1/lights/%{selector}/effects/flame',
122
+ path_params: {
123
+ selector: {required: true, type: :selector, default: 'all'},
124
+ },
125
+ body_params: {
126
+ period: {type: :numeric, default_description: '5.0', description: 'This controls how quickly the flame runs. It is measured in seconds. A lower number means the animation is faster.'},
127
+ duration: {type: :numeric, default_description: 'infinite', description: 'How long the animation lasts for in seconds. Not specifying a duration makes the animation never stop. Specifying `0` makes the animation stop. Note that there is a known bug where the tile remains in the animation once it has completed if duration is nonzero.'},
128
+ power_on: {type: :boolean, default_description: 'true', description: 'Switch any selected device that is off to on before performing the effect.'},
72
129
  }
73
130
  }, {
74
131
  method_name: :pulse_effect,
@@ -82,8 +139,18 @@ class LifxApi
82
139
  from_color: {type: :string, default_description: 'current bulb color', description: 'The color to start the effect from. If this parameter is omitted then the color the bulb is currently set to is used instead.'},
83
140
  period: {type: :numeric, default_description: '1.0', description: 'The time in seconds for one cyles of the effect.'},
84
141
  cycles: {type: :numeric, default_description: '1.0', description: 'The number of times to repeat the effect.'},
85
- persist: {type: :boolean, default_description: 'false', description: 'If false set the light back to its previous value when effect ends, if true leave the last effect color.'},
86
- power_on: {type: :boolean, default_description: 'true', description: 'If true, turn the bulb on if it is not already on.'},
142
+ persist: {type: :boolean, default_description: 'false', description: 'If `false` set the light back to its previous value when effect ends, if true leave the last effect color.'},
143
+ power_on: {type: :boolean, default_description: 'true', description: 'If `true`, turn the bulb on if it is not already on.'},
144
+ }
145
+ }, {
146
+ method_name: :effects_off,
147
+ http_method: :post,
148
+ path: '/v1/lights/%{selector}/effects/off',
149
+ path_params: {
150
+ selector: {required: true, type: :selector, default: 'all'},
151
+ },
152
+ body_params: {
153
+ power_off: {type: :boolean, default_description: 'false', description: 'If `true`, the devices will also be turned off.'},
87
154
  }
88
155
  }, {
89
156
  method_name: :cycle,
@@ -93,9 +160,9 @@ class LifxApi
93
160
  selector: {required: true, type: :selector, default: 'all'},
94
161
  },
95
162
  body_params: {
96
- states: {required: true, type: :array_of_states, description: 'Array of state hashes as per Set State. Must have 2 to 5 entries.'},
97
- defaults: {type: :state, description: 'Default values to use when not specified in each states[] object.'},
98
- direction: {type: :direction, description: 'Direction in which to cycle through the list. Can be forward or backward'},
163
+ states: {required: true, type: :array_of_states, description: 'Array of state hashes as per `#set_state`. Must have 2 to 5 entries.'},
164
+ defaults: {type: :state, description: 'Default values to use when not specified in each `states[]` object.'},
165
+ direction: {type: :direction, default_description: 'forward', description: 'Direction in which to cycle through the list. Can be `forward` or `backward`.'},
99
166
  }
100
167
  }, {
101
168
  method_name: :list_scenes,
@@ -110,15 +177,15 @@ class LifxApi
110
177
  },
111
178
  body_params: {
112
179
  duration: {type: :numeric, default_description: '1.0', description: 'The time in seconds to spend performing the scene transition.'},
113
- ignore: {type: :ignore_array, description: '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.'},
114
- overrides: {type: :state, description: 'A state object as per Set State specifying properties to apply to all devices in the scene, overriding those configured in the scene.'},
180
+ ignore: {type: :ignore_array, description: '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.'},
181
+ overrides: {type: :state, description: 'A state hash as per `#set_state` specifying properties to apply to all devices in the scene, overriding those configured in the scene.'},
115
182
  }
116
183
  }, {
117
184
  method_name: :validate_color,
118
185
  http_method: :put,
119
186
  path: '/v1/color',
120
187
  query_params: {
121
- color: {type: :string, required: true},
122
- },
188
+ color: {type: :color, required: true, description: 'Color string you\'d like to validate'},
189
+ }
123
190
  }]
124
191
  end
@@ -1,3 +1,3 @@
1
1
  class LifxApi
2
- VERSION = '0.1.3'
2
+ VERSION = '0.2.0'
3
3
  end
@@ -18,8 +18,7 @@ Gem::Specification.new do |spec|
18
18
 
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_development_dependency "bundler", "~> 1.15"
22
- spec.add_development_dependency "rake", "~> 10.0"
23
21
  spec.add_development_dependency "minitest", "~> 5.0"
24
22
  spec.add_development_dependency "pry", "~> 0.10"
23
+ spec.add_development_dependency "rake"
25
24
  end
metadata CHANGED
@@ -1,71 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lifx_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
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-29 00:00:00.000000000 Z
11
+ date: 2020-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.15'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.15'
27
- - !ruby/object:Gem::Dependency
28
- name: rake
14
+ name: minitest
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
17
  - - "~>"
32
18
  - !ruby/object:Gem::Version
33
- version: '10.0'
19
+ version: '5.0'
34
20
  type: :development
35
21
  prerelease: false
36
22
  version_requirements: !ruby/object:Gem::Requirement
37
23
  requirements:
38
24
  - - "~>"
39
25
  - !ruby/object:Gem::Version
40
- version: '10.0'
26
+ version: '5.0'
41
27
  - !ruby/object:Gem::Dependency
42
- name: minitest
28
+ name: pry
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
31
  - - "~>"
46
32
  - !ruby/object:Gem::Version
47
- version: '5.0'
33
+ version: '0.10'
48
34
  type: :development
49
35
  prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
38
  - - "~>"
53
39
  - !ruby/object:Gem::Version
54
- version: '5.0'
40
+ version: '0.10'
55
41
  - !ruby/object:Gem::Dependency
56
- name: pry
42
+ name: rake
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
- - - "~>"
45
+ - - ">="
60
46
  - !ruby/object:Gem::Version
61
- version: '0.10'
47
+ version: '0'
62
48
  type: :development
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
- - - "~>"
52
+ - - ">="
67
53
  - !ruby/object:Gem::Version
68
- version: '0.10'
54
+ version: '0'
69
55
  description:
70
56
  email:
71
57
  executables: []
@@ -73,6 +59,7 @@ extensions: []
73
59
  extra_rdoc_files: []
74
60
  files:
75
61
  - ".gitignore"
62
+ - ".travis.yml"
76
63
  - CHANGELOG
77
64
  - Gemfile
78
65
  - LICENSE.txt
@@ -102,8 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
89
  - !ruby/object:Gem::Version
103
90
  version: '0'
104
91
  requirements: []
105
- rubyforge_project:
106
- rubygems_version: 2.5.1
92
+ rubygems_version: 3.0.3
107
93
  signing_key:
108
94
  specification_version: 4
109
95
  summary: A client for the LIFX HTTP API