Skip to content

Commit 25a0480

Browse files
committed
Refactor event model to map 'object_id' to 'id'
updaetes GitHub CI actions, adds newest Ruby versions to CI
1 parent f8f2736 commit 25a0480

File tree

8 files changed

+32
-9
lines changed

8 files changed

+32
-9
lines changed

.github/workflows/danger.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
env:
77
BUNDLE_GEMFILE: ${{ github.workspace }}/Gemfile.danger
88
steps:
9-
- uses: actions/checkout@v2
9+
- uses: actions/checkout@v5
1010
with:
1111
fetch-depth: 0
1212
- uses: ruby/setup-ruby@v1

.github/workflows/rubocop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ jobs:
44
lint:
55
runs-on: ubuntu-latest
66
steps:
7-
- uses: actions/checkout@v2
7+
- uses: actions/checkout@v5
88
- name: Set up Ruby
99
uses: ruby/setup-ruby@v1
1010
with:

.github/workflows/test.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ jobs:
1010
- "3.1"
1111
- "3.2"
1212
- "3.3"
13+
- "3.4"
1314
- "jruby-9.4"
15+
- "jruby-10"
1416
steps:
15-
- uses: actions/checkout@v2
17+
- uses: actions/checkout@v5
1618
- name: Set up Ruby
1719
uses: ruby/setup-ruby@v1
1820
with:

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
### 2.3.1 (Next)
1+
### 3.0.0 (Next)
22

3+
* [#92](https://github.com/dblock/strava-ruby-client/pull/92): Fixes Hashie::Trash serialization warning for `object_id` of `Strava::Webhooks::Models::Event` - [@simonneutert](https://github.com/simonneutert).
34
* Your contribution here.
45

56
### 2.3.0 (2025/10/16)

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Strava Ruby Client
1+
# Strava Ruby Client<!-- omit in toc -->
22

33
[![Gem Version](https://badge.fury.io/rb/strava-ruby-client.svg)](https://badge.fury.io/rb/strava-ruby-client)
44
[![Test](https://github.com/dblock/strava-ruby-client/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/dblock/strava-ruby-client/actions/workflows/test.yml)
@@ -7,7 +7,7 @@ A complete Ruby client for the [Strava API v3](https://developers.strava.com).
77

88
Unlike other clients, including [strava-api-v3](https://github.com/jaredholdcroft/strava-api-v3), provides complete OAuth refresh token flow support, webhooks support, a richer first class interface to Strava models, conversion helpers for distance, time and elevation, natively supports pagination, implements more consistent error handling and is built with thorough test coverage using actual Strava data.
99

10-
## Table of Contents
10+
## Table of Contents<!-- omit in toc -->
1111

1212
- [Installation](#installation)
1313
- [Usage](#usage)
@@ -895,7 +895,7 @@ event = Strava::Webhooks::Models::Event.new(JSON.parse(request.body))
895895

896896
event # => Strava::Webhooks::Models::Event
897897
event.object_type # => 'activity'
898-
event.object_id # => 1991813808
898+
event.id # => 1991813808
899899
event.aspect_type # => 'update'
900900
event.updates # => { 'sport_type' => 'Walk' }
901901
event.owner_id # => 29323238

UPGRADING.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
# Upgrading Strava-Ruby-Client
22

3+
### Upgrading to >= 3.0.0
4+
5+
The `Strava::Webhooks::Models::Event` model has been refactored to map the `object_id` field to `id` for consistency and to resolve Hashie::Trash serialization warnings.
6+
7+
**Breaking Change**: If you're using webhooks and accessing the `object_id` property, you must now use `id` instead.
8+
9+
**Before (v2.x):**
10+
```ruby
11+
event = Strava::Webhooks::Models::Event.new(JSON.parse(request.body))
12+
event.object_id # => 1991813808
13+
```
14+
15+
**After (v3.0.0):**
16+
```ruby
17+
event = Strava::Webhooks::Models::Event.new(JSON.parse(request.body))
18+
event.id # => 1991813808
19+
```
20+
21+
This change fixes the Hashie::Trash serialization warning that occurred when using `object_id` due to conflicts with Ruby's built-in `Object#object_id` method.
22+
323
### Upgrading to >= 2.3.0
424

525
Faraday can optionally exclude HTTP method, path and query params from the errors raised. The client implementation options will now default to `Faraday::Response::RaiseError::DEFAULT_OPTIONS` with `include_request` set to `true`. You can change this behavior by setting `Strava::Web::RaiseResponseError::DEFAULT_OPTIONS`.

lib/strava/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module Strava
4-
VERSION = '2.3.1'
4+
VERSION = '3.0.0'
55
end

lib/strava/webhooks/models/event.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module Webhooks
55
module Models
66
class Event < Hashie::Trash
77
property 'object_type'
8-
property 'object_id'
8+
property 'id', from: 'object_id'
99
property 'aspect_type'
1010
property 'updates'
1111
property 'owner_id'

0 commit comments

Comments
 (0)