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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0eade0adb72e7121c2f89c3eb55b88abcd6f5557
4
- data.tar.gz: d28ba2650df709fcf9f716115863f115753c9f1b
3
+ metadata.gz: 03a9d1cad80af84c136783dc0bbf146527ab10ea
4
+ data.tar.gz: 2231608cb3d981ae837e174a8fc7490bcdecc96c
5
5
  SHA512:
6
- metadata.gz: b97db04830df1cbac2ff4b82c592bde9da74fbf48c718bee7df587596193cea0006331bd1672933f4513a22fb1787810250971d7932e14a85e1808d036d650fc
7
- data.tar.gz: 1384f0904f0fc5fa70c03efed72e7df417f93e5f20af8f6417a2146f0c2b85397270f12875d1bbe21fec60aecdd7e0268708662307ec6ee456b7ca7925592240
6
+ metadata.gz: 16a698d000985b09fc82e150f5bf608a37fdbb9182e9e311407966ee453eb92fae3e6c2c024a21eae619012bd09e36fb32a8a6c6a35914c96a379db495136607
7
+ data.tar.gz: 5ca3d05687b0633d392b0240d36ad52038d42a8ad8f62dc9054319710010499dcffb749e97b32ec91b8949bf44f0fb537968c802a9fe3fc481f0ffb62481d2dd
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lono-api (0.1.0)
4
+ lono-api (0.1.3)
5
5
  unirest (~> 1.1.2)
6
6
 
7
7
  GEM
@@ -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/
@@ -1,4 +1,4 @@
1
1
  module Lono
2
2
  API_VERSION = 'v1'
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.3"
4
4
  end
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.0
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-24 00:00:00.000000000 Z
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)