strava-ruby-client 0.2.0 → 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 +14 -0
- data/README.md +710 -88
- data/bin/strava-webhooks.rb +56 -0
- data/lib/strava-ruby-client.rb +37 -0
- data/lib/strava/api/client.rb +11 -141
- data/lib/strava/api/endpoints/activities.rb +120 -0
- data/lib/strava/api/endpoints/athletes.rb +42 -0
- data/lib/strava/api/endpoints/clubs.rb +75 -0
- data/lib/strava/api/endpoints/gears.rb +18 -0
- data/lib/strava/api/endpoints/routes.rb +55 -0
- data/lib/strava/api/endpoints/running_races.rb +30 -0
- data/lib/strava/api/endpoints/segment_efforts.rb +33 -0
- data/lib/strava/api/endpoints/segments.rb +111 -0
- data/lib/strava/api/endpoints/streams.rb +61 -0
- data/lib/strava/api/endpoints/uploads.rb +40 -0
- data/lib/strava/logger.rb +1 -1
- data/lib/strava/models/achievement.rb +9 -0
- data/lib/strava/models/activity.rb +11 -5
- data/lib/strava/models/activity_stats.rb +17 -0
- data/lib/strava/models/activity_total.rb +17 -0
- data/lib/strava/models/athlete.rb +10 -0
- data/lib/strava/models/club.rb +6 -0
- data/lib/strava/models/club_admin.rb +13 -0
- data/lib/strava/models/club_member.rb +16 -0
- data/lib/strava/models/explorer_segment.rb +19 -0
- data/lib/strava/models/gear.rb +5 -0
- data/lib/strava/models/heart_rate_zone_ranges.rb +8 -0
- data/lib/strava/models/kudoser.rb +10 -0
- data/lib/strava/models/lap.rb +3 -0
- data/lib/strava/models/mixins/distance.rb +18 -0
- data/lib/strava/models/power_zone_ranges.rb +7 -0
- data/lib/strava/models/route.rb +27 -0
- data/lib/strava/models/running_race.rb +33 -0
- data/lib/strava/models/segment.rb +15 -3
- data/lib/strava/models/segment_effort.rb +7 -2
- data/lib/strava/models/segment_leaderboard.rb +10 -0
- data/lib/strava/models/segment_leaderboard_entry.rb +12 -0
- data/lib/strava/models/segment_stats.rb +15 -0
- data/lib/strava/models/stream.rb +10 -0
- data/lib/strava/models/stream_set.rb +17 -0
- data/lib/strava/models/upload.rb +11 -0
- data/lib/strava/models/zone_range.rb +8 -0
- data/lib/strava/models/zones.rb +8 -0
- data/lib/strava/version.rb +1 -1
- data/lib/strava/web/client.rb +11 -1
- data/lib/strava/web/connection.rb +1 -1
- data/lib/strava/webhooks/client.rb +58 -0
- data/lib/strava/webhooks/config.rb +33 -0
- data/lib/strava/webhooks/models/challenge.rb +15 -0
- data/lib/strava/webhooks/models/event.rb +15 -0
- data/lib/strava/webhooks/models/subscription.rb +14 -0
- metadata +37 -2
@@ -0,0 +1,33 @@
|
|
1
|
+
module Strava
|
2
|
+
module Webhooks
|
3
|
+
module Config
|
4
|
+
extend self
|
5
|
+
|
6
|
+
ATTRIBUTES = %i[
|
7
|
+
endpoint
|
8
|
+
client_id
|
9
|
+
client_secret
|
10
|
+
].freeze
|
11
|
+
|
12
|
+
attr_accessor(*Config::ATTRIBUTES)
|
13
|
+
|
14
|
+
def reset
|
15
|
+
self.endpoint = 'https://api.strava.com/api/v3'
|
16
|
+
self.client_id = nil
|
17
|
+
self.client_secret = nil
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class << self
|
22
|
+
def configure
|
23
|
+
block_given? ? yield(Config) : Config
|
24
|
+
end
|
25
|
+
|
26
|
+
def config
|
27
|
+
Config
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
Strava::Webhooks::Config.reset
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Strava
|
2
|
+
module Webhooks
|
3
|
+
module Models
|
4
|
+
class Challenge < Hashie::Trash
|
5
|
+
property 'mode', from: 'hub.mode'
|
6
|
+
property 'verify_token', from: 'hub.verify_token'
|
7
|
+
property 'challenge', from: 'hub.challenge'
|
8
|
+
|
9
|
+
def response
|
10
|
+
{ 'hub.challenge' => challenge }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Strava
|
2
|
+
module Webhooks
|
3
|
+
module Models
|
4
|
+
class Event < Hashie::Trash
|
5
|
+
property 'object_type'
|
6
|
+
property 'object_id'
|
7
|
+
property 'aspect_type'
|
8
|
+
property 'updates'
|
9
|
+
property 'owner_id'
|
10
|
+
property 'subscription_id'
|
11
|
+
property 'event_time', transform_with: ->(v) { Time.at(v) }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Strava
|
2
|
+
module Webhooks
|
3
|
+
module Models
|
4
|
+
class Subscription < Hashie::Trash
|
5
|
+
property 'id'
|
6
|
+
property 'application_id'
|
7
|
+
property 'callback_url'
|
8
|
+
property 'resource_state'
|
9
|
+
property 'created_at', transform_with: ->(v) { Time.parse(v) }
|
10
|
+
property 'updated_at', transform_with: ->(v) { Time.parse(v) }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: strava-ruby-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Doubrovkine
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -76,18 +76,37 @@ files:
|
|
76
76
|
- LICENSE.md
|
77
77
|
- README.md
|
78
78
|
- bin/strava-oauth-token.rb
|
79
|
+
- bin/strava-webhooks.rb
|
79
80
|
- lib/strava-ruby-client.rb
|
80
81
|
- lib/strava/api/client.rb
|
81
82
|
- lib/strava/api/config.rb
|
82
83
|
- lib/strava/api/cursor.rb
|
84
|
+
- lib/strava/api/endpoints/activities.rb
|
85
|
+
- lib/strava/api/endpoints/athletes.rb
|
86
|
+
- lib/strava/api/endpoints/clubs.rb
|
87
|
+
- lib/strava/api/endpoints/gears.rb
|
88
|
+
- lib/strava/api/endpoints/routes.rb
|
89
|
+
- lib/strava/api/endpoints/running_races.rb
|
90
|
+
- lib/strava/api/endpoints/segment_efforts.rb
|
91
|
+
- lib/strava/api/endpoints/segments.rb
|
92
|
+
- lib/strava/api/endpoints/streams.rb
|
93
|
+
- lib/strava/api/endpoints/uploads.rb
|
83
94
|
- lib/strava/errors/fault.rb
|
84
95
|
- lib/strava/logger.rb
|
96
|
+
- lib/strava/models/achievement.rb
|
85
97
|
- lib/strava/models/activity.rb
|
98
|
+
- lib/strava/models/activity_stats.rb
|
99
|
+
- lib/strava/models/activity_total.rb
|
86
100
|
- lib/strava/models/activity_zone.rb
|
87
101
|
- lib/strava/models/athlete.rb
|
88
102
|
- lib/strava/models/club.rb
|
103
|
+
- lib/strava/models/club_admin.rb
|
104
|
+
- lib/strava/models/club_member.rb
|
89
105
|
- lib/strava/models/comment.rb
|
106
|
+
- lib/strava/models/explorer_segment.rb
|
90
107
|
- lib/strava/models/gear.rb
|
108
|
+
- lib/strava/models/heart_rate_zone_ranges.rb
|
109
|
+
- lib/strava/models/kudoser.rb
|
91
110
|
- lib/strava/models/lap.rb
|
92
111
|
- lib/strava/models/map.rb
|
93
112
|
- lib/strava/models/mixins/distance.rb
|
@@ -96,13 +115,24 @@ files:
|
|
96
115
|
- lib/strava/models/model.rb
|
97
116
|
- lib/strava/models/photo.rb
|
98
117
|
- lib/strava/models/photos.rb
|
118
|
+
- lib/strava/models/power_zone_ranges.rb
|
119
|
+
- lib/strava/models/route.rb
|
120
|
+
- lib/strava/models/running_race.rb
|
99
121
|
- lib/strava/models/segment.rb
|
100
122
|
- lib/strava/models/segment_effort.rb
|
123
|
+
- lib/strava/models/segment_leaderboard.rb
|
124
|
+
- lib/strava/models/segment_leaderboard_entry.rb
|
125
|
+
- lib/strava/models/segment_stats.rb
|
101
126
|
- lib/strava/models/similar_activities.rb
|
102
127
|
- lib/strava/models/split.rb
|
128
|
+
- lib/strava/models/stream.rb
|
129
|
+
- lib/strava/models/stream_set.rb
|
103
130
|
- lib/strava/models/timed_zone_range.rb
|
104
131
|
- lib/strava/models/token.rb
|
105
132
|
- lib/strava/models/trend.rb
|
133
|
+
- lib/strava/models/upload.rb
|
134
|
+
- lib/strava/models/zone_range.rb
|
135
|
+
- lib/strava/models/zones.rb
|
106
136
|
- lib/strava/oauth/client.rb
|
107
137
|
- lib/strava/oauth/config.rb
|
108
138
|
- lib/strava/version.rb
|
@@ -111,6 +141,11 @@ files:
|
|
111
141
|
- lib/strava/web/connection.rb
|
112
142
|
- lib/strava/web/raise_error.rb
|
113
143
|
- lib/strava/web/request.rb
|
144
|
+
- lib/strava/webhooks/client.rb
|
145
|
+
- lib/strava/webhooks/config.rb
|
146
|
+
- lib/strava/webhooks/models/challenge.rb
|
147
|
+
- lib/strava/webhooks/models/event.rb
|
148
|
+
- lib/strava/webhooks/models/subscription.rb
|
114
149
|
homepage: http://github.com/dblock/strava-ruby-client
|
115
150
|
licenses:
|
116
151
|
- MIT
|