ninja_blocks 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/ninja_blocks/base.rb +4 -1
- data/lib/ninja_blocks/device.rb +10 -0
- data/lib/ninja_blocks/version.rb +1 -1
- data/ninja_blocks-0.0.9.gem +0 -0
- data/ninja_blocks.gemspec +5 -5
- metadata +7 -6
data/lib/ninja_blocks/base.rb
CHANGED
@@ -36,9 +36,12 @@ module NinjaBlocks
|
|
36
36
|
end
|
37
37
|
#ugly hack, but I'm too tired to think
|
38
38
|
def put_json(url, json)
|
39
|
+
puts url
|
40
|
+
puts json
|
39
41
|
response = connection.send(:put, "#{url}?user_access_token=#{self.token}", json)
|
42
|
+
puts response
|
40
43
|
end
|
41
|
-
|
44
|
+
|
42
45
|
end
|
43
46
|
end
|
44
47
|
|
data/lib/ninja_blocks/device.rb
CHANGED
@@ -6,6 +6,9 @@ module NinjaBlocks
|
|
6
6
|
hash_of_response = get("https://api.ninja.is/rest/v0/devices")
|
7
7
|
|
8
8
|
devices = []
|
9
|
+
|
10
|
+
|
11
|
+
|
9
12
|
unless filter_by.nil?
|
10
13
|
filter_by = filter_by[0] if filter_by.kind_of?(Array)
|
11
14
|
end
|
@@ -34,6 +37,7 @@ module NinjaBlocks
|
|
34
37
|
devices
|
35
38
|
end
|
36
39
|
|
40
|
+
|
37
41
|
def available_types
|
38
42
|
hash_of_response = get("https://api.ninja.is/rest/v0/devices")
|
39
43
|
|
@@ -75,6 +79,12 @@ module NinjaBlocks
|
|
75
79
|
put_json("https://api.ninja.is/rest/v0/device/#{guid}", json)
|
76
80
|
end
|
77
81
|
|
82
|
+
def actuate_local(local_ip, guid, da)
|
83
|
+
json = JSON.dump('DA'=> "#{da}")
|
84
|
+
puts "http://#{local_ip}:8000/rest/v0/device/#{guid}"
|
85
|
+
put_json("http://#{local_ip}:8000/rest/v0/device/#{guid}", json)
|
86
|
+
end
|
87
|
+
|
78
88
|
def subscribe(guid, url)
|
79
89
|
json = JSON.dump('url'=> url)
|
80
90
|
post("https://api.ninja.is/rest/v0/device/#{guid}/callback", json)
|
data/lib/ninja_blocks/version.rb
CHANGED
Binary file
|
data/ninja_blocks.gemspec
CHANGED
@@ -16,13 +16,13 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
17
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
18
|
gem.require_paths = ["lib"]
|
19
|
-
|
19
|
+
|
20
20
|
gem.add_dependency 'faraday'
|
21
21
|
gem.add_dependency 'rest-client'
|
22
22
|
gem.add_dependency 'json'
|
23
|
-
gem.add_dependency 'active_support'
|
23
|
+
gem.add_dependency 'active_support', '3.0.0'
|
24
24
|
gem.add_dependency 'chronic'
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
|
26
|
+
|
27
|
+
|
28
28
|
end
|
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.10
|
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-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|
@@ -64,17 +64,17 @@ dependencies:
|
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
none: false
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - '='
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
69
|
+
version: 3.0.0
|
70
70
|
type: :runtime
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
|
-
- -
|
75
|
+
- - '='
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
77
|
+
version: 3.0.0
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
79
|
name: chronic
|
80
80
|
requirement: !ruby/object:Gem::Requirement
|
@@ -106,6 +106,7 @@ files:
|
|
106
106
|
- lib/ninja_blocks/rule.rb
|
107
107
|
- lib/ninja_blocks/user.rb
|
108
108
|
- lib/ninja_blocks/version.rb
|
109
|
+
- ninja_blocks-0.0.9.gem
|
109
110
|
- ninja_blocks.gemspec
|
110
111
|
homepage: http://ninjablocks.com
|
111
112
|
licenses: []
|