humanapi 0.0.1

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ef774d10fb83d4b24062051a4adec467d629f342
4
+ data.tar.gz: 8370cd073899c8114a92d8b876dbdccaf44883dd
5
+ SHA512:
6
+ metadata.gz: 7c98e7a07fc6e88c1341addacdf07f9fa84a5ef7b9835366ae8f58cfc3b0065dad1748c088a43d51d21d125fb82975cdd53aa4abc2840acdd8fead49efa16ff9
7
+ data.tar.gz: 1ec174e00b454b61eb57b68e8efbcc189bc98fa57526c3fec6b544c81165ee580989d343ccfd7590a90e756b55d19c735b84b558640e1d6cfd243101b325ee34
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in humanapi.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Alex MacCaw
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,57 @@
1
+ # HumanAPI
2
+
3
+ A Ruby client to [HumanAPI](http://humanapi.co).
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'humanapi'
10
+
11
+ ## Usage
12
+
13
+ First get a user's OAuth token, perhaps through [omniauth-humanapi](https://github.com/maccman/omniauth-humanapi).
14
+
15
+ You can pass the token through to every API method call, or set it globally:
16
+
17
+ HumanAPI::Human.token = token
18
+
19
+ ## Methods
20
+
21
+ Here are all the supported API methods. For more information, please see the [HumanAPI docs](http://humanapi.co/explorer).
22
+
23
+ HumanAPI::Human.profile
24
+ HumanAPI::Human.summary
25
+ HumanAPI::Human.all_activity
26
+ HumanAPI::Human.activity
27
+ HumanAPI::Human.daily_activity
28
+ HumanAPI::Human.series_activity
29
+ HumanAPI::Human.blood_glucose
30
+ HumanAPI::Human.all_blood_glucose
31
+ HumanAPI::Human.daily_blood_glucose
32
+ HumanAPI::Human.blood_pressure
33
+ HumanAPI::Human.all_blood_pressures
34
+ HumanAPI::Human.daily_blood_pressure
35
+ HumanAPI::Human.bmi
36
+ HumanAPI::Human.all_bmis
37
+ HumanAPI::Human.daily_bmi
38
+ HumanAPI::Human.body_fat
39
+ HumanAPI::Human.all_body_fats
40
+ HumanAPI::Human.daily_body_fat
41
+ HumanAPI::Human.genetic_traits
42
+ HumanAPI::Human.heart_rate
43
+ HumanAPI::Human.all_heart_rates
44
+ HumanAPI::Human.daily_heart_rate
45
+ HumanAPI::Human.height
46
+ HumanAPI::Human.all_heights
47
+ HumanAPI::Human.daily_height
48
+ HumanAPI::Human.all_locations
49
+ HumanAPI::Human.daily_location
50
+ HumanAPI::Human.sleep
51
+ HumanAPI::Human.all_sleep
52
+ HumanAPI::Human.daily_sleep
53
+ HumanAPI::Human.weight
54
+ HumanAPI::Human.all_weight
55
+ HumanAPI::Human.daily_weight
56
+
57
+ ## Contributing
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'humanapi/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "humanapi"
8
+ spec.version = HumanAPI::VERSION
9
+ spec.authors = ["Alex MacCaw"]
10
+ spec.email = ["alex@alexmaccaw.com"]
11
+ spec.description = %q{API client for HumanAPI}
12
+ spec.summary = %q{API client for HumanAPI}
13
+ spec.homepage = "https://github.com/maccman/humanapi"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "nestful", "~> 1.0.4"
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.3"
24
+ spec.add_development_dependency "rake"
25
+ end
@@ -0,0 +1,6 @@
1
+ require "nestful"
2
+ require "humanapi/version"
3
+
4
+ module HumanAPI
5
+ autoload :Human, 'humanapi/human'
6
+ end
@@ -0,0 +1,166 @@
1
+ module HumanAPI
2
+ class Human < Nestful::Resource
3
+ endpoint 'https://api.humanapi.co'
4
+ path '/v1/human'
5
+
6
+ def self.token=(value)
7
+ options[:access_token] = value
8
+ end
9
+
10
+ # Profile
11
+
12
+ def self.profile(token = nil)
13
+ get('profile', :access_token => token)
14
+ end
15
+
16
+ def self.summary(token = nil)
17
+ get('', :access_token => token)
18
+ end
19
+
20
+ # Activity
21
+
22
+ def self.all_activity(token = nil)
23
+ get("activity", :access_token => token)
24
+ end
25
+
26
+ def self.activity(id, token = nil)
27
+ get("activity/#{id}", :access_token => token)
28
+ end
29
+
30
+ def self.daily_activity(date, token = nil)
31
+ get("activity/daily/#{date.strftime('%F')}", :access_token => token)
32
+ end
33
+
34
+ def self.series_activity(date, token = nil)
35
+ get("activity/series/#{date.strftime('%F')}", :access_token => token)
36
+ end
37
+
38
+ # Blood Glucose
39
+
40
+ def self.blood_glucose(id, token = nil)
41
+ get("blood_glucose/#{id}", :access_token => token)
42
+ end
43
+
44
+ def self.all_blood_glucose(token = nil)
45
+ get('blood_glucose', :access_token => token)
46
+ end
47
+
48
+ def self.daily_blood_glucose(date, token = nil)
49
+ get("blood_glucose/daily/#{date.strftime('%F')}", :access_token => token)
50
+ end
51
+
52
+ # Blood presure
53
+
54
+ def self.blood_pressure(id, token = nil)
55
+ get("blood_pressure/#{id}", :access_token => token)
56
+ end
57
+
58
+ def self.all_blood_pressures(token = nil)
59
+ get('blood_pressure', :access_token => token)
60
+ end
61
+
62
+ def self.daily_blood_pressure(date, token = nil)
63
+ get("blood_pressure/daily/#{date.strftime('%F')}", :access_token => token)
64
+ end
65
+
66
+ # BMI
67
+
68
+ def self.bmi(id, token = nil)
69
+ get("bmi/#{id}", :access_token => token)
70
+ end
71
+
72
+ def self.all_bmis(token = nil)
73
+ get('bmi', :access_token => token)
74
+ end
75
+
76
+ def self.daily_bmi(date, token = nil)
77
+ get("bmi/daily/#{date.strftime('%F')}", :access_token => token)
78
+ end
79
+
80
+ # Body fat
81
+
82
+ def self.body_fat(id, token = nil)
83
+ get("body_fat/#{id}", :access_token => token)
84
+ end
85
+
86
+ def self.all_body_fats(token = nil)
87
+ get('body_fat', :access_token => token)
88
+ end
89
+
90
+ def self.daily_body_fat(date, token = nil)
91
+ get("body_fat/daily/#{date.strftime('%F')}", :access_token => token)
92
+ end
93
+
94
+ # Genetics
95
+
96
+ def self.genetic_traits(token = nil)
97
+ get('genetic/traits', :access_token => token)
98
+ end
99
+
100
+ # Heart rate
101
+
102
+ def self.heart_rate(id, token = nil)
103
+ get("heart_rate/#{id}", :access_token => token)
104
+ end
105
+
106
+ def self.all_heart_rates(token = nil)
107
+ get('heart_rate', :access_token => token)
108
+ end
109
+
110
+ def self.daily_heart_rate(date, token = nil)
111
+ get("heart_rate/daily/#{date.strftime('%F')}", :access_token => token)
112
+ end
113
+
114
+ # Height
115
+
116
+ def self.height(id, token = nil)
117
+ get("height/#{id}", :access_token => token)
118
+ end
119
+
120
+ def self.all_heights(token = nil)
121
+ get('height', :access_token => token)
122
+ end
123
+
124
+ def self.daily_height(date, token = nil)
125
+ get("height/daily/#{date.strftime('%F')}", :access_token => token)
126
+ end
127
+
128
+ # Location
129
+
130
+ def self.all_locations(token = nil)
131
+ get('location', :access_token => token)
132
+ end
133
+
134
+ def self.daily_location(date, token = nil)
135
+ get("location/daily/#{date.strftime('%F')}", :access_token => token)
136
+ end
137
+
138
+ # Sleep
139
+
140
+ def self.sleep(id, token = nil)
141
+ get("sleep/#{id}", :access_token => token)
142
+ end
143
+
144
+ def self.all_sleep(token = nil)
145
+ get('sleep', :access_token => token)
146
+ end
147
+
148
+ def self.daily_sleep(date, token = nil)
149
+ get("sleep/daily/#{date.strftime('%F')}", :access_token => token)
150
+ end
151
+
152
+ # Weight
153
+
154
+ def self.weight(id, token = nil)
155
+ get("weight/#{id}", :access_token => token)
156
+ end
157
+
158
+ def self.all_weight(token = nil)
159
+ get('weight', :access_token => token)
160
+ end
161
+
162
+ def self.daily_weight(date, token = nil)
163
+ get("weight/daily/#{date.strftime('%F')}", :access_token => token)
164
+ end
165
+ end
166
+ end
@@ -0,0 +1,3 @@
1
+ module HumanAPI
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: humanapi
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Alex MacCaw
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-07-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: nestful
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 1.0.4
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 1.0.4
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: API client for HumanAPI
56
+ email:
57
+ - alex@alexmaccaw.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - .gitignore
63
+ - Gemfile
64
+ - LICENSE.txt
65
+ - README.md
66
+ - Rakefile
67
+ - humanapi.gemspec
68
+ - lib/humanapi.rb
69
+ - lib/humanapi/human.rb
70
+ - lib/humanapi/version.rb
71
+ homepage: https://github.com/maccman/humanapi
72
+ licenses:
73
+ - MIT
74
+ metadata: {}
75
+ post_install_message:
76
+ rdoc_options: []
77
+ require_paths:
78
+ - lib
79
+ required_ruby_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ required_rubygems_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ requirements: []
90
+ rubyforge_project:
91
+ rubygems_version: 2.0.3
92
+ signing_key:
93
+ specification_version: 4
94
+ summary: API client for HumanAPI
95
+ test_files: []