kgbhomeAPI 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.rvmrc ADDED
@@ -0,0 +1,81 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # This is an RVM Project .rvmrc file, used to automatically load the ruby
4
+ # development environment upon cd'ing into the directory
5
+
6
+ # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
7
+ environment_id="ruby-1.9.2-p290@kgbhomeAPI"
8
+
9
+ #
10
+ # Uncomment the following lines if you want to verify rvm version per project
11
+ #
12
+ # rvmrc_rvm_version="1.10.1" # 1.10.1 seams as a safe start
13
+ # eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
14
+ # echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
15
+ # return 1
16
+ # }
17
+ #
18
+
19
+ #
20
+ # Uncomment following line if you want options to be set only for given project.
21
+ #
22
+ # PROJECT_JRUBY_OPTS=( --1.9 )
23
+ #
24
+ # The variable PROJECT_JRUBY_OPTS requires the following to be run in shell:
25
+ #
26
+ # chmod +x ${rvm_path}/hooks/after_use_jruby_opts
27
+ #
28
+
29
+ #
30
+ # First we attempt to load the desired environment directly from the environment
31
+ # file. This is very fast and efficient compared to running through the entire
32
+ # CLI and selector. If you want feedback on which environment was used then
33
+ # insert the word 'use' after --create as this triggers verbose mode.
34
+ #
35
+ if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
36
+ && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
37
+ then
38
+ \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
39
+
40
+ if [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]]
41
+ then
42
+ . "${rvm_path:-$HOME/.rvm}/hooks/after_use"
43
+ fi
44
+ else
45
+ # If the environment file has not yet been created, use the RVM CLI to select.
46
+ if ! rvm --create "$environment_id"
47
+ then
48
+ echo "Failed to create RVM environment '${environment_id}'."
49
+ return 1
50
+ fi
51
+ fi
52
+
53
+ #
54
+ # If you use an RVM gemset file to install a list of gems (*.gems), you can have
55
+ # it be automatically loaded. Uncomment the following and adjust the filename if
56
+ # necessary.
57
+ #
58
+ # filename=".gems"
59
+ # if [[ -s "$filename" ]]
60
+ # then
61
+ # rvm gemset import "$filename" | grep -v already | grep -v listed | grep -v complete | sed '/^$/d'
62
+ # fi
63
+
64
+ # If you use bundler, this might be useful to you:
65
+ # if [[ -s Gemfile ]] && ! command -v bundle >/dev/null
66
+ # then
67
+ # printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n"
68
+ # gem install bundler
69
+ # fi
70
+ # if [[ -s Gemfile ]] && command -v bundle
71
+ # then
72
+ # bundle install
73
+ # fi
74
+
75
+ if [[ $- == *i* ]] # check for interactive shells
76
+ then
77
+ echo "Using: $(tput setaf 2)$GEM_HOME$(tput sgr0)" # show the user the ruby and gemset they are using in green
78
+ else
79
+ echo "Using: $GEM_HOME" # don't use colors in interactive shells
80
+ fi
81
+
data/Gemfile ADDED
@@ -0,0 +1,31 @@
1
+ source :rubygems
2
+
3
+ gemspec
4
+
5
+ gem 'thin'
6
+ gem 'sinatra', :git => 'git://github.com/sinatra/sinatra.git'
7
+ gem 'sinatra-contrib', :git => 'git://github.com/sinatra/sinatra-contrib.git'
8
+ gem 'json'
9
+ gem 'httparty'
10
+ gem 'hub'
11
+
12
+ group :development do
13
+ gem "shoulda", ">= 0"
14
+ gem "rdoc", "~> 3.12"
15
+ gem "jeweler", "~> 1.8.3"
16
+ gem "simplecov"
17
+ end
18
+
19
+ ## Add dependencies required to use your gem here.
20
+ ## Example:
21
+ ## gem "activesupport", ">= 2.3.5"
22
+ #
23
+ ## Add dependencies to develop your gem here.
24
+ ## Include everything needed to run rake, tests, features, etc.
25
+ #group :development do
26
+ # gem "shoulda", ">= 0"
27
+ # gem "rdoc", "~> 3.12"
28
+ # gem "bundler", "~> 1.0.0"
29
+ # gem "jeweler", "~> 1.8.3"
30
+ # gem "rcov", ">= 0"
31
+ #end
data/Gemfile.lock ADDED
@@ -0,0 +1,111 @@
1
+ GIT
2
+ remote: git://github.com/sinatra/sinatra-contrib.git
3
+ revision: c5c2d32e688123a1a1cab4b391447e995957c94f
4
+ specs:
5
+ sinatra-contrib (1.4.0)
6
+ backports (>= 2.0)
7
+ eventmachine
8
+ rack-protection
9
+ rack-test
10
+ sinatra (~> 1.4.0)
11
+ tilt (~> 1.3)
12
+
13
+ GIT
14
+ remote: git://github.com/sinatra/sinatra.git
15
+ revision: cab56ed7d64b9ffb6d4df48cb8d7d3153890f3ee
16
+ specs:
17
+ sinatra (1.4.0)
18
+ rack (~> 1.3, >= 1.3.6)
19
+ rack-protection (~> 1.2)
20
+ tilt (~> 1.3, >= 1.3.3)
21
+
22
+ PATH
23
+ remote: .
24
+ specs:
25
+ kgbhomeAPI (0.1.0)
26
+ httparty
27
+ hub
28
+ json
29
+ kgbhomeAPI
30
+ sinatra
31
+ sinatra-contrib
32
+ thin
33
+
34
+ GEM
35
+ remote: http://rubygems.org/
36
+ specs:
37
+ autowatchr (0.1.5)
38
+ watchr
39
+ backports (2.5.3)
40
+ daemons (1.1.8)
41
+ eventmachine (0.12.10)
42
+ git (1.2.5)
43
+ httparty (0.8.3)
44
+ multi_json (~> 1.0)
45
+ multi_xml
46
+ hub (1.10.0)
47
+ jeweler (1.8.3)
48
+ bundler (~> 1.0)
49
+ git (>= 1.2.5)
50
+ rake
51
+ rdoc
52
+ json (1.7.3)
53
+ minitest (2.0.2)
54
+ multi_json (1.3.5)
55
+ multi_xml (0.5.1)
56
+ mynyml-redgreen (0.7.1)
57
+ term-ansicolor (>= 1.0.4)
58
+ nokogiri (1.4.4)
59
+ powder (0.1.6)
60
+ thor (>= 0.11.5)
61
+ rack (1.4.1)
62
+ rack-protection (1.2.0)
63
+ rack
64
+ rack-test (0.6.1)
65
+ rack (>= 1.0)
66
+ rake (0.9.2.2)
67
+ rdoc (3.12)
68
+ json (~> 1.4)
69
+ shotgun (0.9)
70
+ rack (>= 1.0)
71
+ shoulda (3.0.1)
72
+ shoulda-context (~> 1.0.0)
73
+ shoulda-matchers (~> 1.0.0)
74
+ shoulda-context (1.0.0)
75
+ shoulda-matchers (1.0.0)
76
+ simplecov (0.6.4)
77
+ multi_json (~> 1.0)
78
+ simplecov-html (~> 0.5.3)
79
+ simplecov-html (0.5.3)
80
+ term-ansicolor (1.0.7)
81
+ thin (1.3.1)
82
+ daemons (>= 1.0.9)
83
+ eventmachine (>= 0.12.6)
84
+ rack (>= 1.0.0)
85
+ thor (0.15.2)
86
+ tilt (1.3.3)
87
+ watchr (0.7)
88
+
89
+ PLATFORMS
90
+ ruby
91
+
92
+ DEPENDENCIES
93
+ autowatchr (= 0.1.5)
94
+ httparty
95
+ hub
96
+ jeweler (~> 1.8.3)
97
+ json
98
+ kgbhomeAPI!
99
+ minitest (= 2.0.2)
100
+ mynyml-redgreen (= 0.7.1)
101
+ nokogiri (= 1.4.4)
102
+ powder (= 0.1.6)
103
+ rack-test (= 0.6.1)
104
+ rdoc (~> 3.12)
105
+ shotgun (= 0.9)
106
+ shoulda
107
+ simplecov
108
+ sinatra!
109
+ sinatra-contrib!
110
+ thin
111
+ watchr (= 0.7)
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 Chris Blazek
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,4 @@
1
+ kgbhomeAPI
2
+ ==========
3
+
4
+ Home Automation Sinatra RESTful API
data/README.rdoc ADDED
@@ -0,0 +1,19 @@
1
+ = kgbhomeAPI
2
+
3
+ Description goes here.
4
+
5
+ == Contributing to kgbhomeAPI
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
9
+ * Fork the project.
10
+ * Start a feature/bugfix branch.
11
+ * Commit and push until you are happy with your contribution.
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2012 Chris Blazek. See LICENSE.txt for
18
+ further details.
19
+
data/Rakefile ADDED
@@ -0,0 +1,53 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "kgbhomeAPI"
18
+ gem.homepage = "http://github.com/kingbin/kgbhomeAPI"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Home Automation Sinatra RESTful API}
21
+ gem.description = %Q{Home Automation Sinatra RESTful API}
22
+ gem.email = "chris.blazek@gmail.com"
23
+ gem.authors = ["Chris Blazek"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rake/testtask'
29
+ Rake::TestTask.new(:test) do |test|
30
+ test.libs << 'lib' << 'test'
31
+ test.pattern = 'test/**/test_*.rb'
32
+ test.verbose = true
33
+ end
34
+
35
+ #require 'rcov/rcovtask'
36
+ #Rcov::RcovTask.new do |test|
37
+ # test.libs << 'test'
38
+ # test.pattern = 'test/**/test_*.rb'
39
+ # test.verbose = true
40
+ # test.rcov_opts << '--exclude "gems/*"'
41
+ #end
42
+
43
+ task :default => :test
44
+
45
+ require 'rdoc/task'
46
+ Rake::RDocTask.new do |rdoc|
47
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
48
+
49
+ rdoc.rdoc_dir = 'rdoc'
50
+ rdoc.title = "kgbhomeAPI #{version}"
51
+ rdoc.rdoc_files.include('README*')
52
+ rdoc.rdoc_files.include('lib/**/*.rb')
53
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
data/config.ru ADDED
@@ -0,0 +1,2 @@
1
+ require './lib/kgbhomeAPI'
2
+ run KGBHomeAPI::App
@@ -0,0 +1,184 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "kgbhomeAPI"
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Chris Blazek"]
12
+ s.date = "2012-05-17"
13
+ s.description = "Home Automation Sinatra RESTful API"
14
+ s.email = "chris.blazek@gmail.com"
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.md",
18
+ "README.rdoc"
19
+ ]
20
+ s.files = [
21
+ ".document",
22
+ ".rvmrc",
23
+ "Gemfile",
24
+ "Gemfile.lock",
25
+ "LICENSE.txt",
26
+ "README.md",
27
+ "README.rdoc",
28
+ "Rakefile",
29
+ "VERSION",
30
+ "config.ru",
31
+ "kgbhomeAPI.gemspec",
32
+ "lib/kgbhomeAPI.rb",
33
+ "test/helper.rb",
34
+ "test/test_kgbhomeAPI.rb",
35
+ "views/houseTemp.erb",
36
+ "views/houseTempJSON.erb",
37
+ "views/index.erb",
38
+ "views/layout.erb"
39
+ ]
40
+ s.homepage = "http://github.com/kingbin/kgbhomeAPI"
41
+ s.licenses = ["MIT"]
42
+ s.require_paths = ["lib"]
43
+ s.rubygems_version = "1.8.15"
44
+ s.summary = "Home Automation Sinatra RESTful API"
45
+
46
+ if s.respond_to? :specification_version then
47
+ s.specification_version = 3
48
+
49
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
50
+ s.add_runtime_dependency(%q<kgbhomeAPI>, [">= 0"])
51
+ s.add_runtime_dependency(%q<thin>, [">= 0"])
52
+ s.add_runtime_dependency(%q<sinatra>, [">= 0"])
53
+ s.add_runtime_dependency(%q<sinatra-contrib>, [">= 0"])
54
+ s.add_runtime_dependency(%q<json>, [">= 0"])
55
+ s.add_runtime_dependency(%q<httparty>, [">= 0"])
56
+ s.add_runtime_dependency(%q<hub>, [">= 0"])
57
+ s.add_development_dependency(%q<shotgun>, ["= 0.9"])
58
+ s.add_development_dependency(%q<minitest>, ["= 2.0.2"])
59
+ s.add_development_dependency(%q<rack-test>, ["= 0.6.1"])
60
+ s.add_development_dependency(%q<mynyml-redgreen>, ["= 0.7.1"])
61
+ s.add_development_dependency(%q<watchr>, ["= 0.7"])
62
+ s.add_development_dependency(%q<autowatchr>, ["= 0.1.5"])
63
+ s.add_development_dependency(%q<nokogiri>, ["= 1.4.4"])
64
+ s.add_development_dependency(%q<powder>, ["= 0.1.6"])
65
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
66
+ s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
67
+ s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
68
+ s.add_development_dependency(%q<simplecov>, [">= 0"])
69
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
70
+ s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
71
+ s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
72
+ s.add_development_dependency(%q<simplecov>, [">= 0"])
73
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
74
+ s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
75
+ s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
76
+ s.add_development_dependency(%q<simplecov>, [">= 0"])
77
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
78
+ s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
79
+ s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
80
+ s.add_development_dependency(%q<simplecov>, [">= 0"])
81
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
82
+ s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
83
+ s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
84
+ s.add_development_dependency(%q<simplecov>, [">= 0"])
85
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
86
+ s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
87
+ s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
88
+ s.add_development_dependency(%q<simplecov>, [">= 0"])
89
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
90
+ s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
91
+ s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
92
+ s.add_development_dependency(%q<simplecov>, [">= 0"])
93
+ else
94
+ s.add_dependency(%q<kgbhomeAPI>, [">= 0"])
95
+ s.add_dependency(%q<thin>, [">= 0"])
96
+ s.add_dependency(%q<sinatra>, [">= 0"])
97
+ s.add_dependency(%q<sinatra-contrib>, [">= 0"])
98
+ s.add_dependency(%q<json>, [">= 0"])
99
+ s.add_dependency(%q<httparty>, [">= 0"])
100
+ s.add_dependency(%q<hub>, [">= 0"])
101
+ s.add_dependency(%q<shotgun>, ["= 0.9"])
102
+ s.add_dependency(%q<minitest>, ["= 2.0.2"])
103
+ s.add_dependency(%q<rack-test>, ["= 0.6.1"])
104
+ s.add_dependency(%q<mynyml-redgreen>, ["= 0.7.1"])
105
+ s.add_dependency(%q<watchr>, ["= 0.7"])
106
+ s.add_dependency(%q<autowatchr>, ["= 0.1.5"])
107
+ s.add_dependency(%q<nokogiri>, ["= 1.4.4"])
108
+ s.add_dependency(%q<powder>, ["= 0.1.6"])
109
+ s.add_dependency(%q<shoulda>, [">= 0"])
110
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
111
+ s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
112
+ s.add_dependency(%q<simplecov>, [">= 0"])
113
+ s.add_dependency(%q<shoulda>, [">= 0"])
114
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
115
+ s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
116
+ s.add_dependency(%q<simplecov>, [">= 0"])
117
+ s.add_dependency(%q<shoulda>, [">= 0"])
118
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
119
+ s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
120
+ s.add_dependency(%q<simplecov>, [">= 0"])
121
+ s.add_dependency(%q<shoulda>, [">= 0"])
122
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
123
+ s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
124
+ s.add_dependency(%q<simplecov>, [">= 0"])
125
+ s.add_dependency(%q<shoulda>, [">= 0"])
126
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
127
+ s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
128
+ s.add_dependency(%q<simplecov>, [">= 0"])
129
+ s.add_dependency(%q<shoulda>, [">= 0"])
130
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
131
+ s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
132
+ s.add_dependency(%q<simplecov>, [">= 0"])
133
+ s.add_dependency(%q<shoulda>, [">= 0"])
134
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
135
+ s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
136
+ s.add_dependency(%q<simplecov>, [">= 0"])
137
+ end
138
+ else
139
+ s.add_dependency(%q<kgbhomeAPI>, [">= 0"])
140
+ s.add_dependency(%q<thin>, [">= 0"])
141
+ s.add_dependency(%q<sinatra>, [">= 0"])
142
+ s.add_dependency(%q<sinatra-contrib>, [">= 0"])
143
+ s.add_dependency(%q<json>, [">= 0"])
144
+ s.add_dependency(%q<httparty>, [">= 0"])
145
+ s.add_dependency(%q<hub>, [">= 0"])
146
+ s.add_dependency(%q<shotgun>, ["= 0.9"])
147
+ s.add_dependency(%q<minitest>, ["= 2.0.2"])
148
+ s.add_dependency(%q<rack-test>, ["= 0.6.1"])
149
+ s.add_dependency(%q<mynyml-redgreen>, ["= 0.7.1"])
150
+ s.add_dependency(%q<watchr>, ["= 0.7"])
151
+ s.add_dependency(%q<autowatchr>, ["= 0.1.5"])
152
+ s.add_dependency(%q<nokogiri>, ["= 1.4.4"])
153
+ s.add_dependency(%q<powder>, ["= 0.1.6"])
154
+ s.add_dependency(%q<shoulda>, [">= 0"])
155
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
156
+ s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
157
+ s.add_dependency(%q<simplecov>, [">= 0"])
158
+ s.add_dependency(%q<shoulda>, [">= 0"])
159
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
160
+ s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
161
+ s.add_dependency(%q<simplecov>, [">= 0"])
162
+ s.add_dependency(%q<shoulda>, [">= 0"])
163
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
164
+ s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
165
+ s.add_dependency(%q<simplecov>, [">= 0"])
166
+ s.add_dependency(%q<shoulda>, [">= 0"])
167
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
168
+ s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
169
+ s.add_dependency(%q<simplecov>, [">= 0"])
170
+ s.add_dependency(%q<shoulda>, [">= 0"])
171
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
172
+ s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
173
+ s.add_dependency(%q<simplecov>, [">= 0"])
174
+ s.add_dependency(%q<shoulda>, [">= 0"])
175
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
176
+ s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
177
+ s.add_dependency(%q<simplecov>, [">= 0"])
178
+ s.add_dependency(%q<shoulda>, [">= 0"])
179
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
180
+ s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
181
+ s.add_dependency(%q<simplecov>, [">= 0"])
182
+ end
183
+ end
184
+
data/lib/kgbhomeAPI.rb ADDED
@@ -0,0 +1,76 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+ Bundler.require(:default)
4
+ require "sinatra/config_file"
5
+
6
+ module KGBHomeAPI
7
+ class App < Sinatra::Base
8
+ use Rack::MethodOverride
9
+ register Sinatra::ConfigFile
10
+ config_file '../config.yml'
11
+
12
+ # set :port, settings.port
13
+
14
+ configure do
15
+ set :root, File.expand_path(File.join(File.dirname(__FILE__), '..'))
16
+ set :app_file, __FILE__
17
+
18
+ set :port, settings.port
19
+
20
+ # enable :sessions
21
+ # set :session_secret, "N0m d3 D13u d3 put41n d3 60rd31 d3 m3rd3 d3 s4l0pEri3 dE conN4rd d'EnculE d3 t4 m3r3"
22
+ #
23
+ # set :auth do |bool|
24
+ # condition do
25
+ # # remenber the previous route
26
+ # session[:route] = request.path_info
27
+ # unless logged_in?
28
+ # flash[:notice] = "You need to be logged in to access this page."
29
+ # redirect '/login'
30
+ # end
31
+ # end
32
+ # end
33
+ end
34
+
35
+ get '/' do
36
+ "Hello world, it's #{Time.now} at the server!"
37
+ end
38
+
39
+ get '/temp' do
40
+ page = HTTParty.get("http://#{settings.thermostatIP}/tstat").body rescue nil
41
+ status = JSON.parse(page) rescue nil
42
+ returnStatus = Array.new
43
+
44
+ if status
45
+ returnStatus[returnStatus.length] = "The temperature is currently #{status["temp"]} degrees."
46
+
47
+ if status["tmode"] == 0
48
+ returnStatus[returnStatus.length] = "The heater and air conditioner are turned off."
49
+ else
50
+ device_type = (status["tmode"] == 1 ? "heater" : "air conditioner")
51
+ target_temp = (status["tmode"] == 1 ? status["t_heat"] : status["t_cool"])
52
+
53
+ returnStatus[returnStatus.length] = "The #{device_type} is set to engage at #{target_temp} degrees."
54
+
55
+ if status["tstate"] == 0
56
+ returnStatus[returnStatus.length] = "The #{device_type} is off."
57
+ elsif (status["tmode"] == 1 and status["tstate"] == 1) or (status["tmode"] == 2 and status["tstate"] == 2)
58
+ returnStatus[returnStatus.length] = "The #{device_type} is running."
59
+ end
60
+ end
61
+ else
62
+ returnStatus[returnStatus.length] = "Sorry, the thermostat is off."
63
+ end
64
+
65
+ @tempStatus = returnStatus
66
+
67
+ erb :houseTemp
68
+ end
69
+
70
+ get '/tempJSON' do
71
+ page = HTTParty.get("http://#{settings.thermostatIP}/tstat").body rescue nil
72
+ "#{page}"
73
+ end
74
+
75
+ end
76
+ end
data/test/helper.rb ADDED
@@ -0,0 +1,18 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'test/unit'
11
+ require 'shoulda'
12
+
13
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
15
+ require 'kgbhomeAPI'
16
+
17
+ class Test::Unit::TestCase
18
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestKgbhomeapi < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
@@ -0,0 +1 @@
1
+ Stats Pulled From Your Thermostat: <%= @tempStatus %>
@@ -0,0 +1 @@
1
+ <%= @tempStatus %>
data/views/index.erb ADDED
@@ -0,0 +1 @@
1
+ <%= @foo %>
data/views/layout.erb ADDED
@@ -0,0 +1,6 @@
1
+ <html>
2
+ <head></head>
3
+ <body>
4
+ <%= yield %>
5
+ </body>
6
+ </html>
metadata ADDED
@@ -0,0 +1,542 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kgbhomeAPI
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Chris Blazek
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-05-17 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: kgbhomeAPI
16
+ requirement: &15801940 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *15801940
25
+ - !ruby/object:Gem::Dependency
26
+ name: thin
27
+ requirement: &15801140 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *15801140
36
+ - !ruby/object:Gem::Dependency
37
+ name: sinatra
38
+ requirement: &15800420 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *15800420
47
+ - !ruby/object:Gem::Dependency
48
+ name: sinatra-contrib
49
+ requirement: &15799700 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: *15799700
58
+ - !ruby/object:Gem::Dependency
59
+ name: json
60
+ requirement: &15799020 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :runtime
67
+ prerelease: false
68
+ version_requirements: *15799020
69
+ - !ruby/object:Gem::Dependency
70
+ name: httparty
71
+ requirement: &15798260 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :runtime
78
+ prerelease: false
79
+ version_requirements: *15798260
80
+ - !ruby/object:Gem::Dependency
81
+ name: hub
82
+ requirement: &15797540 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ type: :runtime
89
+ prerelease: false
90
+ version_requirements: *15797540
91
+ - !ruby/object:Gem::Dependency
92
+ name: shotgun
93
+ requirement: &15796720 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - =
97
+ - !ruby/object:Gem::Version
98
+ version: '0.9'
99
+ type: :development
100
+ prerelease: false
101
+ version_requirements: *15796720
102
+ - !ruby/object:Gem::Dependency
103
+ name: minitest
104
+ requirement: &15796020 !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - =
108
+ - !ruby/object:Gem::Version
109
+ version: 2.0.2
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: *15796020
113
+ - !ruby/object:Gem::Dependency
114
+ name: rack-test
115
+ requirement: &15795320 !ruby/object:Gem::Requirement
116
+ none: false
117
+ requirements:
118
+ - - =
119
+ - !ruby/object:Gem::Version
120
+ version: 0.6.1
121
+ type: :development
122
+ prerelease: false
123
+ version_requirements: *15795320
124
+ - !ruby/object:Gem::Dependency
125
+ name: mynyml-redgreen
126
+ requirement: &15794660 !ruby/object:Gem::Requirement
127
+ none: false
128
+ requirements:
129
+ - - =
130
+ - !ruby/object:Gem::Version
131
+ version: 0.7.1
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: *15794660
135
+ - !ruby/object:Gem::Dependency
136
+ name: watchr
137
+ requirement: &15773320 !ruby/object:Gem::Requirement
138
+ none: false
139
+ requirements:
140
+ - - =
141
+ - !ruby/object:Gem::Version
142
+ version: '0.7'
143
+ type: :development
144
+ prerelease: false
145
+ version_requirements: *15773320
146
+ - !ruby/object:Gem::Dependency
147
+ name: autowatchr
148
+ requirement: &15772720 !ruby/object:Gem::Requirement
149
+ none: false
150
+ requirements:
151
+ - - =
152
+ - !ruby/object:Gem::Version
153
+ version: 0.1.5
154
+ type: :development
155
+ prerelease: false
156
+ version_requirements: *15772720
157
+ - !ruby/object:Gem::Dependency
158
+ name: nokogiri
159
+ requirement: &15772120 !ruby/object:Gem::Requirement
160
+ none: false
161
+ requirements:
162
+ - - =
163
+ - !ruby/object:Gem::Version
164
+ version: 1.4.4
165
+ type: :development
166
+ prerelease: false
167
+ version_requirements: *15772120
168
+ - !ruby/object:Gem::Dependency
169
+ name: powder
170
+ requirement: &15771520 !ruby/object:Gem::Requirement
171
+ none: false
172
+ requirements:
173
+ - - =
174
+ - !ruby/object:Gem::Version
175
+ version: 0.1.6
176
+ type: :development
177
+ prerelease: false
178
+ version_requirements: *15771520
179
+ - !ruby/object:Gem::Dependency
180
+ name: shoulda
181
+ requirement: &15770920 !ruby/object:Gem::Requirement
182
+ none: false
183
+ requirements:
184
+ - - ! '>='
185
+ - !ruby/object:Gem::Version
186
+ version: '0'
187
+ type: :development
188
+ prerelease: false
189
+ version_requirements: *15770920
190
+ - !ruby/object:Gem::Dependency
191
+ name: rdoc
192
+ requirement: &15770200 !ruby/object:Gem::Requirement
193
+ none: false
194
+ requirements:
195
+ - - ~>
196
+ - !ruby/object:Gem::Version
197
+ version: '3.12'
198
+ type: :development
199
+ prerelease: false
200
+ version_requirements: *15770200
201
+ - !ruby/object:Gem::Dependency
202
+ name: jeweler
203
+ requirement: &15769300 !ruby/object:Gem::Requirement
204
+ none: false
205
+ requirements:
206
+ - - ~>
207
+ - !ruby/object:Gem::Version
208
+ version: 1.8.3
209
+ type: :development
210
+ prerelease: false
211
+ version_requirements: *15769300
212
+ - !ruby/object:Gem::Dependency
213
+ name: simplecov
214
+ requirement: &15768520 !ruby/object:Gem::Requirement
215
+ none: false
216
+ requirements:
217
+ - - ! '>='
218
+ - !ruby/object:Gem::Version
219
+ version: '0'
220
+ type: :development
221
+ prerelease: false
222
+ version_requirements: *15768520
223
+ - !ruby/object:Gem::Dependency
224
+ name: shoulda
225
+ requirement: &15767900 !ruby/object:Gem::Requirement
226
+ none: false
227
+ requirements:
228
+ - - ! '>='
229
+ - !ruby/object:Gem::Version
230
+ version: '0'
231
+ type: :development
232
+ prerelease: false
233
+ version_requirements: *15767900
234
+ - !ruby/object:Gem::Dependency
235
+ name: rdoc
236
+ requirement: &15767300 !ruby/object:Gem::Requirement
237
+ none: false
238
+ requirements:
239
+ - - ~>
240
+ - !ruby/object:Gem::Version
241
+ version: '3.12'
242
+ type: :development
243
+ prerelease: false
244
+ version_requirements: *15767300
245
+ - !ruby/object:Gem::Dependency
246
+ name: jeweler
247
+ requirement: &15766660 !ruby/object:Gem::Requirement
248
+ none: false
249
+ requirements:
250
+ - - ~>
251
+ - !ruby/object:Gem::Version
252
+ version: 1.8.3
253
+ type: :development
254
+ prerelease: false
255
+ version_requirements: *15766660
256
+ - !ruby/object:Gem::Dependency
257
+ name: simplecov
258
+ requirement: &15766020 !ruby/object:Gem::Requirement
259
+ none: false
260
+ requirements:
261
+ - - ! '>='
262
+ - !ruby/object:Gem::Version
263
+ version: '0'
264
+ type: :development
265
+ prerelease: false
266
+ version_requirements: *15766020
267
+ - !ruby/object:Gem::Dependency
268
+ name: shoulda
269
+ requirement: &15751240 !ruby/object:Gem::Requirement
270
+ none: false
271
+ requirements:
272
+ - - ! '>='
273
+ - !ruby/object:Gem::Version
274
+ version: '0'
275
+ type: :development
276
+ prerelease: false
277
+ version_requirements: *15751240
278
+ - !ruby/object:Gem::Dependency
279
+ name: rdoc
280
+ requirement: &15750760 !ruby/object:Gem::Requirement
281
+ none: false
282
+ requirements:
283
+ - - ~>
284
+ - !ruby/object:Gem::Version
285
+ version: '3.12'
286
+ type: :development
287
+ prerelease: false
288
+ version_requirements: *15750760
289
+ - !ruby/object:Gem::Dependency
290
+ name: jeweler
291
+ requirement: &15750260 !ruby/object:Gem::Requirement
292
+ none: false
293
+ requirements:
294
+ - - ~>
295
+ - !ruby/object:Gem::Version
296
+ version: 1.8.3
297
+ type: :development
298
+ prerelease: false
299
+ version_requirements: *15750260
300
+ - !ruby/object:Gem::Dependency
301
+ name: simplecov
302
+ requirement: &15749760 !ruby/object:Gem::Requirement
303
+ none: false
304
+ requirements:
305
+ - - ! '>='
306
+ - !ruby/object:Gem::Version
307
+ version: '0'
308
+ type: :development
309
+ prerelease: false
310
+ version_requirements: *15749760
311
+ - !ruby/object:Gem::Dependency
312
+ name: shoulda
313
+ requirement: &15749260 !ruby/object:Gem::Requirement
314
+ none: false
315
+ requirements:
316
+ - - ! '>='
317
+ - !ruby/object:Gem::Version
318
+ version: '0'
319
+ type: :development
320
+ prerelease: false
321
+ version_requirements: *15749260
322
+ - !ruby/object:Gem::Dependency
323
+ name: rdoc
324
+ requirement: &15748740 !ruby/object:Gem::Requirement
325
+ none: false
326
+ requirements:
327
+ - - ~>
328
+ - !ruby/object:Gem::Version
329
+ version: '3.12'
330
+ type: :development
331
+ prerelease: false
332
+ version_requirements: *15748740
333
+ - !ruby/object:Gem::Dependency
334
+ name: jeweler
335
+ requirement: &15748200 !ruby/object:Gem::Requirement
336
+ none: false
337
+ requirements:
338
+ - - ~>
339
+ - !ruby/object:Gem::Version
340
+ version: 1.8.3
341
+ type: :development
342
+ prerelease: false
343
+ version_requirements: *15748200
344
+ - !ruby/object:Gem::Dependency
345
+ name: simplecov
346
+ requirement: &15747660 !ruby/object:Gem::Requirement
347
+ none: false
348
+ requirements:
349
+ - - ! '>='
350
+ - !ruby/object:Gem::Version
351
+ version: '0'
352
+ type: :development
353
+ prerelease: false
354
+ version_requirements: *15747660
355
+ - !ruby/object:Gem::Dependency
356
+ name: shoulda
357
+ requirement: &15747060 !ruby/object:Gem::Requirement
358
+ none: false
359
+ requirements:
360
+ - - ! '>='
361
+ - !ruby/object:Gem::Version
362
+ version: '0'
363
+ type: :development
364
+ prerelease: false
365
+ version_requirements: *15747060
366
+ - !ruby/object:Gem::Dependency
367
+ name: rdoc
368
+ requirement: &15746420 !ruby/object:Gem::Requirement
369
+ none: false
370
+ requirements:
371
+ - - ~>
372
+ - !ruby/object:Gem::Version
373
+ version: '3.12'
374
+ type: :development
375
+ prerelease: false
376
+ version_requirements: *15746420
377
+ - !ruby/object:Gem::Dependency
378
+ name: jeweler
379
+ requirement: &15745880 !ruby/object:Gem::Requirement
380
+ none: false
381
+ requirements:
382
+ - - ~>
383
+ - !ruby/object:Gem::Version
384
+ version: 1.8.3
385
+ type: :development
386
+ prerelease: false
387
+ version_requirements: *15745880
388
+ - !ruby/object:Gem::Dependency
389
+ name: simplecov
390
+ requirement: &15745120 !ruby/object:Gem::Requirement
391
+ none: false
392
+ requirements:
393
+ - - ! '>='
394
+ - !ruby/object:Gem::Version
395
+ version: '0'
396
+ type: :development
397
+ prerelease: false
398
+ version_requirements: *15745120
399
+ - !ruby/object:Gem::Dependency
400
+ name: shoulda
401
+ requirement: &15744500 !ruby/object:Gem::Requirement
402
+ none: false
403
+ requirements:
404
+ - - ! '>='
405
+ - !ruby/object:Gem::Version
406
+ version: '0'
407
+ type: :development
408
+ prerelease: false
409
+ version_requirements: *15744500
410
+ - !ruby/object:Gem::Dependency
411
+ name: rdoc
412
+ requirement: &15743920 !ruby/object:Gem::Requirement
413
+ none: false
414
+ requirements:
415
+ - - ~>
416
+ - !ruby/object:Gem::Version
417
+ version: '3.12'
418
+ type: :development
419
+ prerelease: false
420
+ version_requirements: *15743920
421
+ - !ruby/object:Gem::Dependency
422
+ name: jeweler
423
+ requirement: &15743300 !ruby/object:Gem::Requirement
424
+ none: false
425
+ requirements:
426
+ - - ~>
427
+ - !ruby/object:Gem::Version
428
+ version: 1.8.3
429
+ type: :development
430
+ prerelease: false
431
+ version_requirements: *15743300
432
+ - !ruby/object:Gem::Dependency
433
+ name: simplecov
434
+ requirement: &15740220 !ruby/object:Gem::Requirement
435
+ none: false
436
+ requirements:
437
+ - - ! '>='
438
+ - !ruby/object:Gem::Version
439
+ version: '0'
440
+ type: :development
441
+ prerelease: false
442
+ version_requirements: *15740220
443
+ - !ruby/object:Gem::Dependency
444
+ name: shoulda
445
+ requirement: &15739360 !ruby/object:Gem::Requirement
446
+ none: false
447
+ requirements:
448
+ - - ! '>='
449
+ - !ruby/object:Gem::Version
450
+ version: '0'
451
+ type: :development
452
+ prerelease: false
453
+ version_requirements: *15739360
454
+ - !ruby/object:Gem::Dependency
455
+ name: rdoc
456
+ requirement: &15738840 !ruby/object:Gem::Requirement
457
+ none: false
458
+ requirements:
459
+ - - ~>
460
+ - !ruby/object:Gem::Version
461
+ version: '3.12'
462
+ type: :development
463
+ prerelease: false
464
+ version_requirements: *15738840
465
+ - !ruby/object:Gem::Dependency
466
+ name: jeweler
467
+ requirement: &15738340 !ruby/object:Gem::Requirement
468
+ none: false
469
+ requirements:
470
+ - - ~>
471
+ - !ruby/object:Gem::Version
472
+ version: 1.8.3
473
+ type: :development
474
+ prerelease: false
475
+ version_requirements: *15738340
476
+ - !ruby/object:Gem::Dependency
477
+ name: simplecov
478
+ requirement: &15737840 !ruby/object:Gem::Requirement
479
+ none: false
480
+ requirements:
481
+ - - ! '>='
482
+ - !ruby/object:Gem::Version
483
+ version: '0'
484
+ type: :development
485
+ prerelease: false
486
+ version_requirements: *15737840
487
+ description: Home Automation Sinatra RESTful API
488
+ email: chris.blazek@gmail.com
489
+ executables: []
490
+ extensions: []
491
+ extra_rdoc_files:
492
+ - LICENSE.txt
493
+ - README.md
494
+ - README.rdoc
495
+ files:
496
+ - .document
497
+ - .rvmrc
498
+ - Gemfile
499
+ - Gemfile.lock
500
+ - LICENSE.txt
501
+ - README.md
502
+ - README.rdoc
503
+ - Rakefile
504
+ - VERSION
505
+ - config.ru
506
+ - kgbhomeAPI.gemspec
507
+ - lib/kgbhomeAPI.rb
508
+ - test/helper.rb
509
+ - test/test_kgbhomeAPI.rb
510
+ - views/houseTemp.erb
511
+ - views/houseTempJSON.erb
512
+ - views/index.erb
513
+ - views/layout.erb
514
+ homepage: http://github.com/kingbin/kgbhomeAPI
515
+ licenses:
516
+ - MIT
517
+ post_install_message:
518
+ rdoc_options: []
519
+ require_paths:
520
+ - lib
521
+ required_ruby_version: !ruby/object:Gem::Requirement
522
+ none: false
523
+ requirements:
524
+ - - ! '>='
525
+ - !ruby/object:Gem::Version
526
+ version: '0'
527
+ segments:
528
+ - 0
529
+ hash: -4209905869750367468
530
+ required_rubygems_version: !ruby/object:Gem::Requirement
531
+ none: false
532
+ requirements:
533
+ - - ! '>='
534
+ - !ruby/object:Gem::Version
535
+ version: '0'
536
+ requirements: []
537
+ rubyforge_project:
538
+ rubygems_version: 1.8.15
539
+ signing_key:
540
+ specification_version: 3
541
+ summary: Home Automation Sinatra RESTful API
542
+ test_files: []