lono-api 0.0.3 → 0.1.0
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/bin/console +29 -0
- data/lib/lono-api/device.rb +1 -24
- data/lib/lono-api/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0eade0adb72e7121c2f89c3eb55b88abcd6f5557
|
4
|
+
data.tar.gz: d28ba2650df709fcf9f716115863f115753c9f1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b97db04830df1cbac2ff4b82c592bde9da74fbf48c718bee7df587596193cea0006331bd1672933f4513a22fb1787810250971d7932e14a85e1808d036d650fc
|
7
|
+
data.tar.gz: 1384f0904f0fc5fa70c03efed72e7df417f93e5f20af8f6417a2146f0c2b85397270f12875d1bbe21fec60aecdd7e0268708662307ec6ee456b7ca7925592240
|
data/Gemfile.lock
CHANGED
data/bin/console
ADDED
@@ -0,0 +1,29 @@
|
|
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)
|
data/lib/lono-api/device.rb
CHANGED
@@ -17,27 +17,6 @@ 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
|
-
|
41
20
|
# other api methods
|
42
21
|
# def something_else do
|
43
22
|
# query_device @id, {
|
@@ -56,10 +35,8 @@ module Lono
|
|
56
35
|
url,
|
57
36
|
headers: {
|
58
37
|
"Accept" => "application/json",
|
59
|
-
"content-type" => "application/json",
|
60
38
|
"Authorization" => "bearer #{@session_token.access_token}"
|
61
|
-
}
|
62
|
-
parameters: query[:body].to_json
|
39
|
+
}
|
63
40
|
)
|
64
41
|
|
65
42
|
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.0
|
4
|
+
version: 0.1.0
|
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-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -81,6 +81,7 @@ files:
|
|
81
81
|
- LICENSE.txt
|
82
82
|
- README.md
|
83
83
|
- Rakefile
|
84
|
+
- bin/console
|
84
85
|
- bin/setup
|
85
86
|
- lib/lono-api.rb
|
86
87
|
- lib/lono-api/.DS_Store
|