todaysplan 0.3.0 → 0.4.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.
@@ -0,0 +1,198 @@
1
+ {
2
+ "powermeter": {
3
+ "id": 7187717,
4
+ "name": "STAGES"
5
+ },
6
+ "user": {
7
+ "_name": "Curt Wilhelm",
8
+ "id": 7186982,
9
+ "email": "curt@mtbcoach.com",
10
+ "firstname": "Curt",
11
+ "lastname": "Wilhelm",
12
+ "isPremium": true
13
+ },
14
+ "vam": 545.0,
15
+ "idle": 38,
16
+ "_idle-display": "38s",
17
+ "review": "pending",
18
+ "_review-display": "Pending review",
19
+ "name": "GarminConnect-1531942393.fit",
20
+ "ts": 1484770778000,
21
+ "_ts-display": "1/18/17 1:19 PM",
22
+ "startTs": 1484770778000,
23
+ "_startTs-display": "1/18/17 1:19 PM",
24
+ "tz": "America/Denver",
25
+ "equipment": "road",
26
+ "_equipment-display": "Road",
27
+ "workout": "training",
28
+ "_workout-display": "Training",
29
+ "weight": 81.64656,
30
+ "_weight-display": "180.0 lb",
31
+ "training": 5601,
32
+ "_training-display": "1h:33m",
33
+ "elapsed": 5639,
34
+ "_elapsed-display": "1h:33m",
35
+ "vo2max": 44.96,
36
+ "_vo2max-display": "44.96",
37
+ "distance": 30387,
38
+ "_distance-display": "18.8 mi",
39
+ "tscorepwr": 128.0,
40
+ "_tscorepwr-display": "128 T-Score",
41
+ "tscorehr": 285.0,
42
+ "atBpm": 143,
43
+ "calories": 1273,
44
+ "kj": 1270,
45
+ "_kj-display": "1270 kj",
46
+ "np": 285,
47
+ "_np-display": "285 W",
48
+ "vi": 1.26,
49
+ "_vi-display": "1.26",
50
+ "iff": 0.91,
51
+ "_iff-display": "0.91 Intensity",
52
+ "wkg": 3.5,
53
+ "_wkg-display": "3.50 W/kg",
54
+ "thresholdWatts": 314,
55
+ "_thresholdWatts-display": "314 W",
56
+ "ascent": 848,
57
+ "_ascent-display": "2782.2 ft",
58
+ "descent": 827,
59
+ "_descent-display": "2713.3 ft",
60
+ "minAlt": 2488,
61
+ "_minAlt-display": "8162.7 ft",
62
+ "maxAlt": 2913,
63
+ "_maxAlt-display": "9557.1 ft",
64
+ "avgAlt": 2729,
65
+ "_avgAlt-display": "8953.4 ft",
66
+ "avgSpeed": 19.5,
67
+ "_avgSpeed-display": "12.1 mi/h",
68
+ "maxSpeed": 61.9,
69
+ "_maxSpeed-display": "38.4 mi/h",
70
+ "avgCadence": 87,
71
+ "maxCadence": 127,
72
+ "minSatHbP": 0.0,
73
+ "maxSatHbP": 0.0,
74
+ "avgSatHbP": 0.0,
75
+ "minTotHbC": 0.0,
76
+ "maxTotHbC": 0.0,
77
+ "avgTotHbC": 0.0,
78
+ "minTemp": 3,
79
+ "_minTemp-display": "37°F",
80
+ "maxTemp": 15,
81
+ "_maxTemp-display": "59°F",
82
+ "avgTemp": 6,
83
+ "_avgTemp-display": "42°F",
84
+ "minBpm": 75,
85
+ "avgBpm": 129,
86
+ "maxBpm": 157,
87
+ "avgWatts": 227,
88
+ "_avgWatts-display": "227 W",
89
+ "cp": 299,
90
+ "_cp-display": "299 W",
91
+ "maxWatts": 688,
92
+ "_maxWatts-display": "688 W",
93
+ "peak3secWatts": 671,
94
+ "_peak3secWatts-display": "671 W",
95
+ "peak4secWatts": 668,
96
+ "_peak4secWatts-display": "668 W",
97
+ "peak5secWatts": 664,
98
+ "_peak5secWatts-display": "664 W",
99
+ "peak10secWatts": 648,
100
+ "_peak10secWatts-display": "648 W",
101
+ "peak20secWatts": 602,
102
+ "_peak20secWatts-display": "602 W",
103
+ "peak30secWatts": 488,
104
+ "_peak30secWatts-display": "488 W",
105
+ "peak1minWatts": 417,
106
+ "_peak1minWatts-display": "417 W",
107
+ "peak2minWatts": 346,
108
+ "_peak2minWatts-display": "346 W",
109
+ "peak3minWatts": 332,
110
+ "_peak3minWatts-display": "332 W",
111
+ "peak5minWatts": 315,
112
+ "_peak5minWatts-display": "315 W",
113
+ "peak6minWatts": 314,
114
+ "_peak6minWatts-display": "314 W",
115
+ "peak10minWatts": 309,
116
+ "_peak10minWatts-display": "309 W",
117
+ "peak15minWatts": 303,
118
+ "_peak15minWatts-display": "303 W",
119
+ "peak20minWatts": 303,
120
+ "_peak20minWatts-display": "303 W",
121
+ "peak30minWatts": 279,
122
+ "_peak30minWatts-display": "279 W",
123
+ "peak40minWatts": 248,
124
+ "_peak40minWatts-display": "248 W",
125
+ "peak60minWatts": 235,
126
+ "_peak60minWatts-display": "235 W",
127
+ "avgGrade": 0.0,
128
+ "pwrManufacturer": "STAGES",
129
+ "pwrSerial": "62415010",
130
+ "pwrDiscardCnt": 0,
131
+ "_pwrDiscardCnt-display": "0",
132
+ "history": {
133
+ "last6months": {
134
+ "training": 33322,
135
+ "_training-display": "9h:15m",
136
+ "elapsed": 33600,
137
+ "_elapsed-display": "9h:20m",
138
+ "distance": 152208,
139
+ "_distance-display": "94.4 mi",
140
+ "ascent": 3952,
141
+ "_ascent-display": "12965.9 ft",
142
+ "descent": 3936,
143
+ "_descent-display": "12913.4 ft",
144
+ "minAlt": 1226,
145
+ "_minAlt-display": "4022.3 ft",
146
+ "maxAlt": 4834,
147
+ "_maxAlt-display": "15859.6 ft",
148
+ "avgAlt": 2732,
149
+ "_avgAlt-display": "8963.3 ft",
150
+ "avgSpeed": 81.79199999999999,
151
+ "_avgSpeed-display": "50.7 mi/h",
152
+ "maxSpeed": 31.4244,
153
+ "_maxSpeed-display": "19.5 mi/h",
154
+ "avgCadence": 90,
155
+ "maxCadence": 192,
156
+ "minTemp": -13,
157
+ "_minTemp-display": "9°F",
158
+ "maxTemp": 37,
159
+ "_maxTemp-display": "98°F",
160
+ "avgTemp": 12,
161
+ "_avgTemp-display": "53°F"
162
+ },
163
+ "thisday": {
164
+ "training": 10405,
165
+ "_training-display": "2h:53m",
166
+ "elapsed": 11602,
167
+ "_elapsed-display": "3h:13m",
168
+ "distance": 52066,
169
+ "_distance-display": "32.3 mi",
170
+ "ascent": 1334,
171
+ "_ascent-display": "4376.6 ft",
172
+ "descent": 3141,
173
+ "_descent-display": "10305.1 ft",
174
+ "minAlt": 2360,
175
+ "_minAlt-display": "7742.8 ft",
176
+ "maxAlt": 4834,
177
+ "_maxAlt-display": "15859.6 ft",
178
+ "avgAlt": 2781,
179
+ "_avgAlt-display": "9124.0 ft",
180
+ "avgSpeed": 75.57839999999999,
181
+ "_avgSpeed-display": "46.9 mi/h",
182
+ "maxSpeed": 30.456000000000003,
183
+ "_maxSpeed-display": "18.9 mi/h",
184
+ "avgCadence": 88,
185
+ "maxCadence": 175,
186
+ "minTemp": -5,
187
+ "_minTemp-display": "23°F",
188
+ "maxTemp": 29,
189
+ "_maxTemp-display": "84°F",
190
+ "avgTemp": 11,
191
+ "_avgTemp-display": "51°F"
192
+ }
193
+ },
194
+ "metadata": {
195
+ "overrides": []
196
+ },
197
+ "permissions": ["edit1", "edit2"]
198
+ }
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ describe TodaysPlan::Activity::Heartrate do
4
+
5
+
6
+ it "find activity" do
7
+ stub_request(:get, "#{TodaysPlan.endpoint}/plans/workouts/fragment/heartrate/8753794").
8
+ with(:headers => {'Accept'=>'application/json',
9
+ 'Authorization'=>'Bearer abc-123'}).
10
+ to_return(:status => 200, :body => File.read("spec/fixtures/activities/heartrate.json"), :headers => {})
11
+ activity = TodaysPlan::Activity::Heartrate.find(8753794)
12
+ expect(activity.min_bpm).to eq 81
13
+ end
14
+
15
+ end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ describe TodaysPlan::Activity::Power do
4
+
5
+
6
+ it "find activity" do
7
+ stub_request(:get, "#{TodaysPlan.endpoint}/plans/workouts/fragment/power/8753794").
8
+ with(:headers => {'Accept'=>'application/json',
9
+ 'Authorization'=>'Bearer abc-123'}).
10
+ to_return(:status => 200, :body => File.read("spec/fixtures/activities/power.json"), :headers => {})
11
+ activity = TodaysPlan::Activity::Power.find(8753794)
12
+ expect(activity.avg_watts).to eq 235
13
+ end
14
+
15
+ end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ describe TodaysPlan::Activity::Summary do
4
+
5
+
6
+ it "find activity" do
7
+ stub_request(:get, "#{TodaysPlan.endpoint}/plans/workouts/fragment/summary/8753794").
8
+ with(:headers => {'Accept'=>'application/json',
9
+ 'Authorization'=>'Bearer abc-123'}).
10
+ to_return(:status => 200, :body => File.read("spec/fixtures/activities/summary.json"), :headers => {})
11
+ activity = TodaysPlan::Activity::Summary.find(8753794)
12
+ expect(activity.min_bpm).to eq 75
13
+ end
14
+
15
+ end
@@ -20,4 +20,13 @@ describe TodaysPlan::Activity do
20
20
  expect(all[0]).to be_a(TodaysPlan::Activity)
21
21
  end
22
22
 
23
+ it "find activity" do
24
+ stub_request(:get, "#{TodaysPlan.endpoint}/plans/workouts/detailed/8753794").
25
+ with(:headers => {'Accept'=>'application/json',
26
+ 'Authorization'=>'Bearer abc-123'}).
27
+ to_return(:status => 200, :body => File.read("spec/fixtures/activities/activity.json"), :headers => {})
28
+ activity = TodaysPlan::Activity.find(8753794)
29
+ expect(activity.id).to eq 8753794
30
+ end
31
+
23
32
  end
@@ -40,8 +40,8 @@ describe TodaysPlan::User do
40
40
  end
41
41
 
42
42
  it "register user" do
43
- options = {user_email: 'joeathlete@example.com', firstname: 'joe',
44
- lastname: 'athlete', password:'password', coach_email: 'coach@email.com'}
43
+ options = {email: 'joeathlete@example.com', firstname: 'joe',
44
+ lastname: 'athlete', password:'password'}
45
45
  # preregister
46
46
  stub_request(:get, "#{TodaysPlan.endpoint}/auth/preregister").
47
47
  with(:headers => {'Accept'=>'*/*'}).
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: todaysplan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Curt Wilhelm
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-17 00:00:00.000000000 Z
11
+ date: 2017-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -92,19 +92,29 @@ files:
92
92
  - Rakefile
93
93
  - lib/todays_plan.rb
94
94
  - lib/todays_plan/activity.rb
95
+ - lib/todays_plan/activity/heartrate.rb
96
+ - lib/todays_plan/activity/power.rb
97
+ - lib/todays_plan/activity/summary.rb
95
98
  - lib/todays_plan/client.rb
96
99
  - lib/todays_plan/connector.rb
97
100
  - lib/todays_plan/errors.rb
98
101
  - lib/todays_plan/user.rb
99
102
  - lib/todays_plan/version.rb
103
+ - spec/fixtures/activities/activity.json
104
+ - spec/fixtures/activities/heartrate.json
100
105
  - spec/fixtures/activities/incomplete.json
101
106
  - spec/fixtures/activities/incomplete_response.json
107
+ - spec/fixtures/activities/power.json
108
+ - spec/fixtures/activities/summary.json
102
109
  - spec/fixtures/users/accept_response.json
103
110
  - spec/fixtures/users/delegates_response.json
104
111
  - spec/fixtures/users/invite_response.json
105
112
  - spec/fixtures/users/register_response.json
106
113
  - spec/fixtures/users/search_response.json
107
114
  - spec/spec_helper.rb
115
+ - spec/todays_plan/activity/heartrate_spec.rb
116
+ - spec/todays_plan/activity/power_spec.rb
117
+ - spec/todays_plan/activity/summary_spec.rb
108
118
  - spec/todays_plan/activity_spec.rb
109
119
  - spec/todays_plan/client_spec.rb
110
120
  - spec/todays_plan/connector_spec.rb
@@ -135,14 +145,21 @@ signing_key:
135
145
  specification_version: 4
136
146
  summary: A Ruby Library for TodaysPlan
137
147
  test_files:
148
+ - spec/fixtures/activities/activity.json
149
+ - spec/fixtures/activities/heartrate.json
138
150
  - spec/fixtures/activities/incomplete.json
139
151
  - spec/fixtures/activities/incomplete_response.json
152
+ - spec/fixtures/activities/power.json
153
+ - spec/fixtures/activities/summary.json
140
154
  - spec/fixtures/users/accept_response.json
141
155
  - spec/fixtures/users/delegates_response.json
142
156
  - spec/fixtures/users/invite_response.json
143
157
  - spec/fixtures/users/register_response.json
144
158
  - spec/fixtures/users/search_response.json
145
159
  - spec/spec_helper.rb
160
+ - spec/todays_plan/activity/heartrate_spec.rb
161
+ - spec/todays_plan/activity/power_spec.rb
162
+ - spec/todays_plan/activity/summary_spec.rb
146
163
  - spec/todays_plan/activity_spec.rb
147
164
  - spec/todays_plan/client_spec.rb
148
165
  - spec/todays_plan/connector_spec.rb