my_zeo 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +21 -0
- data/LICENSE +20 -0
- data/README.rdoc +17 -0
- data/Rakefile +54 -0
- data/VERSION +1 -0
- data/lib/my_zeo.rb +92 -0
- data/my_zeo.gemspec +57 -0
- data/test/helper.rb +10 -0
- data/test/test_my_zeo.rb +7 -0
- metadata +105 -0
data/.document
ADDED
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 Haris Amin
|
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.rdoc
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
= my_zeo
|
2
|
+
|
3
|
+
Description goes here.
|
4
|
+
|
5
|
+
== Note on Patches/Pull Requests
|
6
|
+
|
7
|
+
* Fork the project.
|
8
|
+
* Make your feature addition or bug fix.
|
9
|
+
* Add tests for it. This is important so I don't break it in a
|
10
|
+
future version unintentionally.
|
11
|
+
* Commit, do not mess with rakefile, version, or history.
|
12
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
13
|
+
* Send me a pull request. Bonus points for topic branches.
|
14
|
+
|
15
|
+
== Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2010 Haris Amin. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "my_zeo"
|
8
|
+
gem.summary = %Q{A simple mapping to MyZeo API calls (http://mysleep.myzeo.com/api/api.shtml)}
|
9
|
+
gem.description = %Q{A simple mapping to MyZeo API calls (http://mysleep.myzeo.com/api/api.shtml)}
|
10
|
+
gem.email = "aminharis7@gmail.com"
|
11
|
+
gem.homepage = "http://github.com/hamin/my_zeo"
|
12
|
+
gem.authors = ["Haris Amin"]
|
13
|
+
gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
|
14
|
+
gem.add_dependency 'httparty'
|
15
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
|
+
end
|
17
|
+
Jeweler::GemcutterTasks.new
|
18
|
+
rescue LoadError
|
19
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
20
|
+
end
|
21
|
+
|
22
|
+
require 'rake/testtask'
|
23
|
+
Rake::TestTask.new(:test) do |test|
|
24
|
+
test.libs << 'lib' << 'test'
|
25
|
+
test.pattern = 'test/**/test_*.rb'
|
26
|
+
test.verbose = true
|
27
|
+
end
|
28
|
+
|
29
|
+
begin
|
30
|
+
require 'rcov/rcovtask'
|
31
|
+
Rcov::RcovTask.new do |test|
|
32
|
+
test.libs << 'test'
|
33
|
+
test.pattern = 'test/**/test_*.rb'
|
34
|
+
test.verbose = true
|
35
|
+
end
|
36
|
+
rescue LoadError
|
37
|
+
task :rcov do
|
38
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
task :test => :check_dependencies
|
43
|
+
|
44
|
+
task :default => :test
|
45
|
+
|
46
|
+
require 'rake/rdoctask'
|
47
|
+
Rake::RDocTask.new do |rdoc|
|
48
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
49
|
+
|
50
|
+
rdoc.rdoc_dir = 'rdoc'
|
51
|
+
rdoc.title = "my_zeo #{version}"
|
52
|
+
rdoc.rdoc_files.include('README*')
|
53
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
54
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.2.0
|
data/lib/my_zeo.rb
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
class MyZeo
|
2
|
+
require 'httparty'
|
3
|
+
include HTTParty
|
4
|
+
|
5
|
+
base_uri "https://api.myzeo.com:8443/zeows/api/v1/sleeperService"
|
6
|
+
|
7
|
+
attr_reader :api_key
|
8
|
+
|
9
|
+
def initialize(api_key,opts={})
|
10
|
+
@api_key = api_key
|
11
|
+
MyZeo.basic_auth opts[:login], opts[:password] if (opts[:login] && opts[:password])
|
12
|
+
MyZeo.base_uri opts[:base_url] if opts[:base_url]
|
13
|
+
end
|
14
|
+
|
15
|
+
def get_overall_average_zq_score
|
16
|
+
MyZeo.get("/getOverallAverageZQScore?key=#{@api_key}").parsed_response
|
17
|
+
end
|
18
|
+
|
19
|
+
def get_overall_average_day_feel_score
|
20
|
+
MyZeo.get("/getOverallAverageDayFeelScore?key=#{@api_key}").parsed_response
|
21
|
+
end
|
22
|
+
|
23
|
+
def get_overall_average_morning_feel_score
|
24
|
+
MyZeo.get("/getOverallAverageMorningFeelScore?key=#{@api_key}").parsed_response
|
25
|
+
end
|
26
|
+
|
27
|
+
def get_overall_average_sleep_stealer_score
|
28
|
+
MyZeo.get("/getOverallAverageSleepStealerScore?key=#{@api_key}").parsed_response
|
29
|
+
end
|
30
|
+
|
31
|
+
def get_all_dates_with_sleep_data
|
32
|
+
MyZeo.get("/getAllDatesWithSleepData?key=#{@api_key}").parsed_response
|
33
|
+
end
|
34
|
+
|
35
|
+
def get_dates_with_sleep_data_in_range(opts={})
|
36
|
+
date_from = opts[:date_from] ? opts[:date_from] : ""
|
37
|
+
date_to = opts[:date_to] ? opts[:date_to] : ""
|
38
|
+
MyZeo.get("/getOverallAverageZQScore?key=#{@api_key}", :query => {:dateFrom => date_from, :dateTo => date_to}).parsed_response
|
39
|
+
end
|
40
|
+
|
41
|
+
def get_sleep_stats_for_date(opts={})
|
42
|
+
date = opts[:date] ? opts[:date] : ""
|
43
|
+
MyZeo.get("/getSleepStatsForDate?key=#{@api_key}", :query => {:date => date }).parsed_response
|
44
|
+
end
|
45
|
+
|
46
|
+
def get_sleep_record_for_date(opts={})
|
47
|
+
date = opts[:date] ? opts[:date] : ""
|
48
|
+
MyZeo.get("/getSleepRecordForDate?key=#{@api_key}", :query => {:date => date }).parsed_response
|
49
|
+
end
|
50
|
+
|
51
|
+
def get_previous_sleep_stats(opts={})
|
52
|
+
date = opts[:date] ? opts[:date] : ""
|
53
|
+
MyZeo.get("/getPreviousSleepStats?key=#{@api_key}", :query => {:date => date }).parsed_response
|
54
|
+
end
|
55
|
+
|
56
|
+
def get_previous_sleep_record(opts={})
|
57
|
+
date = opts[:date] ? opts[:date] : ""
|
58
|
+
MyZeo.get("/getPreviousSleepRecord?key=#{@api_key}", :query => {:date => date }).parsed_response
|
59
|
+
end
|
60
|
+
|
61
|
+
def get_next_sleep_stats(opts={})
|
62
|
+
date = opts[:date] ? opts[:date] : ""
|
63
|
+
MyZeo.get("/getNextSleepStats?key=#{@api_key}", :query => {:date => date }).parsed_response
|
64
|
+
end
|
65
|
+
|
66
|
+
def get_next_sleep_record(opts={})
|
67
|
+
date = opts[:date] ? opts[:date] : ""
|
68
|
+
MyZeo.get("/getNextSleepRecord?key=#{@api_key}", :query => {:date => date }).parsed_response
|
69
|
+
end
|
70
|
+
|
71
|
+
def get_earliest_sleep_stats
|
72
|
+
MyZeo.get("/getEarliestSleepStats?key=#{@api_key}").parsed_response
|
73
|
+
end
|
74
|
+
|
75
|
+
def get_earliest_sleep_record
|
76
|
+
MyZeo.get("/getEarliestSleepRecord?key=#{@api_key}").parsed_response
|
77
|
+
end
|
78
|
+
|
79
|
+
def get_latest_sleep_stats
|
80
|
+
MyZeo.get("/getLatestSleepStats?key=#{@api_key}").parsed_response
|
81
|
+
end
|
82
|
+
|
83
|
+
def get_latest_sleep_record
|
84
|
+
MyZeo.get("/getLatestSleepRecord?key=#{@api_key}").parsed_response
|
85
|
+
end
|
86
|
+
|
87
|
+
def logout
|
88
|
+
MyZeo.get("/logout?key=#{@api_key}").parsed_response
|
89
|
+
end
|
90
|
+
|
91
|
+
|
92
|
+
end
|
data/my_zeo.gemspec
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{my_zeo}
|
8
|
+
s.version = "0.2.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Haris Amin"]
|
12
|
+
s.date = %q{2010-11-13}
|
13
|
+
s.description = %q{A simple mapping to MyZeo API calls (http://mysleep.myzeo.com/api/api.shtml)}
|
14
|
+
s.email = %q{aminharis7@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".gitignore",
|
22
|
+
"LICENSE",
|
23
|
+
"README.rdoc",
|
24
|
+
"Rakefile",
|
25
|
+
"VERSION",
|
26
|
+
"lib/my_zeo.rb",
|
27
|
+
"my_zeo.gemspec",
|
28
|
+
"test/helper.rb",
|
29
|
+
"test/test_my_zeo.rb"
|
30
|
+
]
|
31
|
+
s.homepage = %q{http://github.com/hamin/my_zeo}
|
32
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
33
|
+
s.require_paths = ["lib"]
|
34
|
+
s.rubygems_version = %q{1.3.7}
|
35
|
+
s.summary = %q{A simple mapping to MyZeo API calls (http://mysleep.myzeo.com/api/api.shtml)}
|
36
|
+
s.test_files = [
|
37
|
+
"test/helper.rb",
|
38
|
+
"test/test_my_zeo.rb"
|
39
|
+
]
|
40
|
+
|
41
|
+
if s.respond_to? :specification_version then
|
42
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
43
|
+
s.specification_version = 3
|
44
|
+
|
45
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
46
|
+
s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
47
|
+
s.add_runtime_dependency(%q<httparty>, [">= 0"])
|
48
|
+
else
|
49
|
+
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
50
|
+
s.add_dependency(%q<httparty>, [">= 0"])
|
51
|
+
end
|
52
|
+
else
|
53
|
+
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
54
|
+
s.add_dependency(%q<httparty>, [">= 0"])
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
data/test/helper.rb
ADDED
data/test/test_my_zeo.rb
ADDED
metadata
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: my_zeo
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Haris Amin
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-11-13 00:00:00 -05:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: thoughtbot-shoulda
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
type: :development
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: httparty
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
version: "0"
|
47
|
+
type: :runtime
|
48
|
+
version_requirements: *id002
|
49
|
+
description: A simple mapping to MyZeo API calls (http://mysleep.myzeo.com/api/api.shtml)
|
50
|
+
email: aminharis7@gmail.com
|
51
|
+
executables: []
|
52
|
+
|
53
|
+
extensions: []
|
54
|
+
|
55
|
+
extra_rdoc_files:
|
56
|
+
- LICENSE
|
57
|
+
- README.rdoc
|
58
|
+
files:
|
59
|
+
- .document
|
60
|
+
- .gitignore
|
61
|
+
- LICENSE
|
62
|
+
- README.rdoc
|
63
|
+
- Rakefile
|
64
|
+
- VERSION
|
65
|
+
- lib/my_zeo.rb
|
66
|
+
- my_zeo.gemspec
|
67
|
+
- test/helper.rb
|
68
|
+
- test/test_my_zeo.rb
|
69
|
+
has_rdoc: true
|
70
|
+
homepage: http://github.com/hamin/my_zeo
|
71
|
+
licenses: []
|
72
|
+
|
73
|
+
post_install_message:
|
74
|
+
rdoc_options:
|
75
|
+
- --charset=UTF-8
|
76
|
+
require_paths:
|
77
|
+
- lib
|
78
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
79
|
+
none: false
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
hash: 3
|
84
|
+
segments:
|
85
|
+
- 0
|
86
|
+
version: "0"
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
hash: 3
|
93
|
+
segments:
|
94
|
+
- 0
|
95
|
+
version: "0"
|
96
|
+
requirements: []
|
97
|
+
|
98
|
+
rubyforge_project:
|
99
|
+
rubygems_version: 1.3.7
|
100
|
+
signing_key:
|
101
|
+
specification_version: 3
|
102
|
+
summary: A simple mapping to MyZeo API calls (http://mysleep.myzeo.com/api/api.shtml)
|
103
|
+
test_files:
|
104
|
+
- test/helper.rb
|
105
|
+
- test/test_my_zeo.rb
|