Skip to content

Commit ba0e087

Browse files
simonneutertdblock
authored andcommitted
Refactor event model to map 'object_id' to 'id'
updaetes GitHub CI actions, adds newest Ruby versions to CI
1 parent 55c1bda commit ba0e087

File tree

5 files changed

+29
-6
lines changed

5 files changed

+29
-6
lines changed

CHANGELOG.md

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

33
* [#93](https://github.com/dblock/strava-ruby-client/pull/93): Updates GitHub Actions workflows - [@simonneutert](https://github.com/simonneutert).
4+
* [#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).
45
* Your contribution here.
56

67
### 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: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
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+
23+
See [#92](https://github.com/dblock/strava-ruby-client/pull/92) for details.
24+
325
### Upgrading to >= 2.3.0
426

527
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)