strava-ruby-client 3.0.0 → 3.2.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.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +29 -0
  3. data/README.md +44 -995
  4. data/bin/strava-webhooks +50 -38
  5. data/lib/strava/api/client.rb +69 -0
  6. data/lib/strava/api/config.rb +40 -0
  7. data/lib/strava/api/cursor.rb +32 -1
  8. data/lib/strava/api/endpoints/activities.rb +197 -57
  9. data/lib/strava/api/endpoints/athletes.rb +64 -8
  10. data/lib/strava/api/endpoints/clubs.rb +24 -59
  11. data/lib/strava/api/endpoints/gears.rb +11 -2
  12. data/lib/strava/api/endpoints/oauth.rb +45 -0
  13. data/lib/strava/api/endpoints/routes.rb +20 -13
  14. data/lib/strava/api/endpoints/segment_efforts.rb +15 -8
  15. data/lib/strava/api/endpoints/segments.rb +74 -21
  16. data/lib/strava/api/endpoints/streams.rb +22 -18
  17. data/lib/strava/api/endpoints/uploads.rb +12 -2
  18. data/lib/strava/api/pagination.rb +26 -2
  19. data/lib/strava/api/ratelimit.rb +34 -0
  20. data/lib/strava/deep_copyable.rb +20 -1
  21. data/lib/strava/errors/fault.rb +32 -0
  22. data/lib/strava/errors/ratelimit_error.rb +35 -0
  23. data/lib/strava/errors/upload_error.rb +55 -0
  24. data/lib/strava/logger.rb +27 -0
  25. data/lib/strava/models/achievement.rb +28 -1
  26. data/lib/strava/models/activity_stats.rb +47 -1
  27. data/lib/strava/models/activity_total.rb +32 -1
  28. data/lib/strava/models/activity_zone.rb +46 -2
  29. data/lib/strava/models/authorization.rb +13 -0
  30. data/lib/strava/models/base_stream.rb +22 -1
  31. data/lib/strava/models/club_event.rb +66 -3
  32. data/lib/strava/models/comment.rb +40 -2
  33. data/lib/strava/models/destination.rb +28 -1
  34. data/lib/strava/models/detailed_activity.rb +211 -3
  35. data/lib/strava/models/detailed_athlete.rb +106 -4
  36. data/lib/strava/models/detailed_club.rb +76 -2
  37. data/lib/strava/models/detailed_gear.rb +45 -2
  38. data/lib/strava/models/detailed_photo.rb +64 -4
  39. data/lib/strava/models/detailed_photos.rb +36 -1
  40. data/lib/strava/models/detailed_segment.rb +98 -4
  41. data/lib/strava/models/detailed_segment_effort.rb +93 -4
  42. data/lib/strava/models/explorer_segment.rb +55 -2
  43. data/lib/strava/models/heart_rate_zone_ranges.rb +29 -1
  44. data/lib/strava/models/kudoser.rb +29 -1
  45. data/lib/strava/models/lap.rb +63 -3
  46. data/lib/strava/models/lat_lng.rb +42 -4
  47. data/lib/strava/models/local_legend.rb +41 -1
  48. data/lib/strava/models/map.rb +31 -0
  49. data/lib/strava/models/meta_activity.rb +15 -2
  50. data/lib/strava/models/meta_athlete.rb +17 -2
  51. data/lib/strava/models/meta_club.rb +15 -1
  52. data/lib/strava/models/mixins/average_speed.rb +81 -3
  53. data/lib/strava/models/mixins/distance.rb +25 -0
  54. data/lib/strava/models/mixins/elapsed_time.rb +18 -0
  55. data/lib/strava/models/mixins/elevation_difference.rb +42 -0
  56. data/lib/strava/models/mixins/elevation_gain.rb +39 -0
  57. data/lib/strava/models/mixins/estimated_moving_time.rb +18 -0
  58. data/lib/strava/models/mixins/http_response.rb +36 -0
  59. data/lib/strava/models/mixins/moving_time.rb +18 -0
  60. data/lib/strava/models/mixins/sport_type.rb +39 -1
  61. data/lib/strava/models/mixins/start_date_local.rb +41 -25
  62. data/lib/strava/models/mixins/time_in_hours.rb +23 -0
  63. data/lib/strava/models/mixins/total_elevation_gain.rb +42 -0
  64. data/lib/strava/models/model.rb +29 -0
  65. data/lib/strava/models/photos_summary.rb +33 -2
  66. data/lib/strava/models/photos_summary_primary.rb +28 -2
  67. data/lib/strava/models/power_zone_ranges.rb +23 -1
  68. data/lib/strava/models/response.rb +18 -0
  69. data/lib/strava/models/route.rb +72 -4
  70. data/lib/strava/models/similar_activities.rb +57 -1
  71. data/lib/strava/models/split.rb +27 -2
  72. data/lib/strava/models/stats_visibility.rb +24 -1
  73. data/lib/strava/models/stream.rb +107 -0
  74. data/lib/strava/models/stream_set.rb +52 -1
  75. data/lib/strava/models/summary_activity.rb +153 -3
  76. data/lib/strava/models/summary_athlete.rb +56 -3
  77. data/lib/strava/models/summary_club.rb +61 -2
  78. data/lib/strava/models/summary_gear.rb +31 -2
  79. data/lib/strava/models/summary_pr_segment_effort.rb +32 -2
  80. data/lib/strava/models/summary_segment.rb +81 -3
  81. data/lib/strava/models/summary_segment_effort.rb +33 -2
  82. data/lib/strava/models/timed_zone_range.rb +38 -1
  83. data/lib/strava/models/token.rb +31 -0
  84. data/lib/strava/models/trend.rb +38 -1
  85. data/lib/strava/models/updatable_activity.rb +36 -1
  86. data/lib/strava/models/upload.rb +50 -1
  87. data/lib/strava/models/waypoint.rb +31 -1
  88. data/lib/strava/models/xoms.rb +35 -1
  89. data/lib/strava/models/zone_range.rb +34 -1
  90. data/lib/strava/models/zones.rb +32 -1
  91. data/lib/strava/oauth/client.rb +107 -19
  92. data/lib/strava/oauth/config.rb +41 -0
  93. data/lib/strava/version.rb +1 -1
  94. data/lib/strava/web/api_response.rb +28 -2
  95. data/lib/strava/web/client.rb +73 -3
  96. data/lib/strava/web/config.rb +44 -0
  97. data/lib/strava/web/connection.rb +46 -2
  98. data/lib/strava/web/filter.rb +72 -0
  99. data/lib/strava/web/log_formatter.rb +20 -0
  100. data/lib/strava/web/raise_response_error.rb +73 -9
  101. data/lib/strava/web/request.rb +56 -0
  102. data/lib/strava/web/response.rb +30 -29
  103. data/lib/strava/webhooks/client.rb +108 -7
  104. data/lib/strava/webhooks/config.rb +44 -0
  105. data/lib/strava/webhooks/models/challenge.rb +40 -0
  106. data/lib/strava/webhooks/models/event.rb +58 -0
  107. data/lib/strava/webhooks/models/subscription.rb +29 -2
  108. data/lib/strava-ruby-client.rb +2 -2
  109. metadata +7 -11
  110. data/lib/strava/models/club_activity.rb +0 -22
  111. data/lib/strava/models/club_athlete.rb +0 -21
@@ -3,46 +3,44 @@
3
3
  module Strava
4
4
  module Web
5
5
  #
6
- # wrapper class as abstraction for API response returned from the Faraday Adapter
7
- # working with a deep copy, in order to not mutate the original request itself
6
+ # Wraps a Faraday response from the Strava API.
7
+ #
8
+ # Each Hash in the response body is copied with an added `http_response` key,
9
+ # so models can access the response, e.g. for rate limits, without mutating
10
+ # or deep copying the original response.
8
11
  #
9
12
  class Response
10
- include Strava::DeepCopyable
11
-
12
13
  attr_reader :http_response, :response
13
14
 
14
15
  #
15
16
  # @param [Faraday::Response] http_response
16
17
  #
17
18
  def initialize(http_response)
18
- @http_response = deep_copy(http_response)
19
- @response = conditional_response_upgrade!(http_response)
19
+ @http_response = http_response
20
+ @response = upgrade_response(http_response)
20
21
  end
21
22
 
22
23
  private
23
24
 
24
- #
25
- # returns a modified deep copy of the Faraday::Response
26
25
  #
27
26
  # @param [Faraday::Response] http_response
28
27
  #
29
- # @return [Array, Hash{String => any}]
28
+ # @return [Array<Hash>, Faraday::Response, Object] rows of an Array body,
29
+ # a copy of the response with a Hash body, or any other body
30
30
  #
31
- def conditional_response_upgrade!(http_response)
32
- response = deep_copy(http_response)
33
-
34
- case response.body
31
+ def upgrade_response(http_response)
32
+ case (body = http_response.body)
35
33
  when Array
36
- upgrade_array_body!(response)
34
+ body.map { |row| (row || {}).merge('http_response' => http_response) }
37
35
  when Hash
38
- response.body['http_response'] = response
36
+ env = http_response.env.dup
37
+ env.body = body.merge('http_response' => http_response)
38
+ Faraday::Response.new(env)
39
39
  else
40
- response.body
40
+ body
41
41
  end
42
42
  end
43
43
 
44
- #
45
- # mutates the response when body is_a? Hash
46
44
  #
47
45
  # @param [Symbol] method_symbol
48
46
  # @param [any] *args
@@ -61,20 +59,16 @@ module Strava
61
59
  end
62
60
 
63
61
  #
64
- # mutates all responses in the body
62
+ # Delegates missing methods to the response body or array.
65
63
  #
66
- # @param [Faraday::Response] response from the Strava API
64
+ # If the response is an array, delegates methods to the array.
65
+ # Otherwise, delegates to the response body hash, allowing access
66
+ # to response fields as if they were methods.
67
67
  #
68
- # @return [Array<Faraday::Response>]
68
+ # @param method_symbol [Symbol] The method name to forward
69
+ # @param args [Array] Arguments to pass to the method
70
+ # @return [Object] Result from the delegated method
69
71
  #
70
- def upgrade_array_body!(response)
71
- response.body.map! do |body_elem|
72
- body_elem ||= {}
73
- body_elem['http_response'] = response
74
- body_elem
75
- end
76
- end
77
-
78
72
  def method_missing(method_symbol, ...)
79
73
  case @response
80
74
  when Array
@@ -84,6 +78,13 @@ module Strava
84
78
  end
85
79
  end
86
80
 
81
+ #
82
+ # Checks if the response body or array responds to a method.
83
+ #
84
+ # @param method_name [Symbol] The method name to check
85
+ # @param include_private [Boolean] Whether to include private methods
86
+ # @return [Boolean] true if the response responds to the method
87
+ #
87
88
  def respond_to_missing?(method_name, include_private = false)
88
89
  super
89
90
  end
@@ -2,9 +2,49 @@
2
2
 
3
3
  module Strava
4
4
  module Webhooks
5
+ #
6
+ # Webhooks client for Strava push subscriptions.
7
+ #
8
+ # Strava provides webhooks for receiving real-time updates about athlete activities
9
+ # and other events. This client manages webhook subscriptions (create, list, delete).
10
+ #
11
+ # Before creating a subscription, you must implement an HTTP endpoint that:
12
+ # 1. Handles GET requests for subscription validation (Challenge)
13
+ # 2. Handles POST requests for webhook events (Event)
14
+ #
15
+ # @example Create and manage a webhook subscription
16
+ # client = Strava::Webhooks::Client.new(
17
+ # client_id: "your_client_id",
18
+ # client_secret: "your_client_secret"
19
+ # )
20
+ #
21
+ # # Create subscription
22
+ # subscription = client.create_push_subscription(
23
+ # callback_url: 'https://myapp.com/strava/webhook',
24
+ # verify_token: 'my_verify_token'
25
+ # )
26
+ #
27
+ # # List subscriptions
28
+ # subscriptions = client.push_subscriptions
29
+ #
30
+ # # Delete subscription
31
+ # client.delete_push_subscription(subscription.id)
32
+ #
33
+ # @see https://developers.strava.com/docs/webhooks/
34
+ # @see Strava::Webhooks::Models::Challenge
35
+ # @see Strava::Webhooks::Models::Event
36
+ #
5
37
  class Client < Strava::Web::Client
6
38
  attr_accessor(*Config::ATTRIBUTES)
7
39
 
40
+ #
41
+ # Initialize a new Webhooks client.
42
+ #
43
+ # @param [Hash] options Configuration options
44
+ # @option options [String] :client_id Strava application client ID (required)
45
+ # @option options [String] :client_secret Strava application client secret (required)
46
+ # @option options [String] :endpoint API endpoint URL (defaults to https://www.strava.com/api/v3)
47
+ #
8
48
  def initialize(options = {})
9
49
  Strava::Webhooks::Config::ATTRIBUTES.each do |key|
10
50
  send("#{key}=", options[key] || Strava::Webhooks.config.send(key))
@@ -17,7 +57,20 @@ module Strava
17
57
  end
18
58
 
19
59
  #
20
- # Get existing push subscriptions.
60
+ # List existing push subscriptions.
61
+ #
62
+ # Returns all active webhook subscriptions for your application.
63
+ # Typically, Strava only allows one subscription per application.
64
+ #
65
+ # @param [Hash] options Additional options
66
+ #
67
+ # @return [Array<Strava::Webhooks::Models::Subscription>] Array of subscriptions
68
+ #
69
+ # @example List subscriptions
70
+ # subscriptions = client.push_subscriptions
71
+ # subscriptions.each { |sub| puts "ID: #{sub.id}, URL: #{sub.callback_url}" }
72
+ #
73
+ # @see https://developers.strava.com/docs/webhooks/
21
74
  #
22
75
  def push_subscriptions(options = {})
23
76
  get('push_subscriptions', options).map do |row|
@@ -26,7 +79,20 @@ module Strava
26
79
  end
27
80
 
28
81
  #
29
- # Delete an existing push subscription.
82
+ # Delete a push subscription.
83
+ #
84
+ # Removes an existing webhook subscription by ID. After deletion,
85
+ # your application will no longer receive webhook events.
86
+ #
87
+ # @param [Integer, Hash] id_or_options Subscription ID or options hash with :id key
88
+ # @param [Hash] options Additional options
89
+ #
90
+ # @return [nil]
91
+ #
92
+ # @example Delete subscription
93
+ # client.delete_push_subscription(12345)
94
+ #
95
+ # @see https://developers.strava.com/docs/webhooks/
30
96
  #
31
97
  def delete_push_subscription(id_or_options, options = {})
32
98
  id, options = parse_args(id_or_options, options)
@@ -35,22 +101,57 @@ module Strava
35
101
  end
36
102
 
37
103
  #
38
- # Create a subscription.
104
+ # Create a new push subscription.
105
+ #
106
+ # Creates a webhook subscription for receiving real-time activity updates.
107
+ # Your callback URL must be publicly accessible and handle both GET (for validation)
108
+ # and POST (for events) requests.
109
+ #
110
+ # Strava will send a GET request to validate your callback URL before creating
111
+ # the subscription. Your endpoint must respond with the challenge token.
112
+ #
113
+ # @param [Hash] options Subscription parameters
114
+ # @option options [String] :callback_url Public HTTPS URL where webhook events will be sent (required)
115
+ # @option options [String] :verify_token Token for validating webhook challenges (required)
116
+ #
117
+ # @return [Strava::Webhooks::Models::Subscription] The created subscription
118
+ #
119
+ # @example Create subscription
120
+ # subscription = client.create_push_subscription(
121
+ # callback_url: 'https://myapp.com/strava/webhook',
122
+ # verify_token: 'my_secret_token_123'
123
+ # )
124
+ # puts "Subscription ID: #{subscription.id}"
39
125
  #
40
- # @option options [String] :callback_url
41
- # Address where webhook events will be sent.
42
- # @option options [String] :verify_token
43
- # String chosen by the application owner for client security. An identical string should be returned by Strava's subscription service.
126
+ # @see https://developers.strava.com/docs/webhooks/
127
+ # @see Strava::Webhooks::Models::Challenge
44
128
  #
45
129
  def create_push_subscription(options = {})
46
130
  Strava::Webhooks::Models::Subscription.new(post('push_subscriptions', options))
47
131
  end
48
132
 
49
133
  class << self
134
+ #
135
+ # Configure the Webhooks client with a block.
136
+ #
137
+ # @yield [Config] Yields the configuration module for setup
138
+ # @return [Module] The Config module
139
+ #
140
+ # @example
141
+ # Strava::Webhooks::Client.configure do |config|
142
+ # config.client_id = ENV['STRAVA_CLIENT_ID']
143
+ # config.client_secret = ENV['STRAVA_CLIENT_SECRET']
144
+ # end
145
+ #
50
146
  def configure
51
147
  block_given? ? yield(Config) : Config
52
148
  end
53
149
 
150
+ #
151
+ # Returns the current Webhooks client configuration.
152
+ #
153
+ # @return [Module] The Config module
154
+ #
54
155
  def config
55
156
  Config
56
157
  end
@@ -2,9 +2,28 @@
2
2
 
3
3
  module Strava
4
4
  module Webhooks
5
+ #
6
+ # Configuration module for the Webhooks client.
7
+ #
8
+ # This module manages webhook-specific configuration settings including the
9
+ # API endpoint URL and application credentials (client ID and secret) required
10
+ # for managing webhook subscriptions.
11
+ #
12
+ # Webhooks allow your application to receive real-time notifications when
13
+ # athletes create new activities or update their profile information.
14
+ #
15
+ # @example Configure Webhooks client
16
+ # Strava::Webhooks.configure do |config|
17
+ # config.client_id = ENV['STRAVA_CLIENT_ID']
18
+ # config.client_secret = ENV['STRAVA_CLIENT_SECRET']
19
+ # end
20
+ #
21
+ # @see https://developers.strava.com/docs/webhooks/
22
+ #
5
23
  module Config
6
24
  extend self
7
25
 
26
+ # @return [Array<Symbol>] List of configurable webhook attributes
8
27
  ATTRIBUTES = %i[
9
28
  endpoint
10
29
  client_id
@@ -13,6 +32,14 @@ module Strava
13
32
 
14
33
  attr_accessor(*Config::ATTRIBUTES)
15
34
 
35
+ #
36
+ # Reset configuration to default values.
37
+ #
38
+ # Sets the endpoint to the default Strava API v3 URL and clears
39
+ # the client credentials.
40
+ #
41
+ # @return [void]
42
+ #
16
43
  def reset
17
44
  self.endpoint = 'https://www.strava.com/api/v3'
18
45
  self.client_id = nil
@@ -21,10 +48,27 @@ module Strava
21
48
  end
22
49
 
23
50
  class << self
51
+ #
52
+ # Configure the Webhooks client with a block.
53
+ #
54
+ # @yield [Config] Yields the configuration module for setup
55
+ # @return [Module] The Config module
56
+ #
57
+ # @example
58
+ # Strava::Webhooks.configure do |config|
59
+ # config.client_id = '12345'
60
+ # config.client_secret = 'your_client_secret'
61
+ # end
62
+ #
24
63
  def configure
25
64
  block_given? ? yield(Config) : Config
26
65
  end
27
66
 
67
+ #
68
+ # Returns the current Webhooks configuration.
69
+ #
70
+ # @return [Module] The Config module
71
+ #
28
72
  def config
29
73
  Config
30
74
  end
@@ -3,11 +3,51 @@
3
3
  module Strava
4
4
  module Webhooks
5
5
  module Models
6
+ #
7
+ # Represents a webhook subscription validation challenge.
8
+ #
9
+ # When creating a webhook subscription, Strava sends a GET request to your
10
+ # callback URL with challenge parameters. Your application must validate the
11
+ # verify_token and respond with the challenge value.
12
+ #
13
+ # @example Handle webhook challenge in Rails
14
+ # def webhook
15
+ # if request.get?
16
+ # challenge = Strava::Webhooks::Models::Challenge.new(request.query_parameters)
17
+ # if challenge.verify_token == ENV['STRAVA_VERIFY_TOKEN']
18
+ # render json: challenge.response
19
+ # else
20
+ # head :forbidden
21
+ # end
22
+ # end
23
+ # end
24
+ #
25
+ # @example Handle challenge in Sinatra
26
+ # get '/webhook' do
27
+ # challenge = Strava::Webhooks::Models::Challenge.new(params)
28
+ # halt 403 unless challenge.verify_token == ENV['STRAVA_VERIFY_TOKEN']
29
+ # content_type :json
30
+ # challenge.response.to_json
31
+ # end
32
+ #
33
+ # @see Strava::Webhooks::Client#create_push_subscription
34
+ # @see https://developers.strava.com/docs/webhooks/
35
+ #
6
36
  class Challenge < Hashie::Trash
37
+ # @return [String] Subscription mode, typically "subscribe"
7
38
  property 'mode', from: 'hub.mode'
39
+
40
+ # @return [String] Verification token to validate the request
8
41
  property 'verify_token', from: 'hub.verify_token'
42
+
43
+ # @return [String] Challenge value that must be echoed back
9
44
  property 'challenge', from: 'hub.challenge'
10
45
 
46
+ #
47
+ # Returns the response hash that should be sent back to Strava.
48
+ #
49
+ # @return [Hash] Response containing the challenge value
50
+ #
11
51
  def response
12
52
  { 'hub.challenge' => challenge }
13
53
  end
@@ -3,13 +3,71 @@
3
3
  module Strava
4
4
  module Webhooks
5
5
  module Models
6
+ #
7
+ # Represents a webhook event from Strava.
8
+ #
9
+ # After successfully creating a webhook subscription, Strava will send POST
10
+ # requests to your callback URL when activity events occur. Events include
11
+ # activity creation, updates, and deletions.
12
+ #
13
+ # @example Handle webhook event in Rails
14
+ # def webhook
15
+ # if request.post?
16
+ # event = Strava::Webhooks::Models::Event.new(JSON.parse(request.body.read))
17
+ #
18
+ # case event.object_type
19
+ # when 'activity'
20
+ # case event.aspect_type
21
+ # when 'create'
22
+ # # Fetch and process the new activity
23
+ # activity = client.activity(event.id)
24
+ # process_new_activity(activity)
25
+ # when 'update'
26
+ # # Handle activity update
27
+ # puts "Activity #{event.id} updated: #{event.updates.inspect}"
28
+ # when 'delete'
29
+ # # Handle activity deletion
30
+ # delete_activity(event.id)
31
+ # end
32
+ # when 'athlete'
33
+ # # Handle athlete updates (authorization revoked, etc.)
34
+ # end
35
+ #
36
+ # head :ok
37
+ # end
38
+ # end
39
+ #
40
+ # @see Strava::Webhooks::Client#create_push_subscription
41
+ # @see https://developers.strava.com/docs/webhooks/
42
+ #
6
43
  class Event < Hashie::Trash
44
+ include Hashie::Extensions::IgnoreUndeclared
45
+
46
+ # @return [String] Type of object (e.g., "activity", "athlete")
7
47
  property 'object_type'
48
+
49
+ # @return [Integer] ID of the object (activity ID, athlete ID, etc.)
8
50
  property 'id', from: 'object_id'
51
+
52
+ # @return [String] ID of the object as a string
53
+ property 'id_str', from: 'object_id_str'
54
+
55
+ # @return [String] Type of event: "create", "update", or "delete"
9
56
  property 'aspect_type'
57
+
58
+ # @return [Hash] Map of updated properties (only for update events)
10
59
  property 'updates'
60
+
61
+ # @return [Integer] Athlete ID who owns the object
11
62
  property 'owner_id'
63
+
64
+ # @return [String] Athlete ID who owns the object, as a string
65
+ property 'owner_id_str'
66
+
67
+ # @return [Integer] ID of the webhook subscription
12
68
  property 'subscription_id'
69
+
70
+ # @return [Time] Timestamp when the event occurred
13
71
  property 'event_time', transform_with: ->(v) { Time.at(v) }
14
72
  end
15
73
  end
@@ -3,13 +3,40 @@
3
3
  module Strava
4
4
  module Webhooks
5
5
  module Models
6
+ #
7
+ # Represents a webhook subscription.
8
+ #
9
+ # Webhook subscriptions allow your application to receive real-time notifications
10
+ # when athletes create or update activities, or update their profile information.
11
+ # Each subscription is associated with a callback URL where events will be posted.
12
+ #
13
+ # @example List subscriptions
14
+ # subscriptions = client.subscriptions
15
+ # subscriptions.each do |sub|
16
+ # puts "Subscription #{sub.id}: #{sub.callback_url}"
17
+ # end
18
+ #
19
+ # @see Strava::Webhooks::Client
20
+ # @see https://developers.strava.com/docs/webhooks/
21
+ #
6
22
  class Subscription < Strava::Models::Response
23
+ # @return [Integer] The subscription ID
7
24
  property 'id'
25
+
26
+ # @return [Integer] The ID of the application that created the subscription
8
27
  property 'application_id'
28
+
29
+ # @return [String] The callback URL where webhook events will be posted
9
30
  property 'callback_url'
31
+
32
+ # @return [Integer] Resource state indicator
10
33
  property 'resource_state'
11
- property 'created_at', transform_with: ->(v) { Time.parse(v) }
12
- property 'updated_at', transform_with: ->(v) { Time.parse(v) }
34
+
35
+ # @return [Time] When the subscription was created
36
+ property 'created_at', transform_with: ->(v) { Strava::Model.parse_time(v) }
37
+
38
+ # @return [Time] When the subscription was last updated
39
+ property 'updated_at', transform_with: ->(v) { Strava::Model.parse_time(v) }
13
40
  end
14
41
  end
15
42
  end
@@ -44,8 +44,6 @@ require_relative 'strava/models/activity_stats'
44
44
  require_relative 'strava/models/activity_total'
45
45
  require_relative 'strava/models/activity_zone'
46
46
  require_relative 'strava/models/base_stream'
47
- require_relative 'strava/models/club_activity'
48
- require_relative 'strava/models/club_athlete'
49
47
  require_relative 'strava/models/club_event'
50
48
  require_relative 'strava/models/comment'
51
49
  require_relative 'strava/models/destination'
@@ -91,6 +89,8 @@ require_relative 'strava/models/xoms'
91
89
  require_relative 'strava/models/zone_range'
92
90
  require_relative 'strava/models/zones'
93
91
 
92
+ require_relative 'strava/web/filter'
93
+ require_relative 'strava/web/log_formatter'
94
94
  require_relative 'strava/web/raise_response_error'
95
95
  require_relative 'strava/web/connection'
96
96
  require_relative 'strava/web/api_response'
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strava-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Doubrovkine
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-10-25 00:00:00.000000000 Z
10
+ date: 2026-11-24 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: activesupport
@@ -30,14 +29,14 @@ dependencies:
30
29
  requirements:
31
30
  - - ">="
32
31
  - !ruby/object:Gem::Version
33
- version: '2.0'
32
+ version: 2.14.4
34
33
  type: :runtime
35
34
  prerelease: false
36
35
  version_requirements: !ruby/object:Gem::Requirement
37
36
  requirements:
38
37
  - - ">="
39
38
  - !ruby/object:Gem::Version
40
- version: '2.0'
39
+ version: 2.14.4
41
40
  - !ruby/object:Gem::Dependency
42
41
  name: faraday-multipart
43
42
  requirement: !ruby/object:Gem::Requirement
@@ -66,7 +65,6 @@ dependencies:
66
65
  - - ">="
67
66
  - !ruby/object:Gem::Version
68
67
  version: '0'
69
- description:
70
68
  email: dblock@dblock.org
71
69
  executables:
72
70
  - strava-oauth-token
@@ -108,8 +106,6 @@ files:
108
106
  - lib/strava/models/activity_zone.rb
109
107
  - lib/strava/models/authorization.rb
110
108
  - lib/strava/models/base_stream.rb
111
- - lib/strava/models/club_activity.rb
112
- - lib/strava/models/club_athlete.rb
113
109
  - lib/strava/models/club_event.rb
114
110
  - lib/strava/models/comment.rb
115
111
  - lib/strava/models/destination.rb
@@ -177,6 +173,8 @@ files:
177
173
  - lib/strava/web/client.rb
178
174
  - lib/strava/web/config.rb
179
175
  - lib/strava/web/connection.rb
176
+ - lib/strava/web/filter.rb
177
+ - lib/strava/web/log_formatter.rb
180
178
  - lib/strava/web/raise_response_error.rb
181
179
  - lib/strava/web/request.rb
182
180
  - lib/strava/web/response.rb
@@ -190,7 +188,6 @@ licenses:
190
188
  - MIT
191
189
  metadata:
192
190
  rubygems_mfa_required: 'true'
193
- post_install_message:
194
191
  rdoc_options: []
195
192
  require_paths:
196
193
  - lib
@@ -205,8 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
205
202
  - !ruby/object:Gem::Version
206
203
  version: '2.5'
207
204
  requirements: []
208
- rubygems_version: 3.5.16
209
- signing_key:
205
+ rubygems_version: 3.6.9
210
206
  specification_version: 4
211
207
  summary: Strava API Ruby client.
212
208
  test_files: []
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Strava
4
- module Models
5
- # https://developers.strava.com/docs/reference/#api-models-ClubActivity
6
- class ClubActivity < Strava::Models::Response
7
- include Mixins::ElevationGain
8
- include Mixins::SportType
9
-
10
- property 'athlete', transform_with: ->(v) { Strava::Models::MetaAthlete.new(v) }
11
- property 'name'
12
- include Mixins::Distance
13
- include Mixins::MovingTime
14
- include Mixins::ElapsedTime
15
- include Mixins::TotalElevationGain
16
- include Mixins::SportType
17
- property 'workout_type'
18
- # undocumented
19
- property 'resource_state'
20
- end
21
- end
22
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Strava
4
- module Models
5
- # https://developers.strava.com/docs/reference/#api-models-ClubAthlete
6
- class ClubAthlete < Strava::Models::Response
7
- property 'resource_state'
8
- property 'firstname'
9
- property 'lastname'
10
- property 'member'
11
- property 'admin'
12
- property 'owner'
13
- # undocumented
14
- property 'membership'
15
-
16
- def name
17
- [firstname, lastname].compact.join(' ') if firstname || lastname
18
- end
19
- end
20
- end
21
- end