fitbyte 0.2.7 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/lib/fitbyte/activities.rb +0 -40
- data/lib/fitbyte/alarms.rb +45 -0
- data/lib/fitbyte/client.rb +2 -1
- data/lib/fitbyte/goals.rb +49 -0
- data/lib/fitbyte/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 188fb792651e2f58e5b51a49dfb3bbe76e1041f5
|
4
|
+
data.tar.gz: 157ba5a0dc5568fa3ebab5fa928c8247a48af471
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb907a686839076b47a7913a7aab8a1d55e02d3a081b7f758ad89eed182b9302ae6c8ffa99f7d0a96f142387b6769a9795ffaec05c915baaff2e24f019b18dbc
|
7
|
+
data.tar.gz: f4537f148799ef45a6e028cbbf74d3db11f5d887230145b59938bae90eb6a5e956ec75df732267cecb56953b871f06ba28e6675c2ae791b0a606860abba86f92
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
0.3.0
|
2
|
+
-----
|
3
|
+
- API endpoint support for the following actions:
|
4
|
+
- Add alarm
|
5
|
+
- Update alarm
|
6
|
+
- Delete alarm
|
7
|
+
- File reorganization
|
8
|
+
|
9
|
+
0.2.7
|
10
|
+
-----
|
11
|
+
- Set minimum required Ruby version
|
12
|
+
- Minor testing tweaks for Travis CI
|
13
|
+
|
1
14
|
0.2.6
|
2
15
|
-----
|
3
16
|
- Expand API endpoint support for the following actions:
|
data/lib/fitbyte/activities.rb
CHANGED
@@ -64,18 +64,6 @@ module Fitbyte
|
|
64
64
|
get("user/#{@user_id}/activities.json", opts)
|
65
65
|
end
|
66
66
|
|
67
|
-
# Retrieves a user's current daily activity goals.
|
68
|
-
|
69
|
-
def daily_goals(opts={})
|
70
|
-
get("user/#{@user_id}/activities/goals/daily.json", opts)
|
71
|
-
end
|
72
|
-
|
73
|
-
# Retrieves a user's current weekly activity goals.
|
74
|
-
|
75
|
-
def weekly_goals(opts={})
|
76
|
-
get("user/#{@user_id}/activities/goals/weekly.json", opts)
|
77
|
-
end
|
78
|
-
|
79
67
|
# POST Activities
|
80
68
|
# ===============
|
81
69
|
|
@@ -102,34 +90,6 @@ module Fitbyte
|
|
102
90
|
post("user/#{@user_id}/activities/favorite/#{activity_id}.json")
|
103
91
|
end
|
104
92
|
|
105
|
-
# Creates or updates a user's daily activity goals and returns a response using units
|
106
|
-
# in the unit system which corresponds to the Accept-Language header provided.
|
107
|
-
|
108
|
-
# ==== POST Parameters
|
109
|
-
# * +:caloriesOut+ - calories output goal value; integer
|
110
|
-
# * +:activeMinutes+ - active minutes goal value; integer
|
111
|
-
# * +:floors+ - floor goal value; integer
|
112
|
-
# * +:distance+ - distance goal value; X.XX or integer
|
113
|
-
# * +:steps+ - steps goal value; integer
|
114
|
-
|
115
|
-
def create_or_update_daily_goals(opts={})
|
116
|
-
post("user/#{@user_id}/activities/goals/daily.json", opts)
|
117
|
-
end
|
118
|
-
|
119
|
-
# Creates or updates a user's weekly activity goals and returns a response using units
|
120
|
-
# in the unit system which corresponds to the Accept-Language header provided.
|
121
|
-
|
122
|
-
# ==== POST Parameters
|
123
|
-
# * +:caloriesOut+ - calories output goal value; integer
|
124
|
-
# * +:activeMinutes+ - active minutes goal value; integer
|
125
|
-
# * +:floors+ - floor goal value; integer
|
126
|
-
# * +:distance+ - distance goal value; X.XX or integer
|
127
|
-
# * +:steps+ - steps goal value; integer
|
128
|
-
|
129
|
-
def create_or_update_weekly_goals(opts={})
|
130
|
-
post("user/#{@user_id}/activities/goals/weekly.json", opts)
|
131
|
-
end
|
132
|
-
|
133
93
|
# DELETE Activities
|
134
94
|
# =================
|
135
95
|
|
data/lib/fitbyte/alarms.rb
CHANGED
@@ -1,7 +1,52 @@
|
|
1
1
|
module Fitbyte
|
2
2
|
class Client
|
3
|
+
# GET Alarms
|
4
|
+
# ==========
|
5
|
+
|
6
|
+
# Returns a list of the set alarms connected to a user's account.
|
7
|
+
|
3
8
|
def alarms(tracker_id, opts={})
|
4
9
|
get("user/#{@user_id}/devices/tracker/#{tracker_id}/alarms.json", opts)
|
5
10
|
end
|
11
|
+
|
12
|
+
# POST Alarms
|
13
|
+
# ===========
|
14
|
+
|
15
|
+
# Adds the alarm settings to a given ID for a given device.
|
16
|
+
|
17
|
+
# ==== POST Parameters
|
18
|
+
# * +:time+ - time of day that the alarm vibrates with a UTC timezone offset, e.g. 07:15-08:00
|
19
|
+
# * +:enabled+ - boolean; if false, alarm does not vibrate until enabled is set to true
|
20
|
+
# * +:recurring+ - boolean; if false, the alarm is a single event
|
21
|
+
# * +:weekDays+ - comma separated list of days of the week on which the alarm vibrates (MONDAY,TUESDAY)
|
22
|
+
|
23
|
+
def add_alarm(tracker_id, opts={})
|
24
|
+
post("user/#{@user_id}/devices/tracker/#{tracker_id}/alarms.json", opts)
|
25
|
+
end
|
26
|
+
|
27
|
+
# Updates the alarm entry with a given ID for a given device.
|
28
|
+
|
29
|
+
# ==== POST Parameters
|
30
|
+
# * +:time+ - time of day that the alarm vibrates with a UTC timezone offset, e.g. 07:15-08:00
|
31
|
+
# * +:enabled+ - boolean; if false, alarm does not vibrate until enabled is set to true
|
32
|
+
# * +:recurring+ - boolean; if false, the alarm is a single event
|
33
|
+
# * +:weekDays+ - comma separated list of days of the week on which the alarm vibrates (MONDAY,TUESDAY)
|
34
|
+
# * +:snoozeLength+ - integer; minutes between alarms
|
35
|
+
# * +:snoozeCount+ - integer; maximum snooze count
|
36
|
+
# * +:label+ - string; label for alarm
|
37
|
+
# * +:vibe+ - vibe pattern; only one value for now (DEFAULT)
|
38
|
+
|
39
|
+
def update_alarm(tracker_id, alarm_id, opts={})
|
40
|
+
post("user/#{@user_id}/devices/tracker/#{tracker_id}/alarms/#{alarm_id}.json", opts)
|
41
|
+
end
|
42
|
+
|
43
|
+
# DELETE Alarms
|
44
|
+
# =============
|
45
|
+
|
46
|
+
# Deletes the user's device alarm entry with the given ID for a given device.
|
47
|
+
|
48
|
+
def delete_alarm(tracker_id, alarm_id, opts={})
|
49
|
+
delete("user/#{@user_id}/devices/tracker/#{tracker_id}/alarms/#{alarm_id}.json", opts)
|
50
|
+
end
|
6
51
|
end
|
7
52
|
end
|
data/lib/fitbyte/client.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require "fitbyte/fitstruct"
|
2
2
|
require "fitbyte/helpers"
|
3
3
|
require "fitbyte/activities"
|
4
|
+
require "fitbyte/goals"
|
4
5
|
require "fitbyte/alarms"
|
5
6
|
require "fitbyte/body"
|
6
7
|
require "fitbyte/devices"
|
@@ -16,7 +17,7 @@ module Fitbyte
|
|
16
17
|
|
17
18
|
def initialize(opts)
|
18
19
|
missing_args = [:client_id, :client_secret, :redirect_uri] - opts.keys
|
19
|
-
raise ArgumentError, "Required arguments: #{
|
20
|
+
raise ArgumentError, "Required arguments: #{missing_args.join(', ')}" if missing_args.size > 0
|
20
21
|
|
21
22
|
opts = defaults.merge(opts)
|
22
23
|
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Fitbyte
|
2
|
+
class Client
|
3
|
+
# GET Goals
|
4
|
+
# =========
|
5
|
+
|
6
|
+
# Retrieves a user's current daily activity goals.
|
7
|
+
|
8
|
+
def daily_goals(opts={})
|
9
|
+
get("user/#{@user_id}/activities/goals/daily.json", opts)
|
10
|
+
end
|
11
|
+
|
12
|
+
# Retrieves a user's current weekly activity goals.
|
13
|
+
|
14
|
+
def weekly_goals(opts={})
|
15
|
+
get("user/#{@user_id}/activities/goals/weekly.json", opts)
|
16
|
+
end
|
17
|
+
|
18
|
+
# POST Goals
|
19
|
+
# ==========
|
20
|
+
|
21
|
+
# Creates or updates a user's daily activity goals and returns a response using units
|
22
|
+
# in the unit system which corresponds to the Accept-Language header provided.
|
23
|
+
|
24
|
+
# ==== POST Parameters
|
25
|
+
# * +:caloriesOut+ - calories output goal value; integer
|
26
|
+
# * +:activeMinutes+ - active minutes goal value; integer
|
27
|
+
# * +:floors+ - floor goal value; integer
|
28
|
+
# * +:distance+ - distance goal value; X.XX or integer
|
29
|
+
# * +:steps+ - steps goal value; integer
|
30
|
+
|
31
|
+
def create_or_update_daily_goals(opts={})
|
32
|
+
post("user/#{@user_id}/activities/goals/daily.json", opts)
|
33
|
+
end
|
34
|
+
|
35
|
+
# Creates or updates a user's weekly activity goals and returns a response using units
|
36
|
+
# in the unit system which corresponds to the Accept-Language header provided.
|
37
|
+
|
38
|
+
# ==== POST Parameters
|
39
|
+
# * +:caloriesOut+ - calories output goal value; integer
|
40
|
+
# * +:activeMinutes+ - active minutes goal value; integer
|
41
|
+
# * +:floors+ - floor goal value; integer
|
42
|
+
# * +:distance+ - distance goal value; X.XX or integer
|
43
|
+
# * +:steps+ - steps goal value; integer
|
44
|
+
|
45
|
+
def create_or_update_weekly_goals(opts={})
|
46
|
+
post("user/#{@user_id}/activities/goals/weekly.json", opts)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
data/lib/fitbyte/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fitbyte
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zoran Pesic
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oauth2
|
@@ -93,6 +93,7 @@ files:
|
|
93
93
|
- lib/fitbyte/fitstruct.rb
|
94
94
|
- lib/fitbyte/food.rb
|
95
95
|
- lib/fitbyte/friends.rb
|
96
|
+
- lib/fitbyte/goals.rb
|
96
97
|
- lib/fitbyte/helpers.rb
|
97
98
|
- lib/fitbyte/sleep.rb
|
98
99
|
- lib/fitbyte/user.rb
|