fitbit-to-graphite 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -29,6 +29,7 @@ Specific options:
29
29
  -h, --host=HOST The hostname or ip of the host graphite is running on
30
30
  -p, --port=PORT The port graphite is listening on
31
31
  -n, --namespace=NAMESPACE The graphite metric path to store data in
32
+ -d, --date=NAMESPACE the date to get data for in the format YYYY-MM-DD
32
33
 
33
34
  Common options:
34
35
  --help Show this message
@@ -11,7 +11,7 @@ require 'choice'
11
11
  require 'fitgem'
12
12
  require 'tzinfo'
13
13
 
14
- PROGRAM_VERSION = "0.1.2"
14
+ PROGRAM_VERSION = "0.2.0"
15
15
  SLEEP_STATE_TYPES = ['deep', 'light', 'awake']
16
16
  # this is just to be compatible with jawbone data
17
17
  JAWBONE_SLEEP_STATES = { 'awake' => 1, 'light' => 2, 'deep' => 3 }
@@ -41,6 +41,12 @@ Choice.options do
41
41
  desc 'The graphite metric path to store data in'
42
42
  end
43
43
 
44
+ option :date do
45
+ short '-d'
46
+ long '--date=NAMESPACE'
47
+ desc 'the date to get data for in the format YYYY-MM-DD'
48
+ end
49
+
44
50
  separator ''
45
51
  separator 'Common options: '
46
52
 
@@ -126,7 +132,11 @@ def extract_data(client, &block)
126
132
  user_info = client.user_info
127
133
  user_timezone_name = user_info['user']['timezone']
128
134
  user_timezone = offset = TZInfo::Timezone.get(user_timezone_name).current_period.utc_total_offset / (60*60)
129
- today = Date.today
135
+ if Choice[:date]
136
+ today = date = Date.strptime(Choice[:date],"%Y-%m-%d")
137
+ else
138
+ today = Date.today
139
+ end
130
140
  all_sleep_data = client.sleep_on_date(today)['sleep']
131
141
  if all_sleep_data.nil?
132
142
  puts "API rate limit potentially exceeded."
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = 'fitbit-to-graphite'
3
- gem.version = '0.1.2'
3
+ gem.version = '0.2.0'
4
4
  gem.authors = ["Daniel Schauenberg"]
5
5
  gem.email = 'd@unwiredcouch.com'
6
6
  gem.homepage = 'https://github.com/mrtazz/fitbit-to-graphite'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fitbit-to-graphite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: