fitgem_oauth2 1.2.0 → 3.0.0
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 +5 -5
- data/fitgem_oauth2.gemspec +6 -6
- data/lib/fitgem_oauth2.rb +3 -1
- data/lib/fitgem_oauth2/activity.rb +25 -19
- data/lib/fitgem_oauth2/body_measurements.rb +12 -20
- data/lib/fitgem_oauth2/client.rb +32 -31
- data/lib/fitgem_oauth2/devices.rb +2 -1
- data/lib/fitgem_oauth2/errors.rb +5 -1
- data/lib/fitgem_oauth2/food.rb +9 -177
- data/lib/fitgem_oauth2/food/collection.rb +53 -0
- data/lib/fitgem_oauth2/food/metadata.rb +65 -0
- data/lib/fitgem_oauth2/food/series.rb +29 -0
- data/lib/fitgem_oauth2/friends.rb +2 -0
- data/lib/fitgem_oauth2/heartrate.rb +7 -41
- data/lib/fitgem_oauth2/sleep.rb +11 -9
- data/lib/fitgem_oauth2/subscriptions.rb +7 -6
- data/lib/fitgem_oauth2/users.rb +3 -1
- data/lib/fitgem_oauth2/utils.rb +12 -16
- data/lib/fitgem_oauth2/version.rb +3 -1
- metadata +20 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a4195903df9731ae5176aa7577c7320322e4adbaa9f7ac68234a36716a536c85
|
4
|
+
data.tar.gz: 28b46788c80bd68e8a16c14caadbbe2d9a961640c67fb3a1011c6fc7977db51b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e44efb1b76d77d3bdf42d44709ec7c3683e95060e3387cb896ac9ca9317920880bd530421418cde9995cbd6a08e756828c07bc244f2a5c5dc3cc33b10ff91c8e
|
7
|
+
data.tar.gz: c012c4d7f421ddfd44ac782de4294bc5ea94d96f154ae7b1f1dc1dedae5db07ad2821f9576a2bea6af7667f995d9e507db94c47808393e0cef643997399128dc
|
data/fitgem_oauth2.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
$LOAD_PATH.unshift File.expand_path('lib', __dir__)
|
4
4
|
require 'fitgem_oauth2/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
@@ -10,13 +10,13 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.description = 'This gem allows requesting data from Fitbit API using OAuth2'
|
11
11
|
s.authors = ['Ankit Gupta']
|
12
12
|
s.email = 'ankit.gupta2801@gmail.com'
|
13
|
-
s.files = %w
|
13
|
+
s.files = %w[fitgem_oauth2.gemspec] + `git ls-files -z`.split("\x0").select {|f| f.start_with?('lib/') }
|
14
14
|
s.homepage = 'http://rubygems.org/gems/fitgem_oauth2'
|
15
15
|
s.license = 'MIT'
|
16
16
|
|
17
|
-
s.add_runtime_dependency 'faraday', '~> 0.
|
17
|
+
s.add_runtime_dependency 'faraday', '~> 1.0.1'
|
18
18
|
|
19
|
-
s.add_development_dependency '
|
19
|
+
s.add_development_dependency 'factory_bot', '~> 4.5'
|
20
|
+
s.add_development_dependency 'rake', '~> 13.0.1'
|
20
21
|
s.add_development_dependency 'rspec', '~> 3.4'
|
21
|
-
s.add_development_dependency 'factory_girl', '~> 4.5'
|
22
22
|
end
|
data/lib/fitgem_oauth2.rb
CHANGED
@@ -1,9 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module FitgemOauth2
|
2
4
|
class Client
|
5
|
+
ACTIVITY_RESOURCES = %w[
|
6
|
+
calories caloriesBMR steps distance floors elevation minutesSedentary
|
7
|
+
minutesLightlyActive minutesFairlyActive minutesVeryActive
|
8
|
+
activityCaloriestracker/calories tracker/steps tracker/distance
|
9
|
+
tracker/floors tracker/elevation tracker/minutesSedentary
|
10
|
+
tracker/minutesLightlyActive tracker/minutesFairlyActive
|
11
|
+
tracker/minutesVeryActive tracker/activityCalories
|
12
|
+
].freeze
|
3
13
|
|
4
|
-
|
5
|
-
|
6
|
-
ACTIVITY_PERIODS = %w(1d 7d 30d 1w 1m 3m 6m 1y max)
|
14
|
+
ACTIVITY_PERIODS = %w[1d 7d 30d 1w 1m 3m 6m 1y max].freeze
|
7
15
|
|
8
16
|
# retrieves daily activity summary for a date
|
9
17
|
# @param date the date for which the summary is retrieved
|
@@ -22,14 +30,11 @@ module FitgemOauth2
|
|
22
30
|
# @param period the period starting from start_date for which the series needs to be retrieved. If specifying period,
|
23
31
|
# do not use end_date
|
24
32
|
def activity_time_series(resource: nil, start_date: nil, end_date: nil, period: nil)
|
25
|
-
|
26
33
|
unless resource && ACTIVITY_RESOURCES.include?(resource)
|
27
34
|
raise FitgemOauth2::InvalidArgumentError, "Invalid resource: #{resource}. Valid resources are #{ACTIVITY_RESOURCES}."
|
28
35
|
end
|
29
36
|
|
30
|
-
unless start_date
|
31
|
-
raise FitgemOauth2::InvalidArgumentError, 'Start date must be specified.'
|
32
|
-
end
|
37
|
+
raise FitgemOauth2::InvalidArgumentError, 'Start date must be specified.' unless start_date
|
33
38
|
|
34
39
|
if period && end_date
|
35
40
|
raise FitgemOauth2::InvalidArgumentError, 'Both period and end_date are specified. Please specify only one.'
|
@@ -71,22 +76,22 @@ module FitgemOauth2
|
|
71
76
|
|
72
77
|
end_date ||= '1d'
|
73
78
|
|
74
|
-
unless detail_level && %w
|
79
|
+
unless detail_level && %w[1min 15min].include?(detail_level)
|
75
80
|
raise FitgemOauth2::InvalidArgumentError,
|
76
81
|
'Must specify the data resolution to fetch intraday time series data for.'\
|
77
82
|
' One of (\"1d\" or \"15min\") is required.'
|
78
83
|
end
|
79
84
|
|
80
85
|
resource_path = [
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
86
|
+
'user', @user_id,
|
87
|
+
'activities', resource,
|
88
|
+
'date', format_date(start_date),
|
89
|
+
end_date, detail_level
|
85
90
|
].join('/')
|
86
91
|
|
87
92
|
if start_time || end_time
|
88
93
|
resource_path =
|
89
|
-
|
94
|
+
[resource_path, 'time', format_time(start_time), format_time(end_time)].join('/')
|
90
95
|
end
|
91
96
|
get_call("#{resource_path}.json")
|
92
97
|
end
|
@@ -111,12 +116,12 @@ module FitgemOauth2
|
|
111
116
|
# retrieves activity list for the user
|
112
117
|
def activity_list(date, sort, limit)
|
113
118
|
date_param = format_date(date)
|
114
|
-
if sort ==
|
119
|
+
if sort == 'asc'
|
115
120
|
date_param = "afterDate=#{date_param}"
|
116
|
-
elsif sort ==
|
121
|
+
elsif sort == 'desc'
|
117
122
|
date_param = "beforeDate=#{date_param}"
|
118
123
|
else
|
119
|
-
raise FitgemOauth2::InvalidArgumentError,
|
124
|
+
raise FitgemOauth2::InvalidArgumentError, 'sort can either be asc or desc'
|
120
125
|
end
|
121
126
|
get_call("user/#{user_id}/activities/list.json?offset=0&limit=#{limit}&sort=#{sort}&#{date_param}")
|
122
127
|
end
|
@@ -126,7 +131,6 @@ module FitgemOauth2
|
|
126
131
|
get_call("user/#{user_id}/activities/#{id}.tcx")
|
127
132
|
end
|
128
133
|
|
129
|
-
|
130
134
|
# ======================================
|
131
135
|
# Activity Types
|
132
136
|
# ======================================
|
@@ -178,9 +182,10 @@ module FitgemOauth2
|
|
178
182
|
# retrieve activity goals for a period
|
179
183
|
# @period the period for which the goals need to be retrieved. either 'weekly' or 'daily'
|
180
184
|
def goals(period)
|
181
|
-
unless period && %w
|
185
|
+
unless period && %w[daily weekly].include?(period)
|
182
186
|
raise FitgemOauth2::InvalidArgumentError, "Goal period should either be 'daily' or 'weekly'"
|
183
187
|
end
|
188
|
+
|
184
189
|
get_call("user/#{user_id}/activities/goals/#{period}.json")
|
185
190
|
end
|
186
191
|
|
@@ -188,9 +193,10 @@ module FitgemOauth2
|
|
188
193
|
# @param period period for the goal ('weekly' or 'daily')
|
189
194
|
# @param params the POST params for the request. Refer to Fitbit documentation for accepted format
|
190
195
|
def update_activity_goals(period, params)
|
191
|
-
unless period && %w
|
196
|
+
unless period && %w[daily weekly].include?(period)
|
192
197
|
raise FitgemOauth2::InvalidArgumentError, "Goal period should either be 'daily' or 'weekly'"
|
193
198
|
end
|
199
|
+
|
194
200
|
post_call("user/#{user_id}/activities/goals/#{period}.json", params)
|
195
201
|
end
|
196
202
|
|
@@ -1,9 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module FitgemOauth2
|
2
4
|
class Client
|
3
|
-
FAT_PERIODS = %w
|
4
|
-
WEIGHT_PERIODS = %w
|
5
|
-
BODY_GOALS = %w
|
6
|
-
BODY_TIME_SERIES_PERIODS = %w
|
5
|
+
FAT_PERIODS = %w[1d 7d 1w 1m].freeze
|
6
|
+
WEIGHT_PERIODS = %w[1d 7d 30d 1w 1m].freeze
|
7
|
+
BODY_GOALS = %w[fat weight].freeze
|
8
|
+
BODY_TIME_SERIES_PERIODS = %w[1d 7d 30d 1w 1m 3m 6m 1y max].freeze
|
7
9
|
|
8
10
|
# ======================================
|
9
11
|
# Boday Fat
|
@@ -15,13 +17,10 @@ module FitgemOauth2
|
|
15
17
|
# @param end_date (optional)end date for the logs
|
16
18
|
# @param period (optional) period for the logs
|
17
19
|
def body_fat_logs(start_date: nil, end_date: nil, period: nil)
|
18
|
-
unless start_date
|
19
|
-
|
20
|
-
end
|
20
|
+
raise FitgemOauth2::InvalidArgumentError, 'must specify start_date' unless start_date
|
21
|
+
|
21
22
|
url = ['user', user_id, 'body/log/fat/date', format_date(start_date)].join('/')
|
22
|
-
if end_date
|
23
|
-
url = [url, format_date(end_date)].join('/')
|
24
|
-
end
|
23
|
+
url = [url, format_date(end_date)].join('/') if end_date
|
25
24
|
|
26
25
|
if period
|
27
26
|
if FAT_PERIODS.include?(period)
|
@@ -31,7 +30,7 @@ module FitgemOauth2
|
|
31
30
|
end
|
32
31
|
end
|
33
32
|
|
34
|
-
url
|
33
|
+
url += '.json'
|
35
34
|
|
36
35
|
get_call(url)
|
37
36
|
end
|
@@ -48,7 +47,6 @@ module FitgemOauth2
|
|
48
47
|
delete_call("user/#{user_id}/body/log/fat/#{id}.json")
|
49
48
|
end
|
50
49
|
|
51
|
-
|
52
50
|
# ==================================
|
53
51
|
# Body Time Series
|
54
52
|
# ==================================
|
@@ -78,16 +76,13 @@ module FitgemOauth2
|
|
78
76
|
end
|
79
77
|
end
|
80
78
|
|
81
|
-
if end_date
|
82
|
-
second = format_date(end_date)
|
83
|
-
end
|
79
|
+
second = format_date(end_date) if end_date
|
84
80
|
|
85
81
|
url = [url, second].join('/')
|
86
82
|
|
87
83
|
get_call(url + '.json')
|
88
84
|
end
|
89
85
|
|
90
|
-
|
91
86
|
# ======================================
|
92
87
|
# Body Goals
|
93
88
|
# ======================================
|
@@ -123,9 +118,7 @@ module FitgemOauth2
|
|
123
118
|
# @param end_date (optional)end_date for the logs
|
124
119
|
# @param period (optional)period for the logs
|
125
120
|
def weight_logs(start_date: nil, end_date: nil, period: nil)
|
126
|
-
unless start_date
|
127
|
-
raise FitgemOauth2::InvalidArgumentError, 'start_date not specified.'
|
128
|
-
end
|
121
|
+
raise FitgemOauth2::InvalidArgumentError, 'start_date not specified.' unless start_date
|
129
122
|
|
130
123
|
if period && end_date
|
131
124
|
raise FitgemOauth2::InvalidArgumentError, 'both end_date and period specified. please provide only one.'
|
@@ -158,6 +151,5 @@ module FitgemOauth2
|
|
158
151
|
def delete_logged_weight(id)
|
159
152
|
delete_call("user/#{user_id}/body/log/weight/#{id}.json")
|
160
153
|
end
|
161
|
-
|
162
154
|
end
|
163
155
|
end
|
data/lib/fitgem_oauth2/client.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'fitgem_oauth2/activity.rb'
|
2
4
|
require 'fitgem_oauth2/body_measurements.rb'
|
3
5
|
require 'fitgem_oauth2/devices.rb'
|
@@ -16,7 +18,6 @@ require 'faraday'
|
|
16
18
|
|
17
19
|
module FitgemOauth2
|
18
20
|
class Client
|
19
|
-
|
20
21
|
DEFAULT_USER_ID = '-'
|
21
22
|
API_VERSION = '1'
|
22
23
|
|
@@ -27,10 +28,8 @@ module FitgemOauth2
|
|
27
28
|
attr_reader :unit_system
|
28
29
|
|
29
30
|
def initialize(opts)
|
30
|
-
missing = [
|
31
|
-
|
32
|
-
raise FitgemOauth2::InvalidArgumentError, "Missing required options: #{missing.join(',')}"
|
33
|
-
end
|
31
|
+
missing = %i[client_id client_secret token] - opts.keys
|
32
|
+
raise FitgemOauth2::InvalidArgumentError, "Missing required options: #{missing.join(',')}" unless missing.empty?
|
34
33
|
|
35
34
|
@client_id = opts[:client_id]
|
36
35
|
@client_secret = opts[:client_secret]
|
@@ -53,7 +52,7 @@ module FitgemOauth2
|
|
53
52
|
|
54
53
|
def get_call(url)
|
55
54
|
url = "#{API_VERSION}/#{url}"
|
56
|
-
response = connection.get(url) {
|
55
|
+
response = connection.get(url) {|request| set_headers(request) }
|
57
56
|
parse_response(response)
|
58
57
|
end
|
59
58
|
|
@@ -62,60 +61,62 @@ module FitgemOauth2
|
|
62
61
|
# date (Nov 5, 2017)
|
63
62
|
def get_call_1_2(url)
|
64
63
|
url = "1.2/#{url}"
|
65
|
-
response = connection.get(url) {|request| set_headers(request)}
|
64
|
+
response = connection.get(url) {|request| set_headers(request) }
|
66
65
|
parse_response(response)
|
67
66
|
end
|
68
67
|
|
69
|
-
def post_call(url, params
|
68
|
+
def post_call(url, params={})
|
70
69
|
url = "#{API_VERSION}/#{url}"
|
71
|
-
response = connection.post(url, params) {
|
70
|
+
response = connection.post(url, params) {|request| set_headers(request) }
|
72
71
|
parse_response(response)
|
73
72
|
end
|
74
73
|
|
75
|
-
def post_call_1_2(url, params
|
74
|
+
def post_call_1_2(url, params={})
|
76
75
|
url = "1.2/#{url}"
|
77
|
-
response = connection.post(url, params) {
|
76
|
+
response = connection.post(url, params) {|request| set_headers(request) }
|
78
77
|
parse_response(response)
|
79
78
|
end
|
80
79
|
|
81
80
|
def delete_call(url)
|
82
81
|
url = "#{API_VERSION}/#{url}"
|
83
|
-
response = connection.delete(url) {
|
82
|
+
response = connection.delete(url) {|request| set_headers(request) }
|
84
83
|
parse_response(response)
|
85
84
|
end
|
86
85
|
|
87
86
|
private
|
87
|
+
|
88
88
|
attr_reader :connection
|
89
89
|
|
90
90
|
def set_headers(request)
|
91
91
|
request.headers['Authorization'] = "Bearer #{token}"
|
92
92
|
request.headers['Content-Type'] = 'application/x-www-form-urlencoded'
|
93
|
-
request.headers['Accept-Language'] = unit_system unless unit_system
|
93
|
+
request.headers['Accept-Language'] = unit_system unless unit_system.nil?
|
94
94
|
end
|
95
95
|
|
96
96
|
def parse_response(response)
|
97
|
-
headers_to_keep = %w
|
97
|
+
headers_to_keep = %w[fitbit-rate-limit-limit fitbit-rate-limit-remaining fitbit-rate-limit-reset]
|
98
98
|
|
99
99
|
error_handler = {
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
100
|
+
200 => lambda {
|
101
|
+
body = JSON.parse(response.body)
|
102
|
+
body = {body: body} if body.is_a?(Array)
|
103
|
+
headers = response.headers.to_hash.keep_if do |k, _v|
|
104
|
+
headers_to_keep.include? k
|
105
|
+
end
|
106
|
+
body.merge!(headers)
|
107
|
+
},
|
108
|
+
201 => -> {},
|
109
|
+
204 => -> {},
|
110
|
+
400 => -> { raise FitgemOauth2::BadRequestError },
|
111
|
+
401 => -> { raise FitgemOauth2::UnauthorizedError },
|
112
|
+
403 => -> { raise FitgemOauth2::ForbiddenError },
|
113
|
+
404 => -> { raise FitgemOauth2::NotFoundError },
|
114
|
+
429 => -> { raise FitgemOauth2::ApiLimitError },
|
115
|
+
500..599 => -> { raise FitgemOauth2::ServerError }
|
115
116
|
}
|
116
117
|
|
117
|
-
fn = error_handler.
|
118
|
-
if fn
|
118
|
+
fn = error_handler.find {|k, _| k === response.status }
|
119
|
+
if fn.nil?
|
119
120
|
raise StandardError, "Unexpected response status #{response.status}"
|
120
121
|
else
|
121
122
|
fn.last.call
|
data/lib/fitgem_oauth2/errors.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module FitgemOauth2
|
2
4
|
class InvalidDateArgument < ArgumentError
|
3
5
|
end
|
4
6
|
|
5
7
|
class InvalidTimeArgument < ArgumentError
|
6
|
-
|
7
8
|
end
|
8
9
|
|
9
10
|
class InvalidArgumentError < ArgumentError
|
@@ -22,6 +23,9 @@ module FitgemOauth2
|
|
22
23
|
class NotFoundError < StandardError
|
23
24
|
end
|
24
25
|
|
26
|
+
class ApiLimitError < StandardError
|
27
|
+
end
|
28
|
+
|
25
29
|
class ServerError < StandardError
|
26
30
|
end
|
27
31
|
end
|
data/lib/fitgem_oauth2/food.rb
CHANGED
@@ -1,190 +1,22 @@
|
|
1
|
-
|
2
|
-
class Client
|
3
|
-
|
4
|
-
FOOD_SERIES_RESOURCES = %w( caloriesIn water )
|
5
|
-
FOOD_SERIES_PERIODS = %w( 1d 7d 30d 1w 1m 3m 6m 1y max )
|
6
|
-
|
7
|
-
|
8
|
-
# ==================================
|
9
|
-
# Food or Water Series
|
10
|
-
# ==================================
|
11
|
-
|
12
|
-
def food_series_for_date_range(start_date, end_date)
|
13
|
-
validate_start_date(start_date)
|
14
|
-
validate_end_date(end_date)
|
15
|
-
get_call(food_series_url(user_id, format_date(start_date), format_date(end_date)))
|
16
|
-
end
|
17
|
-
|
18
|
-
def food_series_for_period(start_date, period)
|
19
|
-
validate_start_date(start_date)
|
20
|
-
validate_food_series_period(period)
|
21
|
-
get_call(food_series_url(user_id, format_date(start_date), period))
|
22
|
-
end
|
23
|
-
|
24
|
-
def water_series_for_date_range(start_date, end_date)
|
25
|
-
validate_start_date(start_date)
|
26
|
-
validate_end_date(end_date)
|
27
|
-
get_call(water_series_url(user_id, format_date(start_date), format_date(end_date)))
|
28
|
-
end
|
29
|
-
|
30
|
-
def water_series_for_period(start_date, period)
|
31
|
-
validate_start_date(start_date)
|
32
|
-
validate_food_series_period(period)
|
33
|
-
get_call(water_series_url(user_id, format_date(start_date), period))
|
34
|
-
end
|
35
|
-
|
36
|
-
def food_series(resource: nil, start_date: nil, end_date: nil, period: nil)
|
37
|
-
warn '[DEPRECATED] use `food_series_for_date_range`, `food_series_for_period`, `water_series_for_date_range`, or `water_series_for_period` instead.'
|
38
|
-
unless FOOD_SERIES_RESOURCES.include?(resource)
|
39
|
-
raise FitgemOauth2::InvalidArgumentError, "Invalid resource: #{resource}. Specify a valid resource from #{FOOD_SERIES_RESOURCES}"
|
40
|
-
end
|
41
|
-
|
42
|
-
if end_date && period
|
43
|
-
raise FitgemOauth2::InvalidArgumentError, 'Provide only one of end_date and period.'
|
44
|
-
end
|
45
|
-
|
46
|
-
if !end_date && !period
|
47
|
-
raise FitgemOauth2::InvalidArgumentError, 'Provide at least one of end_date and period.'
|
48
|
-
end
|
49
|
-
|
50
|
-
url = ['user', user_id, 'foods/log', resource, 'date', start_date].join('/')
|
51
|
-
|
52
|
-
if period
|
53
|
-
unless FOOD_SERIES_PERIODS.include?(period)
|
54
|
-
raise FitgemOauth2::InvalidArgumentError, "Invalid period: #{period}. Specify a valid period from #{FOOD_SERIES_PERIODS}"
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
second = period || format_date(end_date)
|
59
|
-
url = [url, second].join('/')
|
60
|
-
|
61
|
-
get_call(url + '.json')
|
62
|
-
end
|
63
|
-
|
64
|
-
# ==================================
|
65
|
-
# Collection data
|
66
|
-
# ==================================
|
1
|
+
# frozen_string_literal: true
|
67
2
|
|
68
|
-
|
69
|
-
|
70
|
-
|
3
|
+
require 'fitgem_oauth2/food/collection.rb'
|
4
|
+
require 'fitgem_oauth2/food/series.rb'
|
5
|
+
require 'fitgem_oauth2/food/metadata.rb'
|
71
6
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
def water_logs(date)
|
77
|
-
get_call("user/#{user_id}/foods/log/water/date/#{format_date(date)}.json")
|
78
|
-
end
|
79
|
-
|
80
|
-
def water_goal
|
81
|
-
get_call("user/#{user_id}/foods/log/water/goal.json")
|
82
|
-
end
|
83
|
-
|
84
|
-
def log_food(params)
|
85
|
-
post_call("user/#{user_id}/foods/log.json", params)
|
86
|
-
end
|
87
|
-
|
88
|
-
def update_food_log(food_log_id, params)
|
89
|
-
post_call("user/#{user_id}/foods/log/#{food_log_id}.json", params)
|
90
|
-
end
|
91
|
-
|
92
|
-
def log_water(params)
|
93
|
-
post_call("user/#{user_id}/foods/log/water.json", params)
|
94
|
-
end
|
95
|
-
|
96
|
-
def update_food_goal(params)
|
97
|
-
post_call("user/#{user_id}/foods/log/goal.json", params)
|
98
|
-
end
|
99
|
-
|
100
|
-
def update_water_goal(params)
|
101
|
-
post_call("user/#{user_id}/foods/log/water/goal.json", params)
|
102
|
-
end
|
103
|
-
|
104
|
-
def delete_food_log(food_log_id)
|
105
|
-
delete_call("user/#{user_id}/foods/log/#{food_log_id}.json")
|
106
|
-
end
|
107
|
-
|
108
|
-
def update_water_log(water_log_id, params)
|
109
|
-
post_call("user/#{user_id}/foods/log/water/#{water_log_id}.json", params)
|
110
|
-
end
|
111
|
-
|
112
|
-
def delete_water_log(water_log_id)
|
113
|
-
delete_call("user/#{user_id}/foods/log/water/#{water_log_id}.json")
|
114
|
-
end
|
115
|
-
|
116
|
-
# ==================================
|
117
|
-
# Collection Metadata
|
118
|
-
# ==================================
|
119
|
-
|
120
|
-
def add_favorite_food(food_id)
|
121
|
-
post_call("user/#{user_id}/foods/log/favorite/#{food_id}.json")
|
122
|
-
end
|
123
|
-
|
124
|
-
def delete_favorite_food(food_id)
|
125
|
-
delete_call("user/#{user_id}/foods/log/favorite/#{food_id}.json")
|
126
|
-
end
|
127
|
-
|
128
|
-
def recent_foods
|
129
|
-
get_call("user/#{user_id}/foods/recent.json")
|
130
|
-
end
|
131
|
-
|
132
|
-
def favorite_foods
|
133
|
-
get_call("user/#{user_id}/foods/log/favorite.json")
|
134
|
-
end
|
135
|
-
|
136
|
-
def frequent_foods
|
137
|
-
get_call("user/#{user_id}/foods/log/frequent.json")
|
138
|
-
end
|
139
|
-
|
140
|
-
def meals
|
141
|
-
get_call("user/#{user_id}/meals.json")
|
142
|
-
end
|
143
|
-
|
144
|
-
def create_meal(params)
|
145
|
-
post_call("user/#{user_id}/meals.json", params)
|
146
|
-
end
|
147
|
-
|
148
|
-
def meal(meal_id)
|
149
|
-
get_call("user/#{user_id}/meals/#{meal_id}.json")
|
150
|
-
end
|
151
|
-
|
152
|
-
def update_meal(meal_id, params)
|
153
|
-
post_call("user/#{user_id}/meals/#{meal_id}.json", params)
|
154
|
-
end
|
155
|
-
|
156
|
-
def delete_meal(meal_id)
|
157
|
-
delete_call("user/#{user_id}/meals/#{meal_id}.json")
|
158
|
-
end
|
159
|
-
|
160
|
-
def create_food(params)
|
161
|
-
post_call("user/#{user_id}/foods.json", params)
|
162
|
-
end
|
163
|
-
|
164
|
-
def delete_food(food_id)
|
165
|
-
delete_call("user/#{user_id}/foods/#{food_id}.json")
|
166
|
-
end
|
167
|
-
|
168
|
-
def food(id)
|
169
|
-
get_call("foods/#{id}.json")
|
170
|
-
end
|
171
|
-
|
172
|
-
def food_units
|
173
|
-
get_call('foods/units.json')
|
174
|
-
end
|
175
|
-
|
176
|
-
def search_foods(params)
|
177
|
-
post_call('foods/search.json', params)
|
178
|
-
end
|
7
|
+
module FitgemOauth2
|
8
|
+
class Client
|
9
|
+
FOOD_SERIES_RESOURCES = %w[caloriesIn water].freeze
|
10
|
+
FOOD_SERIES_PERIODS = %w[1d 7d 30d 1w 1m 3m 6m 1y max].freeze
|
179
11
|
|
180
12
|
private
|
13
|
+
|
181
14
|
def validate_food_series_period(period)
|
182
15
|
unless FOOD_SERIES_PERIODS.include?(period)
|
183
16
|
raise FitgemOauth2::InvalidArgumentError, "Invalid period: #{period}. Specify a valid period from #{FOOD_SERIES_PERIODS}"
|
184
17
|
end
|
185
18
|
end
|
186
19
|
|
187
|
-
|
188
20
|
def food_series_url(user_id, start_date, end_date_or_period)
|
189
21
|
['user', user_id, 'foods/log/caloriesIn', 'date', start_date, end_date_or_period].join('/') + '.json'
|
190
22
|
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module FitgemOauth2
|
4
|
+
class Client
|
5
|
+
def food_goals
|
6
|
+
get_call("user/#{user_id}/foods/log/goal.json")
|
7
|
+
end
|
8
|
+
|
9
|
+
def food_logs(date)
|
10
|
+
get_call("user/#{user_id}/foods/log/date/#{format_date(date)}.json")
|
11
|
+
end
|
12
|
+
|
13
|
+
def water_logs(date)
|
14
|
+
get_call("user/#{user_id}/foods/log/water/date/#{format_date(date)}.json")
|
15
|
+
end
|
16
|
+
|
17
|
+
def water_goal
|
18
|
+
get_call("user/#{user_id}/foods/log/water/goal.json")
|
19
|
+
end
|
20
|
+
|
21
|
+
def log_food(params)
|
22
|
+
post_call("user/#{user_id}/foods/log.json", params)
|
23
|
+
end
|
24
|
+
|
25
|
+
def update_food_log(food_log_id, params)
|
26
|
+
post_call("user/#{user_id}/foods/log/#{food_log_id}.json", params)
|
27
|
+
end
|
28
|
+
|
29
|
+
def log_water(params)
|
30
|
+
post_call("user/#{user_id}/foods/log/water.json", params)
|
31
|
+
end
|
32
|
+
|
33
|
+
def update_food_goal(params)
|
34
|
+
post_call("user/#{user_id}/foods/log/goal.json", params)
|
35
|
+
end
|
36
|
+
|
37
|
+
def update_water_goal(params)
|
38
|
+
post_call("user/#{user_id}/foods/log/water/goal.json", params)
|
39
|
+
end
|
40
|
+
|
41
|
+
def delete_food_log(food_log_id)
|
42
|
+
delete_call("user/#{user_id}/foods/log/#{food_log_id}.json")
|
43
|
+
end
|
44
|
+
|
45
|
+
def update_water_log(water_log_id, params)
|
46
|
+
post_call("user/#{user_id}/foods/log/water/#{water_log_id}.json", params)
|
47
|
+
end
|
48
|
+
|
49
|
+
def delete_water_log(water_log_id)
|
50
|
+
delete_call("user/#{user_id}/foods/log/water/#{water_log_id}.json")
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module FitgemOauth2
|
4
|
+
class Client
|
5
|
+
def add_favorite_food(food_id)
|
6
|
+
post_call("user/#{user_id}/foods/log/favorite/#{food_id}.json")
|
7
|
+
end
|
8
|
+
|
9
|
+
def delete_favorite_food(food_id)
|
10
|
+
delete_call("user/#{user_id}/foods/log/favorite/#{food_id}.json")
|
11
|
+
end
|
12
|
+
|
13
|
+
def recent_foods
|
14
|
+
get_call("user/#{user_id}/foods/recent.json")
|
15
|
+
end
|
16
|
+
|
17
|
+
def favorite_foods
|
18
|
+
get_call("user/#{user_id}/foods/log/favorite.json")
|
19
|
+
end
|
20
|
+
|
21
|
+
def frequent_foods
|
22
|
+
get_call("user/#{user_id}/foods/log/frequent.json")
|
23
|
+
end
|
24
|
+
|
25
|
+
def meals
|
26
|
+
get_call("user/#{user_id}/meals.json")
|
27
|
+
end
|
28
|
+
|
29
|
+
def create_meal(params)
|
30
|
+
post_call("user/#{user_id}/meals.json", params)
|
31
|
+
end
|
32
|
+
|
33
|
+
def meal(meal_id)
|
34
|
+
get_call("user/#{user_id}/meals/#{meal_id}.json")
|
35
|
+
end
|
36
|
+
|
37
|
+
def update_meal(meal_id, params)
|
38
|
+
post_call("user/#{user_id}/meals/#{meal_id}.json", params)
|
39
|
+
end
|
40
|
+
|
41
|
+
def delete_meal(meal_id)
|
42
|
+
delete_call("user/#{user_id}/meals/#{meal_id}.json")
|
43
|
+
end
|
44
|
+
|
45
|
+
def create_food(params)
|
46
|
+
post_call("user/#{user_id}/foods.json", params)
|
47
|
+
end
|
48
|
+
|
49
|
+
def delete_food(food_id)
|
50
|
+
delete_call("user/#{user_id}/foods/#{food_id}.json")
|
51
|
+
end
|
52
|
+
|
53
|
+
def food(id)
|
54
|
+
get_call("foods/#{id}.json")
|
55
|
+
end
|
56
|
+
|
57
|
+
def food_units
|
58
|
+
get_call('foods/units.json')
|
59
|
+
end
|
60
|
+
|
61
|
+
def search_foods(params)
|
62
|
+
post_call('foods/search.json', params)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module FitgemOauth2
|
4
|
+
class Client
|
5
|
+
def food_series_for_date_range(start_date, end_date)
|
6
|
+
validate_start_date(start_date)
|
7
|
+
validate_end_date(end_date)
|
8
|
+
get_call(food_series_url(user_id, format_date(start_date), format_date(end_date)))
|
9
|
+
end
|
10
|
+
|
11
|
+
def food_series_for_period(start_date, period)
|
12
|
+
validate_start_date(start_date)
|
13
|
+
validate_food_series_period(period)
|
14
|
+
get_call(food_series_url(user_id, format_date(start_date), period))
|
15
|
+
end
|
16
|
+
|
17
|
+
def water_series_for_date_range(start_date, end_date)
|
18
|
+
validate_start_date(start_date)
|
19
|
+
validate_end_date(end_date)
|
20
|
+
get_call(water_series_url(user_id, format_date(start_date), format_date(end_date)))
|
21
|
+
end
|
22
|
+
|
23
|
+
def water_series_for_period(start_date, period)
|
24
|
+
validate_start_date(start_date)
|
25
|
+
validate_food_series_period(period)
|
26
|
+
get_call(water_series_url(user_id, format_date(start_date), period))
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -1,8 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module FitgemOauth2
|
2
4
|
class Client
|
3
|
-
|
4
|
-
|
5
|
-
HR_DETAIL_LEVELS = %w(1sec 1min)
|
5
|
+
HR_PERIODS = %w[1d 7d 30d 1w 1m].freeze
|
6
|
+
HR_DETAIL_LEVELS = %w[1sec 1min].freeze
|
6
7
|
|
7
8
|
def hr_series_for_date_range(start_date, end_date)
|
8
9
|
validate_start_date(start_date)
|
@@ -20,23 +21,6 @@ module FitgemOauth2
|
|
20
21
|
get_call(url + '.json')
|
21
22
|
end
|
22
23
|
|
23
|
-
# retrieve heartrate time series
|
24
|
-
def heartrate_time_series(start_date: nil, end_date: nil, period: nil)
|
25
|
-
warn "[DEPRECATION] `heartrate_time_series` is deprecated. Please use `hr_series_for_date_range` or `hr_series_for_period` instead."
|
26
|
-
|
27
|
-
regular_time_series_guard(
|
28
|
-
start_date: start_date,
|
29
|
-
end_date: end_date,
|
30
|
-
period: period
|
31
|
-
)
|
32
|
-
|
33
|
-
second = period || format_date(end_date)
|
34
|
-
|
35
|
-
url = ['user', user_id, 'activities/heart/date', format_date(start_date), second].join('/')
|
36
|
-
|
37
|
-
get_call(url + '.json')
|
38
|
-
end
|
39
|
-
|
40
24
|
# retrieve intraday series for heartrate
|
41
25
|
def intraday_heartrate_time_series(start_date: nil, end_date: nil, detail_level: nil, start_time: nil, end_time: nil)
|
42
26
|
intraday_series_guard(
|
@@ -51,39 +35,21 @@ module FitgemOauth2
|
|
51
35
|
|
52
36
|
url = ['user', user_id, 'activities/heart/date', format_date(start_date), end_date, detail_level].join('/')
|
53
37
|
|
54
|
-
if start_time && end_time
|
55
|
-
url = [url, 'time', format_time(start_time), format_time(end_time)].join('/')
|
56
|
-
end
|
38
|
+
url = [url, 'time', format_time(start_time), format_time(end_time)].join('/') if start_time && end_time
|
57
39
|
|
58
40
|
get_call(url + '.json')
|
59
41
|
end
|
60
42
|
|
61
43
|
private
|
44
|
+
|
62
45
|
def validate_hr_period(period)
|
63
46
|
unless period && HR_PERIODS.include?(period)
|
64
47
|
raise FitgemOauth2::InvalidArgumentError, "Invalid period: #{period}. Valid periods are #{HR_PERIODS}."
|
65
48
|
end
|
66
49
|
end
|
67
50
|
|
68
|
-
def regular_time_series_guard(start_date:, end_date:, period:)
|
69
|
-
validate_start_date(start_date)
|
70
|
-
|
71
|
-
if end_date && period
|
72
|
-
raise FitgemOauth2::InvalidArgumentError, 'Both end_date and period specified. Specify only one.'
|
73
|
-
end
|
74
|
-
|
75
|
-
if !end_date && !period
|
76
|
-
raise FitgemOauth2::InvalidArgumentError, 'Neither end_date nor period specified. Specify at least one.'
|
77
|
-
end
|
78
|
-
|
79
|
-
validate_hr_period(period) if period
|
80
|
-
end
|
81
|
-
|
82
|
-
|
83
51
|
def intraday_series_guard(start_date:, end_date:, detail_level:, start_time:, end_time:)
|
84
|
-
unless start_date
|
85
|
-
raise FitgemOauth2::InvalidArgumentError, 'Start date not provided.'
|
86
|
-
end
|
52
|
+
raise FitgemOauth2::InvalidArgumentError, 'Start date not provided.' unless start_date
|
87
53
|
|
88
54
|
unless detail_level && HR_DETAIL_LEVELS.include?(detail_level)
|
89
55
|
raise FitgemOauth2::InvalidArgumentError, "Please specify the defail level. Detail level should be one of #{HR_DETAIL_LEVELS}."
|
data/lib/fitgem_oauth2/sleep.rb
CHANGED
@@ -1,9 +1,13 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
+
module FitgemOauth2
|
3
4
|
class Client
|
5
|
+
SLEEP_RESOURCES = %w[
|
6
|
+
startTime timeInBed minutesAsleep awakeningsCount minutesAwake
|
7
|
+
minutesToFallAsleep minutesAfterWakeup efficiency
|
8
|
+
].freeze
|
4
9
|
|
5
|
-
|
6
|
-
SLEEP_PERIODS = %w(1d 7d 30d 1w 1m 3m 6m 1y max)
|
10
|
+
SLEEP_PERIODS = %w[1d 7d 30d 1w 1m 3m 6m 1y max].freeze
|
7
11
|
|
8
12
|
# retrieve sleep logs for a date
|
9
13
|
# @param date date for which sleep logs needs to be accessed
|
@@ -17,12 +21,12 @@ module FitgemOauth2
|
|
17
21
|
|
18
22
|
def sleep_logs_list(date, sort, limit)
|
19
23
|
date_param = format_date(date)
|
20
|
-
if sort ==
|
24
|
+
if sort == 'asc'
|
21
25
|
date_param = "afterDate=#{date_param}"
|
22
|
-
elsif sort ==
|
26
|
+
elsif sort == 'desc'
|
23
27
|
date_param = "beforeDate=#{date_param}"
|
24
28
|
else
|
25
|
-
raise FitgemOauth2::InvalidArgumentError,
|
29
|
+
raise FitgemOauth2::InvalidArgumentError, 'sort can either be asc or desc'
|
26
30
|
end
|
27
31
|
get_call_1_2("user/#{user_id}/sleep/list.json?#{date_param}&offset=0&sort=#{sort}&limit=#{limit}")
|
28
32
|
end
|
@@ -44,9 +48,7 @@ module FitgemOauth2
|
|
44
48
|
# @param end_date ending date for sleep time series
|
45
49
|
# @param period period for sleep time series
|
46
50
|
def sleep_time_series(resource: nil, start_date: nil, end_date: nil, period: nil)
|
47
|
-
unless start_date
|
48
|
-
raise FitgemOauth2::InvalidArgumentError, 'Start date not provided.'
|
49
|
-
end
|
51
|
+
raise FitgemOauth2::InvalidArgumentError, 'Start date not provided.' unless start_date
|
50
52
|
|
51
53
|
unless resource && SLEEP_RESOURCES.include?(resource)
|
52
54
|
raise FitgemOauth2::InvalidArgumentError, "Invalid resource: #{resource}. Valid resources are #{SLEEP_RESOURCES}."
|
@@ -1,7 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module FitgemOauth2
|
2
4
|
class Client
|
3
|
-
|
4
|
-
SUBSCRIBABLE_TYPES = [:sleep, :body, :activities, :foods, :all]
|
5
|
+
SUBSCRIBABLE_TYPES = %i[sleep body activities foods all].freeze
|
5
6
|
|
6
7
|
def subscriptions(opts)
|
7
8
|
get_call(subscription_url(opts))
|
@@ -18,15 +19,15 @@ module FitgemOauth2
|
|
18
19
|
protected
|
19
20
|
|
20
21
|
def subscription_url(opts)
|
21
|
-
type = opts[
|
22
|
+
type = opts[:type] || :all
|
22
23
|
subscription_id = opts[:subscription_id]
|
23
24
|
|
24
|
-
url = [
|
25
|
+
url = ['user', user_id]
|
25
26
|
url << type unless type == :all
|
26
27
|
url << 'apiSubscriptions'
|
27
28
|
url << subscription_id if subscription_id
|
28
29
|
|
29
|
-
|
30
|
+
url.join('/') + '.json'
|
30
31
|
end
|
31
32
|
end
|
32
|
-
end
|
33
|
+
end
|
data/lib/fitgem_oauth2/users.rb
CHANGED
data/lib/fitgem_oauth2/utils.rb
CHANGED
@@ -1,18 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module FitgemOauth2
|
2
4
|
class Client
|
3
|
-
|
4
5
|
def format_date(date)
|
5
|
-
if
|
6
|
-
return nil
|
7
|
-
end
|
6
|
+
return nil if date.nil?
|
8
7
|
|
9
|
-
valid_semantic_date = %w
|
10
|
-
valid_date_string = (
|
8
|
+
valid_semantic_date = %w[today yesterday].include? date
|
9
|
+
valid_date_string = (date =~ /\d{4}\-\d{2}\-\d{2}/) == 0
|
11
10
|
if valid_date_string
|
12
11
|
date
|
13
12
|
elsif valid_semantic_date
|
14
13
|
date_from_semantic(date)
|
15
|
-
elsif Date
|
14
|
+
elsif date.is_a?(Date) || date.is_a?(Time) || date.is_a?(DateTime)
|
16
15
|
date.strftime('%Y-%m-%d')
|
17
16
|
else
|
18
17
|
raise FitgemOauth2::InvalidDateArgument, "Date used must be a date/time object or a string in the format YYYY-MM-DD; supplied argument is a #{date.class}"
|
@@ -20,9 +19,9 @@ module FitgemOauth2
|
|
20
19
|
end
|
21
20
|
|
22
21
|
def format_time(time)
|
23
|
-
if (
|
22
|
+
if (time =~ /\d{2}:\d{2}/) == 0
|
24
23
|
time
|
25
|
-
elsif DateTime
|
24
|
+
elsif time.is_a?(DateTime) || time.is_a?(Time)
|
26
25
|
time.strftime('%H:%M')
|
27
26
|
else
|
28
27
|
raise FitgemOauth2::InvalidTimeArgument, "Time used must be a DateTime/Time object or a string in the format hh:mm; supplied argument is a #{time.class}"
|
@@ -30,21 +29,18 @@ module FitgemOauth2
|
|
30
29
|
end
|
31
30
|
|
32
31
|
def validate_start_date(start_date)
|
33
|
-
unless start_date
|
34
|
-
raise FitgemOauth2::InvalidArgumentError, 'Please specify a valid start date.'
|
35
|
-
end
|
32
|
+
raise FitgemOauth2::InvalidArgumentError, 'Please specify a valid start date.' unless start_date
|
36
33
|
end
|
37
34
|
|
38
35
|
def validate_end_date(end_date)
|
39
|
-
unless end_date
|
40
|
-
raise FitgemOauth2::InvalidArgumentError, 'Please specify a valid end date.'
|
41
|
-
end
|
36
|
+
raise FitgemOauth2::InvalidArgumentError, 'Please specify a valid end date.' unless end_date
|
42
37
|
end
|
43
38
|
|
44
39
|
private
|
40
|
+
|
45
41
|
def date_from_semantic(semantic)
|
46
42
|
if semantic === 'yesterday'
|
47
|
-
(Date.today-1).strftime('%Y-%m-%d')
|
43
|
+
(Date.today - 1).strftime('%Y-%m-%d')
|
48
44
|
elsif semantic == 'today'
|
49
45
|
Date.today.strftime('%Y-%m-%d')
|
50
46
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fitgem_oauth2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ankit Gupta
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -16,56 +16,56 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.0.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 1.0.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: factory_bot
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '4.5'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '4.5'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 13.0.1
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 13.0.1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '4
|
61
|
+
version: '3.4'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '4
|
68
|
+
version: '3.4'
|
69
69
|
description: This gem allows requesting data from Fitbit API using OAuth2
|
70
70
|
email: ankit.gupta2801@gmail.com
|
71
71
|
executables: []
|
@@ -80,6 +80,9 @@ files:
|
|
80
80
|
- lib/fitgem_oauth2/devices.rb
|
81
81
|
- lib/fitgem_oauth2/errors.rb
|
82
82
|
- lib/fitgem_oauth2/food.rb
|
83
|
+
- lib/fitgem_oauth2/food/collection.rb
|
84
|
+
- lib/fitgem_oauth2/food/metadata.rb
|
85
|
+
- lib/fitgem_oauth2/food/series.rb
|
83
86
|
- lib/fitgem_oauth2/friends.rb
|
84
87
|
- lib/fitgem_oauth2/heartrate.rb
|
85
88
|
- lib/fitgem_oauth2/sleep.rb
|
@@ -91,7 +94,7 @@ homepage: http://rubygems.org/gems/fitgem_oauth2
|
|
91
94
|
licenses:
|
92
95
|
- MIT
|
93
96
|
metadata: {}
|
94
|
-
post_install_message:
|
97
|
+
post_install_message:
|
95
98
|
rdoc_options: []
|
96
99
|
require_paths:
|
97
100
|
- lib
|
@@ -106,9 +109,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
109
|
- !ruby/object:Gem::Version
|
107
110
|
version: '0'
|
108
111
|
requirements: []
|
109
|
-
|
110
|
-
|
111
|
-
signing_key:
|
112
|
+
rubygems_version: 3.2.3
|
113
|
+
signing_key:
|
112
114
|
specification_version: 4
|
113
115
|
summary: Fitbit API client library
|
114
116
|
test_files: []
|