strava-ruby-client 2.1.0 → 2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7b7cecf53fa55d912d8f4a4e2c8d62621f3f4aa386315745de5792bfe45328ae
4
- data.tar.gz: f9ee4eaea70ead74645748d557e9f316346aca2fc49ec0e5c37b55e5ba4ae0ee
3
+ metadata.gz: eae71d27881be5526b289574a16cbb6897d987008f4941d8b32172f7e40971d2
4
+ data.tar.gz: 8643756679123f7f0ddcd29f4755358eb27534ce48bdb0be085c080ba76c8d13
5
5
  SHA512:
6
- metadata.gz: c9bb8c36fa560060cd2ee5ea7f4cda88bb4d2a9b4f5b2a278dc39a99260c56727ce90cb1c09b17ccb9dfad624829934ae10049ff05d58a06009559e7b2ed6161
7
- data.tar.gz: 05f4a34f12d7e9691c0f7446e0381bf52bbda3f55fdaad57c018eb128e30f8938784f1a5b327de2dcb8fd3b32841946b495883a8b1a27fbfdba84e958d0f71ce
6
+ metadata.gz: 92743308394842b6b9a8d6c975141537c14dd3dc857ba5085a050dc0622855e9454b8bee9a4a3ba5e4747daf206d715e16dd75b67112a152b72a011564c99453
7
+ data.tar.gz: 493fc2d1558ad057c1ed78ef77df83f175d47dd23e97cfd9502c4b11249f84e8651c8a9319552a7c16ec5ba8369ee70d7d6ed567eddd94cb1e4ea6e9fecc4979
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ### 2.2.0 (2024/9/17)
2
+
3
+ * [#83](https://github.com/dblock/strava-ruby-client/pull/83): Adds back activity photos - [@dillon-co](https://github.com/dillon-co).
4
+ * [#84](https://github.com/dblock/strava-ruby-client/pull/84): Adds back activity photos (finished PR #83) - [@simonneutert](https://github.com/simonneutert).
5
+ * [#85](https://github.com/dblock/strava-ruby-client/pull/85): Lays groundwork to v3.0.0 of the gem (ruby3, newest rubocop, rubocop-rake and rubocop-rspec) - [@simonneutert](https://github.com/simonneutert).
6
+
1
7
  ### 2.1.0 (2024/3/20)
2
8
 
3
9
  * [#80](https://github.com/dblock/strava-ruby-client/pull/80): Removes default values for Faraday's SSL settings `ca_file` and `ca_path` - [@dblock](https://github.com/dblock).
data/README.md CHANGED
@@ -14,6 +14,7 @@ Unlike other clients, including [strava-api-v3](https://github.com/jaredholdcrof
14
14
  - [Activities](#activities)
15
15
  - [Create an Activity](#create-an-activity)
16
16
  - [Get Activity](#get-activity)
17
+ - [List Activity Photos](#list-activity-photos)
17
18
  - [List Activity Comments](#list-activity-comments)
18
19
  - [List Activity Kudoers](#list-activity-kudoers)
19
20
  - [List Activity Laps](#list-activity-laps)
@@ -149,6 +150,31 @@ google_image_url = "https://maps.googleapis.com/maps/api/staticmap?maptype=roadm
149
150
 
150
151
  See [Strava::Models::Map](lib/strava/models/map.rb) for all available properties.
151
152
 
153
+ #### List Activity Photos
154
+
155
+ Returns the photos on the given activity. This API is undocumented in Strava's docs. But there is a discussion in the [strava community hub](https://communityhub.strava.com/t5/developer-discussions/download-all-photos-of-my-own-activities/m-p/11262).
156
+
157
+ ```ruby
158
+ photos = client.activity_photos(1982980795) # => Array[Strava::Models::Photo]
159
+ # in order to request a certain size (by default it will return the biggest size possible):
160
+ # photos = client.activity_photos(1982980795, {size: 1920}) # => Array[Strava::Models::Photo]
161
+
162
+ photo = photos.first # => Strava::Models::Photo
163
+
164
+ photo.id # => nil
165
+ photo.unique_id # => '65889142-538D-4EE5-96F5-3DC3B773B1E3'
166
+ photo.urls # => { '0' => 'https://dgtzuqphqg23d.cloudfront.net/eb4DMJ2hJW3k_g9URZEMfaJ8rZfHagrNlZRuEZz0osU-29x64.jpg' }
167
+ photo.athlete_id # => 26_462_176
168
+ photo.activity_id # => 1_946_417_534
169
+ photo.activity_name # => 'TCS NYC Marathon 2018'
170
+ photo.created_at # => Time
171
+ photo.uploaded_at # => Time
172
+ photo.sizes # => { '0' => [29, 64] }
173
+ photo.default_photo # => false
174
+ ```
175
+
176
+ See [Strava::Models::Photo](lib/strava/models/photo.rb) for all available properties.
177
+
152
178
  #### List Activity Comments
153
179
 
154
180
  Returns the comments on the given activity.
data/bin/strava-webhooks CHANGED
@@ -5,7 +5,7 @@ require 'dotenv/load'
5
5
  require 'webrick'
6
6
  require 'strava-ruby-client'
7
7
 
8
- logger = ::Logger.new($stdout)
8
+ logger = Logger.new($stdout)
9
9
  logger.level = Logger::INFO
10
10
 
11
11
  client = Strava::Webhooks::Client.new(
@@ -37,6 +37,22 @@ module Strava
37
37
  paginate "activities/#{id}/comments", options, Strava::Models::Comment, &block
38
38
  end
39
39
 
40
+ #
41
+ # List activity photos.
42
+ #
43
+ # @option options [String] :id
44
+ # Activity id.
45
+ # @option options [Integer] :page
46
+ # Page number.
47
+ # @option options [Integer] :per_page
48
+ # Number of items per page. Defaults to 30.
49
+ #
50
+ def activity_photos(id_or_options, options = {}, &block)
51
+ id, options = parse_args(id_or_options, options)
52
+ options[:size] = 5000 unless options[:size] # to retrieve full size photos
53
+ paginate "activities/#{id}/photos", options, Strava::Models::Photo, &block
54
+ end
55
+
40
56
  #
41
57
  # List activity kudoers.
42
58
  #
@@ -48,8 +48,8 @@ module Strava
48
48
 
49
49
  private
50
50
 
51
- def method_missing(method_symbol, *args, &block)
52
- @collection.send(method_symbol, *args, &block)
51
+ def method_missing(method_symbol, ...)
52
+ @collection.send(method_symbol, ...)
53
53
  end
54
54
 
55
55
  def respond_to_missing?(method_name, include_private = false)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Strava
4
- VERSION = '2.1.0'
4
+ VERSION = '2.2.0'
5
5
  end
@@ -3,7 +3,7 @@
3
3
  module Strava
4
4
  module Web
5
5
  class RaiseResponseError < ::Faraday::Middleware
6
- CLIENT_ERROR_STATUSES = (400...600).freeze
6
+ CLIENT_ERROR_STATUSES = (400...600)
7
7
 
8
8
  def on_complete(env)
9
9
  case env[:status]
@@ -51,10 +51,10 @@ module Strava
51
51
  # @raise [NoMethodError]
52
52
  # @return [any]
53
53
  #
54
- def operate_on_response_body!(method_symbol, *args, &block)
54
+ def operate_on_response_body!(method_symbol, ...)
55
55
  case @response.body
56
56
  when Hash
57
- @response.body.send(method_symbol, *args, &block)
57
+ @response.body.send(method_symbol, ...)
58
58
  else
59
59
  raise NoMethodError
60
60
  end
@@ -75,12 +75,12 @@ module Strava
75
75
  end
76
76
  end
77
77
 
78
- def method_missing(method_symbol, *args, &block)
78
+ def method_missing(method_symbol, ...)
79
79
  case @response
80
80
  when Array
81
- @response.send(method_symbol, *args, &block)
81
+ @response.send(method_symbol, ...)
82
82
  else
83
- operate_on_response_body!(method_symbol, *args, &block)
83
+ operate_on_response_body!(method_symbol, ...)
84
84
  end
85
85
  end
86
86
 
@@ -13,7 +13,7 @@ module Strava
13
13
  end
14
14
 
15
15
  def request(method, path, options)
16
- super method, path, { client_id: client_id, client_secret: client_secret }.merge(options)
16
+ super(method, path, { client_id: client_id, client_secret: client_secret }.merge(options))
17
17
  end
18
18
 
19
19
  #
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: 2.1.0
4
+ version: 2.2.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: 2024-03-20 00:00:00.000000000 Z
11
+ date: 2024-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -172,14 +172,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
172
172
  requirements:
173
173
  - - ">="
174
174
  - !ruby/object:Gem::Version
175
- version: '2.7'
175
+ version: '3.0'
176
176
  required_rubygems_version: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - ">="
179
179
  - !ruby/object:Gem::Version
180
- version: 1.3.6
180
+ version: '2.5'
181
181
  requirements: []
182
- rubygems_version: 3.3.7
182
+ rubygems_version: 3.5.11
183
183
  signing_key:
184
184
  specification_version: 4
185
185
  summary: Strava API Ruby client.