fitbit_api 0.12.1 → 0.13.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cced5004604fd14351b0539ffe29efc102d6297f0a73e6d64edd6e4f18b24975
4
- data.tar.gz: 66a12b7d4b92c0c75e0958b5f69ddbb87f376bc4196bebd8884804df09bf33d7
3
+ metadata.gz: '03139ae4b7cbf7a8243f05b155cd4795c4dd2d3f02b86adadc27cebed83be9d8'
4
+ data.tar.gz: 9d2396e266cfa26e8e869e492c74d37605065eecb743ee5e8a64d59a1a13c8bb
5
5
  SHA512:
6
- metadata.gz: 2d3b0ee2261afc4a254dc3673796198e9dc832e78a21241b84a7c11a0f39d396fc8647abf6826a0c4aa3a3be731a63b812dcf4d0de9a45c3fb6ccae9b9297612
7
- data.tar.gz: 67526aba18a4fe518d5d0b05e8a48979009fc3435ed627c59bff341872e6917387c14ae83709d2ae84c0ff5e16000bf2fca55a89870a436f41b5a389b6b33a2a
6
+ metadata.gz: 65750c1625faf8f7118120f8db01e1a80438baa496cce74c10aa6bc920692899595ad91973ecea3a1e63ffbb7d5b454f7f40f6433d2b1f08fdae40df4b4580ec
7
+ data.tar.gz: 95db8df54a789b5ab0a1fdfa1a8906d7d8d4818d9af4fe33f41fcd5a156bd3fd90006bd927c233cee67f0714eeabbd41d5162a6b7171f2ef40d03b73774cf9e8
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ 0.13.0
2
+ ------
3
+ - Add support for token revocation via `revoke_token!`.
4
+
5
+ 0.12.2
6
+ ------
7
+ - Fix docs formatting
8
+
1
9
  0.12.1
2
10
  ------
3
11
  - Some docs improvements
data/fitbit_api.gemspec CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.homepage = 'https://github.com/zokioki/fitbit_api'
13
13
  spec.license = 'MIT'
14
14
 
15
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
15
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(bin|test|spec|features)/}) }
16
16
  spec.bindir = 'exe'
17
17
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
18
  spec.require_paths = ['lib']
@@ -2,7 +2,7 @@ module FitbitAPI
2
2
  class Client
3
3
  # Returns a list of the set alarms connected to a user's account.
4
4
  #
5
- # @params tracker_id [Integer] The ID of the tracker for which the data is returned
5
+ # @param tracker_id [Integer] The ID of the tracker for which the data is returned
6
6
 
7
7
  def alarms(tracker_id)
8
8
  get("user/#{user_id}/devices/tracker/#{tracker_id}/alarms.json")
@@ -48,6 +48,14 @@ module FitbitAPI
48
48
  @token
49
49
  end
50
50
 
51
+ def revoke_token!
52
+ body = { token: token.token }
53
+ headers = default_request_headers.merge(auth_headers)
54
+ response = token.post('oauth2/revoke', { headers: headers, body: body }).response
55
+
56
+ process_keys!(MultiJson.load(response.body))
57
+ end
58
+
51
59
  def get(path, params={}, opts={}, &block)
52
60
  request(:get, path, opts.merge(params: params), &block)
53
61
  end
@@ -8,7 +8,7 @@ module FitbitAPI
8
8
 
9
9
  # Retrieves a list of public foods from the Fitbit foods database and private foods the user created
10
10
  #
11
- # @params query [String] The search query
11
+ # @param query [String] The search query
12
12
 
13
13
  def search_foods(params)
14
14
  get("foods/search.json", params)
@@ -28,7 +28,7 @@ module FitbitAPI
28
28
 
29
29
  # Creates a new private food for a user
30
30
  #
31
- # @params body [Hash] The POST request body
31
+ # @param body [Hash] The POST request body
32
32
 
33
33
  def create_food(body)
34
34
  post("user/#{user_id}/foods.json", body)
@@ -36,7 +36,7 @@ module FitbitAPI
36
36
 
37
37
  # Deletes a custom food created by the user
38
38
  #
39
- # @params food_id [Integer] The ID of the food to be deleted
39
+ # @param food_id [Integer] The ID of the food to be deleted
40
40
 
41
41
  def delete_food(food_id)
42
42
  delete("user/#{user_id}/foods/#{food_id}.json")
@@ -44,7 +44,7 @@ module FitbitAPI
44
44
 
45
45
  # Creates a food log entry
46
46
  #
47
- # @params body [Hash] The POST request body
47
+ # @param body [Hash] The POST request body
48
48
 
49
49
  def create_food_log(body)
50
50
  post("user/#{user_id}/foods/log.json", body)
@@ -52,8 +52,8 @@ module FitbitAPI
52
52
 
53
53
  # Updates the quantity or calories consumed for a user's food log entry with the given Food Log ID
54
54
  #
55
- # @params food_log_id [Integer] The ID of the food log to edit
56
- # @params body [Hash] The POST request body
55
+ # @param food_log_id [Integer] The ID of the food log to edit
56
+ # @param body [Hash] The POST request body
57
57
 
58
58
  def update_food_log(food_log_id, body)
59
59
  post("user/#{user_id}/foods/log/#{food_log_id}.json", body)
@@ -61,7 +61,7 @@ module FitbitAPI
61
61
 
62
62
  # Deletes a user's food log entry using the given log ID
63
63
  #
64
- # @params food_log_id [Integer] The id of the food log entry
64
+ # @param food_log_id [Integer] The id of the food log entry
65
65
 
66
66
  def delete_food_log(food_log_id)
67
67
  delete("user/#{user_id}/foods/log/#{food_log_id}.json")
@@ -75,7 +75,7 @@ module FitbitAPI
75
75
 
76
76
  # Deletes a food with the given ID from the user's list of favorite foods
77
77
  #
78
- # @params food_id [Integer] The ID of the food to delete from the user's favorites
78
+ # @param food_id [Integer] The ID of the food to delete from the user's favorites
79
79
 
80
80
  def delete_favorite_food(food_id)
81
81
  delete("user/#{user_id}/foods/log/favorite/#{food_id}.json")
@@ -8,7 +8,7 @@ module FitbitAPI
8
8
 
9
9
  # Retrieves a single meal created by the user from their food log given the meal id
10
10
  #
11
- # @params meal_id [Integer] The ID of the meal
11
+ # @param meal_id [Integer] The ID of the meal
12
12
 
13
13
  def meal(meal_id)
14
14
  get("user/#{user_id}/meals/#{meal_id}.json")
@@ -16,7 +16,7 @@ module FitbitAPI
16
16
 
17
17
  # Creates a meal with the given food
18
18
  #
19
- # @params body [Hash] The POST request body
19
+ # @param body [Hash] The POST request body
20
20
 
21
21
  def create_meal(body)
22
22
  post("user/#{user_id}/meals.json", body)
@@ -24,8 +24,8 @@ module FitbitAPI
24
24
 
25
25
  # Updates an existing meal with the contents of the request
26
26
  #
27
- # @params meal_id [Integer] The ID of the meal
28
- # @params body [Hash] The POST request body
27
+ # @param meal_id [Integer] The ID of the meal
28
+ # @param body [Hash] The POST request body
29
29
 
30
30
  def update_meal(meal_id, body)
31
31
  post("user/#{user_id}/meals/#{meal_id}.json", body)
@@ -33,7 +33,7 @@ module FitbitAPI
33
33
 
34
34
  # Deletes an existing meal of the given meal ID
35
35
  #
36
- # @params meal_id [Integer] The ID of the meal
36
+ # @param meal_id [Integer] The ID of the meal
37
37
 
38
38
  def delete_meal(meal_id)
39
39
  delete("user/#{user_id}/meals/#{meal_id}.json")
@@ -7,7 +7,7 @@ module FitbitAPI
7
7
  # periods that began on the previous date. For example, if you request a Sleep Log for 2021-12-22,
8
8
  # it may return a log entry that began the previous night on 2021-12-21, but ended on 2021-12-22.
9
9
  #
10
- # @params date [Date, String] The date for the sleep log to be returned in the format yyyy-MM-dd
10
+ # @param date [Date, String] The date for the sleep log to be returned in the format yyyy-MM-dd
11
11
 
12
12
  def sleep_logs(date=Date.today)
13
13
  get("user/#{user_id}/sleep/date/#{format_date(date)}.json")
@@ -14,7 +14,7 @@ module FitbitAPI
14
14
 
15
15
  # Modifies a user's profile data.
16
16
  #
17
- # @params body [Hash] The POST request body
17
+ # @param body [Hash] The POST request body
18
18
 
19
19
  def update_profile(body)
20
20
  post("user/#{user_id}/profile.json", body)
@@ -1,3 +1,3 @@
1
1
  module FitbitAPI
2
- VERSION = '0.12.1'
2
+ VERSION = '0.13.0'
3
3
  end
@@ -18,8 +18,8 @@ module FitbitAPI
18
18
 
19
19
  # Updates the quantity consumed for a user's water log entry with the given log ID
20
20
  #
21
- # @params water_log_id [Integer] The ID of the water log to be updated
22
- # @params body [Hash] The POST request body for updating the water log
21
+ # @param water_log_id [Integer] The ID of the water log to be updated
22
+ # @param body [Hash] The POST request body for updating the water log
23
23
 
24
24
  def update_water_log(water_log_id, body)
25
25
  post("user/#{user_id}/foods/log/water/#{water_log_id}.json", body)
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.12.1
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zoran
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-05-21 00:00:00.000000000 Z
11
+ date: 2022-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oauth2
@@ -80,8 +80,8 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '3.11'
83
- description:
84
- email:
83
+ description:
84
+ email:
85
85
  executables: []
86
86
  extensions: []
87
87
  extra_rdoc_files: []
@@ -119,7 +119,7 @@ homepage: https://github.com/zokioki/fitbit_api
119
119
  licenses:
120
120
  - MIT
121
121
  metadata: {}
122
- post_install_message:
122
+ post_install_message:
123
123
  rdoc_options: []
124
124
  require_paths:
125
125
  - lib
@@ -134,8 +134,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
134
  - !ruby/object:Gem::Version
135
135
  version: '0'
136
136
  requirements: []
137
- rubygems_version: 3.3.13
138
- signing_key:
137
+ rubygems_version: 3.3.24
138
+ signing_key:
139
139
  specification_version: 4
140
140
  summary: A Ruby interface to the Fitbit Web API.
141
141
  test_files: []