fitgem_oauth2 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fd516d574175e9fe9b90dac5242b1222b030de67
4
- data.tar.gz: 789803a5149cc302e52db432445a805a45ab028e
3
+ metadata.gz: 455f84d71a7d18d7646a40c478fcd69a836bd244
4
+ data.tar.gz: 886c0ad18bc91f724879036e9cd50ae1c85d774e
5
5
  SHA512:
6
- metadata.gz: 9e73b564bc27fcbb69d86632f7c8a3686a92f661048e75381f36322ea020e33425f80c666b88e7b92ed51db3b57b122ecbaaf0eebde0f02db443e517a6940894
7
- data.tar.gz: 11cf3e2e0de03d356efba62cdcfbd0c80c38bb0386eada5cddf98635ff375fcefa654b354ddc59b6ada5136c3ef02e37dc6a059594185cd440d5351455be21fe
6
+ metadata.gz: 1028d59b79f3d3cf574cb9c66ac0df50cc3085190daa9ec309e29da7b0ede492bd37ea3545d48185a1dd1fdeca98ee872e4c894ed260142f5b6c028880bde92b
7
+ data.tar.gz: d36dbe9a999347f0c9e9bd12e34de67f5efd300bc100b0592c8f77d9ee42c09fe13e926667b416d99d9e2debe45860dc7f35ab23c298dbb8611457316fbcc7f8
@@ -1,6 +1,10 @@
1
1
  require 'fitgem_oauth2/activity.rb'
2
2
  require 'fitgem_oauth2/body_measurements.rb'
3
+ require 'fitgem_oauth2/devices.rb'
3
4
  require 'fitgem_oauth2/errors.rb'
5
+ require 'fitgem_oauth2/food.rb'
6
+ require 'fitgem_oauth2/friends.rb'
7
+ require 'fitgem_oauth2/heartrate.rb'
4
8
  require 'fitgem_oauth2/sleep.rb'
5
9
  require 'fitgem_oauth2/steps.rb'
6
10
  require 'fitgem_oauth2/users.rb'
@@ -0,0 +1,11 @@
1
+ module FitgemOauth2
2
+ class Client
3
+ def devices
4
+ get_call("1/user/#{@user_id}/devices.json")
5
+ end
6
+
7
+ def alarms(tracker_id)
8
+ get_call("1/user/#{@user_id}/devices/tracker/#{tracker_id}/alarms.json")
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,58 @@
1
+ module FitgemOauth2
2
+ class Client
3
+ def food_goal
4
+ get_call("1/user/#{@user_id}/foods/log/goal.json")
5
+ end
6
+
7
+ def foods_on_date(date)
8
+ get_call("1/user/#{@user_id}/foods/log/date/#{format_date(date)}.json")
9
+ end
10
+
11
+ def water_on_date(date)
12
+ get_call("1/user/#{@user_id}/foods/log/water/date/#{format_date(date)}.json")
13
+ end
14
+
15
+ def water_goal
16
+ get_call("1/user/#{@user_id}/foods/log/water/goal.json")
17
+ end
18
+
19
+ def food_in_period(resource, date, period)
20
+ food_resources = ["foods/log/caloriesIn", "foods/log/water"]
21
+ food_periods = %w("1d" "7d" "30d" "1w" "1m" "3m" "6m" "1y" "max")
22
+
23
+ unless resource && food_resources.include?(resource)
24
+ raise FitgemOauth2::InvalidArgumentError, "resource should be one of #{food_resources}"
25
+ end
26
+
27
+ unless period && food_periods.include?(period)
28
+ raise FitgemOauth2::InvalidArgumentError, "period should be one of #{food_periods}"
29
+ end
30
+
31
+ get_call("1/user/[user-id]/#{resource}/date/#{format_date(date)}/#{period}.json")
32
+
33
+ end
34
+
35
+ def food_in_range(resource, start_date, end_date)
36
+ food_resources = ["foods/log/caloriesIn", "foods/log/water"]
37
+
38
+ unless resource && food_resources.include?(resource)
39
+ raise FitgemOauth2::InvalidArgumentError, "resource should be one of #{food_resources}"
40
+ end
41
+
42
+ get_call("1/user/[user-id]/#{resource}/date/#{format_date(start_date)}/#{format_date(end_date)}.json")
43
+
44
+ end
45
+
46
+ def food(id)
47
+ get_call("1/foods/#{id}.json")
48
+ end
49
+
50
+ def food_units
51
+ get_call("1/foods/units.json")
52
+ end
53
+
54
+ def food_search
55
+ get_call("1/foods/search.json")
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,19 @@
1
+ module FitgemOauth2
2
+ class Client
3
+ def friends
4
+ get_call("1/user/#{@user_id}/friends.json")
5
+ end
6
+
7
+ def friends_leaderboard
8
+ get_call("1/user/#{@user_id}/friends/leaderboard.json")
9
+ end
10
+
11
+ def friend_invitations
12
+ get_call("1/user/#{@user_id}/friends/invitations.json")
13
+ end
14
+
15
+ def badges
16
+ get_call("1/user/#{@user_id}/badges.json")
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,53 @@
1
+ module FitgemOauth2
2
+ class Client
3
+
4
+ def hearrate_on_date(date)
5
+ get_call("1/user/#{@user_id}/activities/heart/date/#{format_date(date)}.json")
6
+ end
7
+
8
+ def hearrate_in_period(date, period)
9
+ periods = %w("1d" "7d" "30d" "1w" "1m")
10
+ unless period && periods.include?(period)
11
+ raise InvalidArgumentError, "period should be one of #{periods}"
12
+ end
13
+ get_call("1/user/#{@user_id}/activities/heart/date/#{format_date(date)}/#{period}.json")
14
+ end
15
+
16
+ def hearrate_in_range(start_date, start_range)
17
+ get_call("1/user/#{@user_id}/activities/heart/date/#{format_date(start_date)}/#{format_date(end_date)}.json")
18
+ end
19
+
20
+ def heartrate_series_in_range(start_date, end_date, detail_level)
21
+ detail_levels = %w("1sec" "1min")
22
+ unless detail_level && detail_levels.include?(detail_level)
23
+ raise InvalidArgumentError, "detail level should be one of #{detail_levels}"
24
+ end
25
+ get_call("/1/user/#{@user_id}/activities/heart/date/#{format_date(start_date)}/#{format_date(end_date)}/#{detail_level}.json")
26
+ end
27
+
28
+ def heartrate_series_in_range_time(start_date, end_date, detail_level, start_time, end_time)
29
+ detail_levels = %w("1sec" "1min")
30
+ unless detail_level && detail_levels.include?(detail_level)
31
+ raise InvalidArgumentError, "detail level should be one of #{detail_levels}"
32
+ end
33
+ get_call("1/user/#{@user_id}/activities/heart/date/#{format_date(start_date)}/#{format_date(end_date)}/#{detail_level}/time/#{start_time}/#{end_time}.json")
34
+ end
35
+
36
+ def hearrate_daily_series_in_range(start_date, detail_level)
37
+ detail_levels = %w("1sec" "1min")
38
+ unless detail_level && detail_levels.include?(detail_level)
39
+ raise InvalidArgumentError, "detail level should be one of #{detail_levels}"
40
+ end
41
+ get_call("1/user/#{@user_id}/activities/heart/date/#{format_date(start_date)}/1d/#{detail_level}.json")
42
+ end
43
+
44
+ def heartrate_daily_series_in_range_time(start_date, detail_level, start_time, end_time)
45
+ detail_levels = %w("1sec" "1min")
46
+ unless detail_level && detail_levels.include?(detail_level)
47
+ raise InvalidArgumentError, "detail level should be one of #{detail_levels}"
48
+ end
49
+ get_call("1/user/#{@user_id}/activities/heart/date/#{format_date(start_date)}/1d/#{detail_level}/time/#{start_time}/#{end_time}.json")
50
+ end
51
+
52
+ end
53
+ end
@@ -1,3 +1,3 @@
1
1
  module FitgemOauth2
2
- VERSION = '0.0.6'
2
+ VERSION = '0.0.7'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fitgem_oauth2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ankit Gupta
@@ -63,7 +63,11 @@ files:
63
63
  - lib/fitgem_oauth2/activity.rb
64
64
  - lib/fitgem_oauth2/body_measurements.rb
65
65
  - lib/fitgem_oauth2/client.rb
66
+ - lib/fitgem_oauth2/devices.rb
66
67
  - lib/fitgem_oauth2/errors.rb
68
+ - lib/fitgem_oauth2/food.rb
69
+ - lib/fitgem_oauth2/friends.rb
70
+ - lib/fitgem_oauth2/heartrate.rb
67
71
  - lib/fitgem_oauth2/sleep.rb
68
72
  - lib/fitgem_oauth2/steps.rb
69
73
  - lib/fitgem_oauth2/users.rb