fitbit_client 0.1.3 → 0.1.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 31aaaf7d7494f4485014f459a94bd8118b1dea74
4
- data.tar.gz: 84178d2b7177c66cbe797b3dd530c3cf0aaf79c6
3
+ metadata.gz: e45bd29c4662b61ee8ec77332d5eebcda95e0577
4
+ data.tar.gz: bdd1b83f3f8ae401f2935f9b619a3d7ab058b0ac
5
5
  SHA512:
6
- metadata.gz: 8a5c60a43b3204815ceaab911d029c25d9ab19e1b0bccb3944dc4dc74f0e71bb45b33da73534bc365a2ddf6c7d7fa25da75a09723527dc37b5dc3b91d9426aad
7
- data.tar.gz: 0427bdadf93279d68070e4b6e0624ee6797ae7f81d4e414482611f2a8a289b016a108f4cb11016795b58b01c2914463a1c586ea49d1834ec2233b8cb7b2cbf63
6
+ metadata.gz: 82aeeba5a60f2ebeab6e630205176bb700799ab8bbdf73a3a90ec41b10953acf4006c322cb67c631e0547e4c524cf3497420b82b7e11e1df8adb85b04957db08
7
+ data.tar.gz: 92d198027cc9140db0a2a1e1b6214066f5a031773e24497e38de50492927979e81a4abb0045791fbf2be32f6aa3d52da39f67df3d45bed88c4846b3290a0b219
@@ -37,7 +37,7 @@ module FitbitClient
37
37
  attr_accessor :default_language, :default_locale
38
38
 
39
39
  def debug_mode!(enable)
40
- ENV['OAUTH_DEBUG'] = enable ? 'true' : 'false'
40
+ ENV['OAUTH_DEBUG'] = enable ? 'true' : nil
41
41
  end
42
42
  end
43
43
 
@@ -11,8 +11,9 @@ module FitbitClient
11
11
  #
12
12
  # Body weight log entries in response are sorted exactly the same as they
13
13
  # are presented on the Fitbit website.
14
- def weight_logs(date, _options = {})
15
- get_json(path_user_version("/body/log/weight/date/#{iso_date(date)}"))
14
+ def weight_logs(date, period_or_end_date = nil, options = {})
15
+ path = body_and_weight_path_for_period('weight', date, period_or_end_date)
16
+ get_json(path_user_version(path, options))
16
17
  end
17
18
 
18
19
  # The Log Weight API creates log entry for a body weight using units in
@@ -98,12 +99,7 @@ module FitbitClient
98
99
  #
99
100
  # <b>Note:</b> The range should not be longer than 31 days.
100
101
  def body_fat_logs(date, period_or_end_date = nil, options = {})
101
- if period_or_end_date
102
- end_limit = period_or_date_param(period_or_end_date)
103
- path = "/body/log/fat/date/#{iso_date(date)}/#{end_limit}"
104
- else
105
- path = "/body/log/fat/date/#{iso_date(date)}"
106
- end
102
+ path = body_and_weight_path_for_period('fat', date, period_or_end_date)
107
103
  get_json(path_user_version(path, options))
108
104
  end
109
105
 
@@ -140,6 +136,15 @@ module FitbitClient
140
136
  params['weight'] = weight if weight
141
137
  params
142
138
  end
139
+
140
+ def body_and_weight_path_for_period(type, date, period_or_end_date)
141
+ if period_or_end_date
142
+ end_limit = period_or_date_param(period_or_end_date)
143
+ "/body/log/#{type}/date/#{iso_date(date)}/#{end_limit}"
144
+ else
145
+ "/body/log/#{type}/date/#{iso_date(date)}"
146
+ end
147
+ end
143
148
  end
144
149
  end
145
150
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FitbitClient
4
- VERSION = '0.1.3'
4
+ VERSION = '0.1.4'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fitbit_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michel Ocon
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-07-13 00:00:00.000000000 Z
11
+ date: 2017-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry