fitgem 0.3.5 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -25,10 +25,21 @@ module Fitgem
25
25
  get("/foods/units.json")
26
26
  end
27
27
 
28
+ # ==========================================
29
+ # Food Query Methods
30
+ # ==========================================
31
+
32
+ # Search the foods database
28
33
  def find_food(query_string)
29
34
  get("/foods/search.json?query=#{URI.escape(query_string)}")
30
35
  end
31
36
 
37
+ # Using the foodId field from the results of find_food(), query
38
+ # the details of a specific food
39
+ def food_info(food_id)
40
+ get("/foods/#{food_id}.json")
41
+ end
42
+
32
43
  # ==========================================
33
44
  # Food Update Methods
34
45
  # ==========================================
@@ -75,4 +86,4 @@ module Fitgem
75
86
  post("/foods.json", options)
76
87
  end
77
88
  end
78
- end
89
+ end
@@ -1,13 +1,11 @@
1
1
  module Fitgem
2
2
  class Client
3
-
4
3
  # Gets historical resource data in the time range specified by
5
- # options param. The time range can either be specified by
4
+ # options hash param. The time range can either be specified by
6
5
  # :base_date and :end_date OR by using :base_date and a :period
7
6
  # (supported periods are 1d, 7d, 30d, 1w, 1m, 3m, 6m, 1y, max)
8
7
  #
9
- # Example values for resource_path are below:
10
- #
8
+ # Supported values for resource_path are:
11
9
  # Food:
12
10
  # /foods/log/caloriesIn
13
11
  #
@@ -15,6 +13,8 @@ module Fitgem
15
13
  # /activities/log/calories
16
14
  # /activities/log/steps
17
15
  # /activities/log/distance
16
+ # /activities/log/floors
17
+ # /activities/log/elevation
18
18
  # /activities/log/minutesSedentary
19
19
  # /activities/log/minutesLightlyActive
20
20
  # /activities/log/minutesFairlyActive
@@ -32,11 +32,20 @@ module Fitgem
32
32
  # /body/weight
33
33
  # /body/bmi
34
34
  # /body/fat
35
+ #
36
+ # Examples
37
+ #
38
+ # * To get the floors traveled for the week of October 24th
39
+ # data_by_time_range("/activities/log/floors", {:base_date => "2011-10-24", :period => "7d"})
40
+ #
41
+ # * To get all of the body weight logs from April 3rd until July 27th
42
+ # data_by_time_range("/body/weight", {:base_date => "2011-03-03", :end_date => "2011-07-27"})
43
+ #
35
44
  def data_by_time_range(resource_path, options)
36
45
  range_str = construct_date_range_fragment(options)
37
46
  get("/user/#{@user_id}#{resource_path}/#{range_str}.json")
38
47
  end
39
-
48
+
40
49
  def construct_date_range_fragment(options)
41
50
  range_str = "date/"
42
51
  if options[:base_date] && options[:period]
@@ -50,4 +59,4 @@ module Fitgem
50
59
  end
51
60
 
52
61
  end
53
- end
62
+ end
@@ -1,3 +1,3 @@
1
1
  module Fitgem
2
- VERSION = "0.3.5"
2
+ VERSION = "0.3.6"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: fitgem
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.3.5
5
+ version: 0.3.6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Zachery Moneypenny
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-09-12 00:00:00 -05:00
13
+ date: 2011-10-25 00:00:00 -05:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency