fitbit_api 0.14.0 → 0.14.2

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
  SHA256:
3
- metadata.gz: 32eab4ca789fa776fe5d1ddacf58dd51f43d01d12c049b2b4c5080c5969f902d
4
- data.tar.gz: 4f83878440ed7f152f5a5eb3d101447972847c578adaf05b704d201565513189
3
+ metadata.gz: 417f3489c6b33f4acc4d8eebf14048c5a50b4f86905679f04a436472aea67bd7
4
+ data.tar.gz: 01ebe9bcc0db08753267015b0ac50a4950c8394c1f7b8563298d2b7657544007
5
5
  SHA512:
6
- metadata.gz: de894373c47758b4c7530ce3a4559a8284f3c2e2390f3925841015bced821a2c9370657199c527ac9a5416a597019c3bcf1d3a8dcb135fc0bda875aae4baea77
7
- data.tar.gz: 3c03846f5f25e1117a88acbfb09e78903ec425deb663e7371154cbc3e57b8a70d43f17c5171bf41ee9c19a584fa932ad009a2171c1a2458637f01893c7b7e013
6
+ metadata.gz: 66c83ce386d49728e5ec75f4e343c18a015f776c6cc8b8721ff1c4e2700098ece8f1c6b2c3788a7cc1521d3f1302319f25552ea7a1a70b0b9a93ffd0d8e47d52
7
+ data.tar.gz: 4e97184f094af8aed5a1fd8ea427a9be8c128ebbe439990a8c933a3463c7b8ddb0b31b64ce512d5998118a8f1988aa0ed56ad6009f6045e282d06fc131723bc3
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ 0.14.2
2
+ ------
3
+ - Add documentation for more methods
4
+
5
+ 0.14.1
6
+ ------
7
+ - Add documentation for several methods
8
+
1
9
  0.14.0
2
10
  ------
3
11
  - Add support for the following endpoints:
@@ -1,5 +1,17 @@
1
1
  module FitbitAPI
2
2
  class Client
3
+ # Returns the average breathing rate data for a given date or date range.
4
+ # If both a date and a date range are given, the date range takes precedence.
5
+ #
6
+ # breathing_rate_summary(date: Date.parse('2021-04-16'))
7
+ # breathing_rate_summary(start_date: Date.parse('2021-05-18'), end_date: Date.parse('2021-05-24'))
8
+ #
9
+ # @param params [Hash] The request parameters
10
+ #
11
+ # @option params :date [Date] The target date
12
+ # @option params :start_date [Date] The start of the date range
13
+ # @option params :end_date [Date] The end of the date range
14
+
3
15
  def breathing_rate_summary(opts={})
4
16
  date = opts[:date] || Date.today
5
17
  start_date = opts[:start_date]
@@ -23,6 +35,18 @@ module FitbitAPI
23
35
  result.values[0]
24
36
  end
25
37
 
38
+ # Returns the intraday breathing rate data for a given date or date range.
39
+ # If both a date and a date range are given, the date range takes precedence.
40
+ #
41
+ # breathing_rate_intraday(date: Date.parse('2021-04-16'))
42
+ # breathing_rate_intraday(start_date: Date.parse('2021-05-18'), end_date: Date.parse('2021-05-24'))
43
+ #
44
+ # @param params [Hash] The request parameters
45
+ #
46
+ # @option params :date [Date] The target date
47
+ # @option params :start_date [Date] The start of the date range
48
+ # @option params :end_date [Date] The end of the date range
49
+
26
50
  def breathing_rate_intraday(opts={})
27
51
  date = opts[:date] || Date.today
28
52
  start_date = opts[:start_date]
@@ -1,5 +1,17 @@
1
1
  module FitbitAPI
2
2
  class Client
3
+ # Returns the cardio fitness score data for a given date or date range.
4
+ # If both a date and a date range are given, the date range takes precedence.
5
+ #
6
+ # cardio_score_summary(date: Date.parse('2021-04-16'))
7
+ # cardio_score_summary(start_date: Date.parse('2021-05-18'), end_date: Date.parse('2021-05-24'))
8
+ #
9
+ # @param params [Hash] The request parameters
10
+ #
11
+ # @option params :date [Date] The target date
12
+ # @option params :start_date [Date] The start of the date range
13
+ # @option params :end_date [Date] The end of the date range
14
+
3
15
  def cardio_score_summary(opts={})
4
16
  date = opts[:date] || Date.today
5
17
  start_date = opts[:start_date]
@@ -31,10 +31,16 @@ module FitbitAPI
31
31
  establish_token(opts)
32
32
  end
33
33
 
34
+ # Returns the authorize endpoint URL of the OAuth2 provider.
35
+
34
36
  def auth_url
35
37
  @client.auth_code.authorize_url(redirect_uri: @redirect_uri, scope: @scope)
36
38
  end
37
39
 
40
+ # Returns an OAuth2::AccessToken instance obtained from the given authorization code.
41
+ #
42
+ # @param auth_code [String] An authorization code
43
+
38
44
  def get_token(auth_code)
39
45
  @token = @client.auth_code.get_token(
40
46
  auth_code,
@@ -45,6 +51,8 @@ module FitbitAPI
45
51
  @token
46
52
  end
47
53
 
54
+ # Refreshes the current Access Token.
55
+
48
56
  def refresh_token!
49
57
  @token = @token.refresh!(headers: auth_headers)
50
58
  @user_id ||= @token.params['user_id']
@@ -53,6 +61,8 @@ module FitbitAPI
53
61
  @token
54
62
  end
55
63
 
64
+ # Revokes the user's authorizations and all associated tokens.
65
+
56
66
  def revoke_token!
57
67
  body = { token: token.token }
58
68
  headers = default_request_headers.merge(auth_headers)
@@ -61,14 +71,32 @@ module FitbitAPI
61
71
  process_keys!(MultiJson.load(response.body))
62
72
  end
63
73
 
74
+ # Performs an authorized GET request to the configured API namespace.
75
+ #
76
+ # @param path [String] The request path
77
+ # @param params [Hash] The query parameters
78
+ # @param opts [Hash] Additional request options (e.g. headers)
79
+
64
80
  def get(path, params={}, opts={}, &block)
65
81
  request(:get, path, opts.merge(params: params), &block)
66
82
  end
67
83
 
84
+ # Performs an authorized POST request to the configured API namespace.
85
+ #
86
+ # @param path [String] The request path
87
+ # @param body [Hash] The request body
88
+ # @param opts [Hash] Additional request options (e.g. headers)
89
+
68
90
  def post(path, body={}, opts={}, &block)
69
91
  request(:post, path, opts.merge(body: body), &block)
70
92
  end
71
93
 
94
+ # Performs an authorized DELETE request to the configured API namespace.
95
+ #
96
+ # @param path [String] The request path
97
+ # @param params [Hash] The query parameters
98
+ # @param opts [Hash] Additional request options (e.g. headers)
99
+
72
100
  def delete(path, params={}, opts={}, &block)
73
101
  request(:delete, path, opts.merge(params: params), &block)
74
102
  end
@@ -1,5 +1,17 @@
1
1
  module FitbitAPI
2
2
  class Client
3
+ # Returns the heart rate variability data for a given date or date range.
4
+ # If both a date and a date range are given, the date range takes precedence.
5
+ #
6
+ # heart_rate_variability_summary(date: Date.parse('2021-04-16'))
7
+ # heart_rate_variability_summary(start_date: Date.parse('2021-05-18'), end_date: Date.parse('2021-05-24'))
8
+ #
9
+ # @param params [Hash] The request parameters
10
+ #
11
+ # @option params :date [Date] The target date
12
+ # @option params :start_date [Date] The start of the date range
13
+ # @option params :end_date [Date] The end of the date range
14
+
3
15
  def heart_rate_variability_summary(opts={})
4
16
  date = opts[:date] || Date.today
5
17
  start_date = opts[:start_date]
@@ -23,6 +35,18 @@ module FitbitAPI
23
35
  result.values[0]
24
36
  end
25
37
 
38
+ # Returns the heart rate variability intraday data for a given date or date range.
39
+ # If both a date and a date range are given, the date range takes precedence.
40
+ #
41
+ # heart_rate_variability_intraday(date: Date.parse('2021-04-16'))
42
+ # heart_rate_variability_intraday(start_date: Date.parse('2021-05-18'), end_date: Date.parse('2021-05-24'))
43
+ #
44
+ # @param params [Hash] The request parameters
45
+ #
46
+ # @option params :date [Date] The target date
47
+ # @option params :start_date [Date] The start of the date range
48
+ # @option params :end_date [Date] The end of the date range
49
+
26
50
  def heart_rate_variability_intraday(opts={})
27
51
  date = opts[:date] || Date.today
28
52
  start_date = opts[:start_date]
@@ -1,5 +1,17 @@
1
1
  module FitbitAPI
2
2
  class Client
3
+ # Returns the oxygen saturation summary data for a given date or date range.
4
+ # If both a date and a date range are given, the date range takes precedence.
5
+ #
6
+ # oxygen_saturation_summary(date: Date.parse('2021-04-16'))
7
+ # oxygen_saturation_summary(start_date: Date.parse('2021-05-18'), end_date: Date.parse('2021-05-24'))
8
+ #
9
+ # @param params [Hash] The request parameters
10
+ #
11
+ # @option params :date [Date] The target date
12
+ # @option params :start_date [Date] The start of the date range
13
+ # @option params :end_date [Date] The end of the date range
14
+
3
15
  def oxygen_saturation_summary(opts={})
4
16
  date = opts[:date] || Date.today
5
17
  start_date = opts[:start_date]
@@ -20,6 +32,18 @@ module FitbitAPI
20
32
  end
21
33
  end
22
34
 
35
+ # Returns the oxygen saturation intraday data for a given date or date range.
36
+ # If both a date and a date range are given, the date range takes precedence.
37
+ #
38
+ # oxygen_saturation_intraday(date: Date.parse('2021-04-16'))
39
+ # oxygen_saturation_intraday(start_date: Date.parse('2021-05-18'), end_date: Date.parse('2021-05-24'))
40
+ #
41
+ # @param params [Hash] The request parameters
42
+ #
43
+ # @option params :date [Date] The target date
44
+ # @option params :start_date [Date] The start of the date range
45
+ # @option params :end_date [Date] The end of the date range
46
+
23
47
  def oxygen_saturation_intraday(opts={})
24
48
  date = opts[:date] || Date.today
25
49
  start_date = opts[:start_date]
@@ -1,5 +1,17 @@
1
1
  module FitbitAPI
2
2
  class Client
3
+ # Returns the core temperature data for a given date or date range.
4
+ # If both a date and a date range are given, the date range takes precedence.
5
+ #
6
+ # core_temperature_summary(date: Date.parse('2021-04-16'))
7
+ # core_temperature_summary(start_date: Date.parse('2021-05-18'), end_date: Date.parse('2021-05-24'))
8
+ #
9
+ # @param params [Hash] The request parameters
10
+ #
11
+ # @option params :date [Date] The target date
12
+ # @option params :start_date [Date] The start of the date range
13
+ # @option params :end_date [Date] The end of the date range
14
+
3
15
  def core_temperature_summary(opts={})
4
16
  date = opts[:date] || Date.today
5
17
  start_date = opts[:start_date]
@@ -23,6 +35,18 @@ module FitbitAPI
23
35
  result.values[0]
24
36
  end
25
37
 
38
+ # Returns the skin temperature data for a given date or date range.
39
+ # If both a date and a date range are given, the date range takes precedence.
40
+ #
41
+ # skin_temperature_summary(date: Date.parse('2021-04-16'))
42
+ # skin_temperature_summary(start_date: Date.parse('2021-05-18'), end_date: Date.parse('2021-05-24'))
43
+ #
44
+ # @param params [Hash] The request parameters
45
+ #
46
+ # @option params :date [Date] The target date
47
+ # @option params :start_date [Date] The start of the date range
48
+ # @option params :end_date [Date] The end of the date range
49
+
26
50
  def skin_temperature_summary(opts={})
27
51
  date = opts[:date] || Date.today
28
52
  start_date = opts[:start_date]
@@ -1,3 +1,3 @@
1
1
  module FitbitAPI
2
- VERSION = '0.14.0'
2
+ VERSION = '0.14.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fitbit_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.14.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zoran
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-11-05 00:00:00.000000000 Z
11
+ date: 2022-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oauth2