ninja_blocks 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ninja_blocks/base.rb +10 -6
- data/lib/ninja_blocks/device.rb +2 -2
- data/lib/ninja_blocks/version.rb +1 -1
- metadata +3 -2
data/lib/ninja_blocks/base.rb
CHANGED
@@ -3,15 +3,15 @@ module NinjaBlocks
|
|
3
3
|
def get(url,options={})
|
4
4
|
execute(:get,url,options)
|
5
5
|
end
|
6
|
-
def put(url)
|
7
|
-
execute(
|
6
|
+
def put(url,options={})
|
7
|
+
execute(url, json)
|
8
8
|
end
|
9
|
-
def post(url)
|
10
|
-
execute(:post,url)
|
9
|
+
def post(url,options={})
|
10
|
+
execute(:post,url,options)
|
11
11
|
end
|
12
12
|
|
13
|
-
def delete(url)
|
14
|
-
execute(:delete,url)
|
13
|
+
def delete(url,options={})
|
14
|
+
execute(:delete,url,options)
|
15
15
|
end
|
16
16
|
|
17
17
|
def connection
|
@@ -34,6 +34,10 @@ module NinjaBlocks
|
|
34
34
|
end
|
35
35
|
JSON.parse(response.body)
|
36
36
|
end
|
37
|
+
#ugly hack, but I'm too tired to think
|
38
|
+
def put_json(url, json)
|
39
|
+
response = connection.send(:put, "#{url}?user_access_token=#{self.token}", json)
|
40
|
+
end
|
37
41
|
|
38
42
|
end
|
39
43
|
end
|
data/lib/ninja_blocks/device.rb
CHANGED
@@ -71,8 +71,8 @@ module NinjaBlocks
|
|
71
71
|
end
|
72
72
|
|
73
73
|
def actuate(guid, da)
|
74
|
-
json = JSON.dump('DA'=>
|
75
|
-
|
74
|
+
json = JSON.dump('DA'=> da)
|
75
|
+
put_json("https://api.ninja.is/rest/v0/device/#{guid}", json)
|
76
76
|
end
|
77
77
|
|
78
78
|
def subscribe(guid, url)
|
data/lib/ninja_blocks/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ninja_blocks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
12
|
+
date: 2013-04-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|
@@ -132,3 +132,4 @@ signing_key:
|
|
132
132
|
specification_version: 3
|
133
133
|
summary: Ninja Blocks!
|
134
134
|
test_files: []
|
135
|
+
has_rdoc:
|