lono-api 0.1.0 → 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/Gemfile.lock +1 -1
- data/lib/lono-api/device.rb +24 -1
- data/lib/lono-api/version.rb +1 -1
- metadata +2 -3
- data/bin/console +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03a9d1cad80af84c136783dc0bbf146527ab10ea
|
4
|
+
data.tar.gz: 2231608cb3d981ae837e174a8fc7490bcdecc96c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16a698d000985b09fc82e150f5bf608a37fdbb9182e9e311407966ee453eb92fae3e6c2c024a21eae619012bd09e36fb32a8a6c6a35914c96a379db495136607
|
7
|
+
data.tar.gz: 5ca3d05687b0633d392b0240d36ad52038d42a8ad8f62dc9054319710010499dcffb749e97b32ec91b8949bf44f0fb537968c802a9fe3fc481f0ffb62481d2dd
|
data/Gemfile.lock
CHANGED
data/lib/lono-api/device.rb
CHANGED
@@ -17,6 +17,27 @@ module Lono
|
|
17
17
|
}
|
18
18
|
end
|
19
19
|
|
20
|
+
def set_led(color, brightness)
|
21
|
+
query_device @id, {
|
22
|
+
:url => "state",
|
23
|
+
:method => "post",
|
24
|
+
:body => {
|
25
|
+
:color => color,
|
26
|
+
:brightness => brightness
|
27
|
+
}
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def set_led_options(options)
|
32
|
+
query_device @id, {
|
33
|
+
:url => "state",
|
34
|
+
:method => "post",
|
35
|
+
:body => options
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
|
20
41
|
# other api methods
|
21
42
|
# def something_else do
|
22
43
|
# query_device @id, {
|
@@ -35,8 +56,10 @@ module Lono
|
|
35
56
|
url,
|
36
57
|
headers: {
|
37
58
|
"Accept" => "application/json",
|
59
|
+
"content-type" => "application/json",
|
38
60
|
"Authorization" => "bearer #{@session_token.access_token}"
|
39
|
-
}
|
61
|
+
},
|
62
|
+
parameters: query[:body].to_json
|
40
63
|
)
|
41
64
|
|
42
65
|
if response.code == 200 and response.body.has_key? "name" and response.body["name"] =~ /success/
|
data/lib/lono-api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lono-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
|
- 1egoman
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -81,7 +81,6 @@ files:
|
|
81
81
|
- LICENSE.txt
|
82
82
|
- README.md
|
83
83
|
- Rakefile
|
84
|
-
- bin/console
|
85
84
|
- bin/setup
|
86
85
|
- lib/lono-api.rb
|
87
86
|
- lib/lono-api/.DS_Store
|
data/bin/console
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "lono-api"
|
5
|
-
|
6
|
-
|
7
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
-
# with your gem easier. You can also use a different console, if you like.
|
9
|
-
|
10
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
-
# require "pry"
|
12
|
-
# Pry.start
|
13
|
-
|
14
|
-
require "irb"
|
15
|
-
# IRB.start
|
16
|
-
|
17
|
-
Lono.configure do |config|
|
18
|
-
config.client_id = '256a8990-1c86-4d3a-9037-4e1495da510e'
|
19
|
-
config.client_secret = '21e75918-9961-42c3-aea5-f4aecea115b3'
|
20
|
-
config.auth_token = 'e9bed6e8-e6dd-46e3-95d4-5a93c5930718'
|
21
|
-
config.scope = ['write']
|
22
|
-
end
|
23
|
-
# puts Lono::AuthUrl.fetch "http://lono.io"
|
24
|
-
|
25
|
-
token = Lono::SessionToken.fetch
|
26
|
-
device = Lono::Device.new "34ffda053257333933870457", token
|
27
|
-
device.set_zone(0, true)
|
28
|
-
sleep 5
|
29
|
-
device.set_zone(0, false)
|