fitbit_api 0.9.1 → 0.10.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 +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +13 -14
- data/fitbit_api.gemspec +1 -1
- data/lib/fitbit_api/activities.rb +44 -30
- data/lib/fitbit_api/alarms.rb +26 -16
- data/lib/fitbit_api/base.rb +3 -0
- data/lib/fitbit_api/client.rb +44 -37
- data/lib/fitbit_api/goals.rb +18 -16
- data/lib/fitbit_api/helpers/configuration.rb +18 -16
- data/lib/fitbit_api/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 303b1eda2135541723313d505d4c34292e94b473c2a87cff32119bd8de97b0ea
|
4
|
+
data.tar.gz: c526445b8815cbe19ce92f6b762036aae9bbf57cfccea2cba9131ed63788307e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7cc3ae62f509e40a0c58bc31f5ffc75865909d482e862401afa0737fc6138ea226c3a9909721903b86f00febd1a8eea46ac01b1d93d2c9dbd0d706b6c201938
|
7
|
+
data.tar.gz: d0d6328a931c8d3fe931f6e31b283681092b31d4b50d5186aeb1a7b8efe885dbf828d0c058a5296c4a4abe9b7e8b13b183482d1f6dc6102aac38a98284d9f3ec
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
0.10.0
|
2
|
+
------
|
3
|
+
- Add `auto_refresh_token` config to make token auto-refreshing configurable (defaults to true).
|
4
|
+
- Add `on_token_refresh` config to specify callback to execute on token refresh (optional).
|
5
|
+
- Bump `bundler` development dependency
|
6
|
+
- Clean up documentation formatting
|
7
|
+
|
1
8
|
0.9.1
|
2
9
|
-----
|
3
10
|
- Fix `sleep_time_series` endpoint
|
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
[](https://badge.fury.io/rb/fitbit_api)
|
4
4
|
[](https://travis-ci.org/zokioki/fitbit_api)
|
5
5
|
|
6
|
-
FitbitAPI provides a Ruby interface to the [Fitbit Web API](https://dev.fitbit.com/reference/web-api
|
6
|
+
FitbitAPI provides a Ruby interface to the [Fitbit Web API](https://dev.fitbit.com/reference/web-api).
|
7
7
|
|
8
8
|
## Installation
|
9
9
|
|
@@ -95,19 +95,18 @@ client.log_activity activity_id: 12345, durationMillis: '683300'
|
|
95
95
|
|
96
96
|
When initializing a `FitbitAPI::Client` instance, you're given access to a handful of options:
|
97
97
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
If using this library in Rails, you can configure your options using an initializer:
|
98
|
+
| option | description |
|
99
|
+
| ------------------ | -----------------------------|
|
100
|
+
| api_version | API version to be used when making requests (default: "1") |
|
101
|
+
| unit_system | The measurement unit system to use for response values (default: "en_US") |
|
102
|
+
| locale | The locale to use for response values (default: "en_US") |
|
103
|
+
| scope | A space-delimited list of permissions being requested (default: "activity nutrition profile settings sleep social weight heartrate") |
|
104
|
+
| snake_case_keys | Transform response payload's keys to snake case format (default: false) |
|
105
|
+
| symbolize_keys | Transform response payload's keys to symbols (default: false) |
|
106
|
+
| auto_refresh_token | Automatically refreshes the access token once expired (default: true) |
|
107
|
+
| on_token_refresh | A callback to be invoked whenever the access token is refreshed (default: nil) |
|
108
|
+
|
109
|
+
If using this library in Rails, you can configure these options globally in an initializer:
|
111
110
|
|
112
111
|
```ruby
|
113
112
|
# config/initializers/fitbit_api.rb
|
data/fitbit_api.gemspec
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_runtime_dependency 'oauth2', '~> 1.0'
|
23
23
|
|
24
24
|
spec.add_development_dependency 'byebug'
|
25
|
-
spec.add_development_dependency 'bundler', '~> 2.
|
25
|
+
spec.add_development_dependency 'bundler', '~> 2.3'
|
26
26
|
spec.add_development_dependency 'rake', '>= 12.3.3'
|
27
27
|
spec.add_development_dependency 'rspec'
|
28
28
|
end
|
@@ -14,15 +14,18 @@ module FitbitAPI
|
|
14
14
|
# GET Activities
|
15
15
|
# ==============
|
16
16
|
|
17
|
-
# Retrieves a summary and list of a user's activities and activity log entries
|
18
|
-
#
|
17
|
+
# Retrieves a summary and list of a user's activities and activity log entries
|
18
|
+
# for a given day in the format requested using units in the unit system which
|
19
|
+
# corresponds to the Accept-Language header provided.
|
20
|
+
#
|
21
|
+
# @param date [Date] The date for which to retrieve the activity data.
|
19
22
|
|
20
23
|
def daily_activity_summary(date=Date.today, opts={})
|
21
24
|
get("user/#{user_id}/activities/date/#{format_date(date)}.json", opts)
|
22
25
|
end
|
23
26
|
|
24
|
-
# Retrieves a list of a user's frequent activities in the format requested using
|
25
|
-
#
|
27
|
+
# Retrieves a list of a user's frequent activities in the format requested using
|
28
|
+
# units in the unit system which corresponds to the Accept-Language header provided.
|
26
29
|
|
27
30
|
def frequent_activities(opts={})
|
28
31
|
get("user/#{user_id}/activities/frequent.json", opts)
|
@@ -38,22 +41,24 @@ module FitbitAPI
|
|
38
41
|
get("user/#{user_id}/activities/favorite.json", opts)
|
39
42
|
end
|
40
43
|
|
41
|
-
# Gets a tree of all valid Fitbit public activities from
|
42
|
-
#
|
44
|
+
# Gets a tree of all valid Fitbit public activities from the activities catalog
|
45
|
+
# as well as private custom activities the user created.
|
43
46
|
|
44
47
|
def all_activities(opts={})
|
45
48
|
get('activities.json', opts)
|
46
49
|
end
|
47
50
|
|
48
|
-
# Retrieves a list of a user's activity log entries before or after a given day
|
49
|
-
#
|
50
|
-
|
51
|
-
#
|
52
|
-
#
|
53
|
-
#
|
54
|
-
#
|
55
|
-
#
|
56
|
-
#
|
51
|
+
# Retrieves a list of a user's activity log entries before or after a given day
|
52
|
+
# with offset and limit using units in the unit system which corresponds to the
|
53
|
+
# Accept-Language header provided.
|
54
|
+
#
|
55
|
+
# activity_logs_list(before_date: Date.parse('2021-05-24'), limit: 5)
|
56
|
+
#
|
57
|
+
# @option before_date [Date] Specify when filtering entries that occured before the given date
|
58
|
+
# @option after_date [Date] Specify when filtering entries that occured after the given date
|
59
|
+
# @option sort [String] the Sort order of entries by date (asc or desc)
|
60
|
+
# @option offset [Integer] The offset number of entries. Must always be 0
|
61
|
+
# @option limit [Integer] The max of the number of entries returned (max: 20)
|
57
62
|
|
58
63
|
def activity_logs_list(opts={})
|
59
64
|
opts[:params] = {}
|
@@ -68,16 +73,18 @@ module FitbitAPI
|
|
68
73
|
end
|
69
74
|
|
70
75
|
# Returns the details of a specific activity in the Fitbit activities database in the format requested.
|
71
|
-
#
|
76
|
+
# If activity has levels, also returns a list of activity level details.
|
77
|
+
#
|
78
|
+
# @param activity_id [Integer, String] The ID of the desired activity to retrieve
|
72
79
|
|
73
80
|
def activity(activity_id)
|
74
81
|
get("activities/#{activity_id}.json")
|
75
82
|
end
|
76
83
|
|
77
84
|
# Retrieves the user's activity statistics in the format requested using units
|
78
|
-
#
|
79
|
-
#
|
80
|
-
#
|
85
|
+
# in the unit system which corresponds to the Accept-Language header provided.
|
86
|
+
# Activity statistics includes Lifetime and Best achievement values from the
|
87
|
+
# My Achievements tile on the website dashboard.
|
81
88
|
|
82
89
|
def lifetime_stats(opts={})
|
83
90
|
get("user/#{user_id}/activities.json", opts)
|
@@ -142,23 +149,26 @@ module FitbitAPI
|
|
142
149
|
# ===============
|
143
150
|
|
144
151
|
# Creates log entry for an activity or user's private custom activity using units
|
145
|
-
#
|
146
|
-
|
147
|
-
#
|
148
|
-
#
|
149
|
-
#
|
150
|
-
#
|
151
|
-
#
|
152
|
-
#
|
153
|
-
#
|
154
|
-
#
|
155
|
-
#
|
152
|
+
# in the unit system which corresponds to the Accept-Language header provided.
|
153
|
+
#
|
154
|
+
# log_activity(body: { activity_id: 90013, manual_calories: 300, duration_millis: 6000000 })
|
155
|
+
#
|
156
|
+
# @option activity_id [Integer, String] The activity ID
|
157
|
+
# @option activity_name [String] Custom activity name. Either activity ID or activity_name must be provided
|
158
|
+
# @option manual_calories [Integer] Calories burned, specified manually. Required with activity_name, otherwise optional
|
159
|
+
# @option start_time [String] Activity start time; formatted in HH:mm:ss
|
160
|
+
# @option duration_millis [Integer] Duration in milliseconds
|
161
|
+
# @option date [String] Log entry date; formatted in yyyy-MM-dd
|
162
|
+
# @option distance [Integer] Distance; required for logging directory activity
|
163
|
+
# @option distance_unit [String] Distance measurement unit
|
156
164
|
|
157
165
|
def log_activity(opts)
|
158
166
|
post("user/#{user_id}/activities.json", opts)
|
159
167
|
end
|
160
168
|
|
161
169
|
# Adds the activity with the given ID to user's list of favorite activities.
|
170
|
+
#
|
171
|
+
# @param activity_id [Integer] The activity ID
|
162
172
|
|
163
173
|
def add_favorite_activity(activity_id)
|
164
174
|
post("user/#{user_id}/activities/favorite/#{activity_id}.json")
|
@@ -168,12 +178,16 @@ module FitbitAPI
|
|
168
178
|
# =================
|
169
179
|
|
170
180
|
# Deletes a user's activity log entry with the given ID.
|
181
|
+
#
|
182
|
+
# @param activity_log_id [Integer] The ID of the activity log entry
|
171
183
|
|
172
184
|
def delete_activity(activity_log_id)
|
173
185
|
delete("user/#{user_id}/activities/#{activity_log_id}.json")
|
174
186
|
end
|
175
187
|
|
176
188
|
# Removes the activity with the given ID from a user's list of favorite activities.
|
189
|
+
#
|
190
|
+
# @param activity_id [Integer] The ID of the activity to be removed
|
177
191
|
|
178
192
|
def delete_favorite_activity(activity_id)
|
179
193
|
delete("user/#{user_id}/activities/favorite/#{activity_id}.json")
|
data/lib/fitbit_api/alarms.rb
CHANGED
@@ -4,6 +4,8 @@ module FitbitAPI
|
|
4
4
|
# ==========
|
5
5
|
|
6
6
|
# Returns a list of the set alarms connected to a user's account.
|
7
|
+
#
|
8
|
+
# @params tracker_id [Integer] The ID of the tracker for which the data is returned
|
7
9
|
|
8
10
|
def alarms(tracker_id, opts={})
|
9
11
|
get("user/#{user_id}/devices/tracker/#{tracker_id}/alarms.json", opts)
|
@@ -13,28 +15,33 @@ module FitbitAPI
|
|
13
15
|
# ===========
|
14
16
|
|
15
17
|
# Adds the alarm settings to a given ID for a given device.
|
16
|
-
|
17
|
-
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
18
|
+
#
|
19
|
+
# add_alarm(body: { time: "07:15-08:00", enabled: true, recurring: true, week_days: "MONDAY,FRIDAY,SATURDAY" })
|
20
|
+
#
|
21
|
+
# @param tracker_id [Integer] The ID of the tracker for which the alarm is created
|
22
|
+
#
|
23
|
+
# @option time [String] Time of day that the alarm vibrates with a UTC timezone offset, e.g. 07:15-08:00
|
24
|
+
# @option enabled [Boolean] If false, alarm does not vibrate until enabled is set to true
|
25
|
+
# @option recurring [Boolean] If false, the alarm is a single event
|
26
|
+
# @option week_days [String] Comma separated list of days of the week on which the alarm vibrates (MONDAY,TUESDAY)
|
22
27
|
|
23
28
|
def add_alarm(tracker_id, opts={})
|
24
29
|
post("user/#{user_id}/devices/tracker/#{tracker_id}/alarms.json", opts)
|
25
30
|
end
|
26
31
|
|
27
32
|
# Updates the alarm entry with a given ID for a given device.
|
28
|
-
|
29
|
-
#
|
30
|
-
#
|
31
|
-
#
|
32
|
-
#
|
33
|
-
#
|
34
|
-
#
|
35
|
-
#
|
36
|
-
#
|
37
|
-
#
|
33
|
+
#
|
34
|
+
# @param tracker_id [Integer] The ID of the tracker for which the alarm is created
|
35
|
+
# @param alarm_id [Integer] The ID of the alarm to be updated
|
36
|
+
#
|
37
|
+
# @option time [String] Time of day that the alarm vibrates with a UTC timezone offset, e.g. 07:15-08:00
|
38
|
+
# @option enabled [Boolean] If false, alarm does not vibrate until enabled is set to true
|
39
|
+
# @option recurring [Boolean] If false, the alarm is a single event
|
40
|
+
# @option week_days [String] Comma separated list of days of the week on which the alarm vibrates (MONDAY,TUESDAY)
|
41
|
+
# @option snooze_length [Integer] Minutes between alarms
|
42
|
+
# @option snooze_count [Integer] Maximum snooze count
|
43
|
+
# @option label [String] Label for alarm
|
44
|
+
# @option vibe [String] Vibe pattern; only one value for now (DEFAULT)
|
38
45
|
|
39
46
|
def update_alarm(tracker_id, alarm_id, opts={})
|
40
47
|
post("user/#{user_id}/devices/tracker/#{tracker_id}/alarms/#{alarm_id}.json", opts)
|
@@ -44,6 +51,9 @@ module FitbitAPI
|
|
44
51
|
# =============
|
45
52
|
|
46
53
|
# Deletes the user's device alarm entry with the given ID for a given device.
|
54
|
+
#
|
55
|
+
# @param tracker_id [Integer] The ID of the tracker for which the alarm is to be deleted
|
56
|
+
# @param alarm_id [Integer] The ID of the alarm to be deleted
|
47
57
|
|
48
58
|
def delete_alarm(tracker_id, alarm_id, opts={})
|
49
59
|
delete("user/#{user_id}/devices/tracker/#{tracker_id}/alarms/#{alarm_id}.json", opts)
|
data/lib/fitbit_api/base.rb
CHANGED
data/lib/fitbit_api/client.rb
CHANGED
@@ -14,8 +14,8 @@ require 'fitbit_api/water'
|
|
14
14
|
module FitbitAPI
|
15
15
|
class Client
|
16
16
|
attr_accessor :api_version, :unit_system, :locale, :scope,
|
17
|
-
:snake_case_keys, :symbolize_keys
|
18
|
-
attr_reader :user_id
|
17
|
+
:snake_case_keys, :symbolize_keys, :auto_refresh_token, :on_token_refresh
|
18
|
+
attr_reader :token, :user_id
|
19
19
|
|
20
20
|
def initialize(opts={})
|
21
21
|
validate_args(opts)
|
@@ -32,57 +32,30 @@ module FitbitAPI
|
|
32
32
|
@token = @client.auth_code.get_token(
|
33
33
|
auth_code,
|
34
34
|
redirect_uri: @redirect_uri,
|
35
|
-
headers:
|
35
|
+
headers: auth_headers
|
36
36
|
)
|
37
37
|
@user_id = @token.params['user_id']
|
38
38
|
@token
|
39
39
|
end
|
40
40
|
|
41
|
-
def token
|
42
|
-
@token.expired? ? refresh_token! : @token
|
43
|
-
end
|
44
|
-
|
45
41
|
def refresh_token!
|
46
|
-
@token = @token.refresh!(headers:
|
42
|
+
@token = @token.refresh!(headers: auth_headers)
|
47
43
|
@user_id ||= @token.params['user_id']
|
48
|
-
@token
|
49
|
-
end
|
50
|
-
|
51
|
-
def auth_header
|
52
|
-
{ 'Authorization' => ('Basic ' + Base64.encode64(@client_id + ':' + @client_secret)) }
|
53
|
-
end
|
44
|
+
on_token_refresh.call(@token) if on_token_refresh.respond_to?(:call)
|
54
45
|
|
55
|
-
|
56
|
-
{
|
57
|
-
'User-Agent' => "fitbit_api gem (v#{FitbitAPI::VERSION})",
|
58
|
-
'Accept-Language' => @unit_system,
|
59
|
-
'Accept-Locale' => @locale
|
60
|
-
}
|
46
|
+
@token
|
61
47
|
end
|
62
48
|
|
63
49
|
def get(path, opts={})
|
64
|
-
|
65
|
-
response = token.get(("#{@api_version}/" + path), params: deep_keys_to_camel_case!(params), headers: request_headers).response
|
66
|
-
object = MultiJson.load(response.body) unless response.status == 204
|
67
|
-
process_keys!(object, opts)
|
50
|
+
request(:get, path, opts)
|
68
51
|
end
|
69
52
|
|
70
53
|
def post(path, opts={})
|
71
|
-
|
72
|
-
object = MultiJson.load(response.body) unless response.status == 204
|
73
|
-
process_keys!(object, opts)
|
54
|
+
request(:post, path, opts)
|
74
55
|
end
|
75
56
|
|
76
57
|
def delete(path, opts={})
|
77
|
-
|
78
|
-
object = MultiJson.load(response.body) unless response.status == 204
|
79
|
-
process_keys!(object, opts)
|
80
|
-
end
|
81
|
-
|
82
|
-
def process_keys!(object, opts={})
|
83
|
-
deep_keys_to_snake_case!(object) if (opts[:snake_case_keys] || snake_case_keys)
|
84
|
-
deep_symbolize_keys!(object) if (opts[:symbolize_keys] || symbolize_keys)
|
85
|
-
return object
|
58
|
+
request(:delete, path, opts)
|
86
59
|
end
|
87
60
|
|
88
61
|
private
|
@@ -103,7 +76,8 @@ module FitbitAPI
|
|
103
76
|
def assign_attrs(opts)
|
104
77
|
attrs = %i[client_id client_secret redirect_uri site_url
|
105
78
|
authorize_url token_url unit_system locale scope
|
106
|
-
api_version snake_case_keys symbolize_keys
|
79
|
+
api_version snake_case_keys symbolize_keys
|
80
|
+
auto_refresh_token on_token_refresh].freeze
|
107
81
|
|
108
82
|
attrs.each do |attr|
|
109
83
|
instance_variable_set("@#{attr}", (opts[attr] || FitbitAPI.send(attr)))
|
@@ -139,5 +113,38 @@ module FitbitAPI
|
|
139
113
|
|
140
114
|
refresh_token! if @token.token.empty?
|
141
115
|
end
|
116
|
+
|
117
|
+
def request(verb, path, opts={})
|
118
|
+
request_path = "#{@api_version}/#{path}"
|
119
|
+
request_options = opts.merge(headers: request_headers)
|
120
|
+
|
121
|
+
deep_keys_to_camel_case!(request_options[:params])
|
122
|
+
deep_keys_to_camel_case!(request_options[:body])
|
123
|
+
|
124
|
+
refresh_token! if auto_refresh_token && token.expired?
|
125
|
+
|
126
|
+
response = token.public_send(verb, request_path, request_options).response
|
127
|
+
object = MultiJson.load(response.body) unless response.status == 204
|
128
|
+
|
129
|
+
process_keys!(object, opts)
|
130
|
+
end
|
131
|
+
|
132
|
+
def auth_headers
|
133
|
+
{ 'Authorization' => ('Basic ' + Base64.encode64(@client_id + ':' + @client_secret)) }
|
134
|
+
end
|
135
|
+
|
136
|
+
def request_headers
|
137
|
+
{
|
138
|
+
'User-Agent' => "fitbit_api gem (v#{FitbitAPI::VERSION})",
|
139
|
+
'Accept-Language' => @unit_system,
|
140
|
+
'Accept-Locale' => @locale
|
141
|
+
}
|
142
|
+
end
|
143
|
+
|
144
|
+
def process_keys!(object, opts={})
|
145
|
+
deep_keys_to_snake_case!(object) if (opts[:snake_case_keys] || snake_case_keys)
|
146
|
+
deep_symbolize_keys!(object) if (opts[:symbolize_keys] || symbolize_keys)
|
147
|
+
return object
|
148
|
+
end
|
142
149
|
end
|
143
150
|
end
|
data/lib/fitbit_api/goals.rb
CHANGED
@@ -31,28 +31,30 @@ module FitbitAPI
|
|
31
31
|
# ==========
|
32
32
|
|
33
33
|
# Creates or updates a user's daily activity goals and returns a response using units
|
34
|
-
#
|
35
|
-
|
36
|
-
#
|
37
|
-
#
|
38
|
-
#
|
39
|
-
#
|
40
|
-
#
|
41
|
-
#
|
34
|
+
# in the unit system which corresponds to the Accept-Language header provided.
|
35
|
+
#
|
36
|
+
# create_or_update_daily_goals(body: {calories_out: 2000, active_minutes: 90, floors: 5})
|
37
|
+
#
|
38
|
+
# @option calories_out [Integer] Calories output goal value
|
39
|
+
# @option active_minutes [Integer] Active minutes goal value
|
40
|
+
# @option floors [Integer] Floor goal value
|
41
|
+
# @option distance [Integer, Float] Distance goal value
|
42
|
+
# @option steps [Integer] Steps goal value
|
42
43
|
|
43
44
|
def create_or_update_daily_goals(opts={})
|
44
45
|
post("user/#{user_id}/activities/goals/daily.json", opts)
|
45
46
|
end
|
46
47
|
|
47
48
|
# Creates or updates a user's weekly activity goals and returns a response using units
|
48
|
-
#
|
49
|
-
|
50
|
-
#
|
51
|
-
#
|
52
|
-
#
|
53
|
-
#
|
54
|
-
#
|
55
|
-
#
|
49
|
+
# in the unit system which corresponds to the Accept-Language header provided.
|
50
|
+
#
|
51
|
+
# create_or_update_weekly_goals(body: { active_minutes: 300, floors: 20 })
|
52
|
+
#
|
53
|
+
# @option calories_out [Integer] Calories output goal value
|
54
|
+
# @option active_minutes [Integer] Active minutes goal value
|
55
|
+
# @option floors [Integer] Floor goal value
|
56
|
+
# @option distance [Integer, Float] Distance goal value
|
57
|
+
# @option steps [Integer] Steps goal value
|
56
58
|
|
57
59
|
def create_or_update_weekly_goals(opts={})
|
58
60
|
post("user/#{user_id}/activities/goals/weekly.json", opts)
|
@@ -1,25 +1,27 @@
|
|
1
|
-
module
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
module FitbitAPI
|
2
|
+
module Configuration
|
3
|
+
def configure
|
4
|
+
yield self
|
5
|
+
end
|
5
6
|
|
6
|
-
|
7
|
-
|
7
|
+
def define_setting(name, default = nil)
|
8
|
+
class_variable_set("@@#{name}", default)
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
10
|
+
define_class_method "#{name}=" do |value|
|
11
|
+
class_variable_set("@@#{name}", value)
|
12
|
+
end
|
12
13
|
|
13
|
-
|
14
|
-
|
14
|
+
define_class_method name do
|
15
|
+
class_variable_get("@@#{name}")
|
16
|
+
end
|
15
17
|
end
|
16
|
-
end
|
17
18
|
|
18
|
-
|
19
|
+
private
|
19
20
|
|
20
|
-
|
21
|
-
|
22
|
-
|
21
|
+
def define_class_method(name, &block)
|
22
|
+
(class << self; self; end).instance_eval do
|
23
|
+
define_method name, &block
|
24
|
+
end
|
23
25
|
end
|
24
26
|
end
|
25
27
|
end
|
data/lib/fitbit_api/version.rb
CHANGED
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.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zoran
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oauth2
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '2.
|
47
|
+
version: '2.3'
|
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: '2.
|
54
|
+
version: '2.3'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
132
|
- !ruby/object:Gem::Version
|
133
133
|
version: '0'
|
134
134
|
requirements: []
|
135
|
-
rubygems_version: 3.
|
135
|
+
rubygems_version: 3.3.13
|
136
136
|
signing_key:
|
137
137
|
specification_version: 4
|
138
138
|
summary: A Ruby interface to the Fitbit Web API.
|