Skip to content

Commit f056d2a

Browse files
committed
Added a more detailed getting started/usage.
1 parent c0ae2ef commit f056d2a

File tree

3 files changed

+40
-1
lines changed

3 files changed

+40
-1
lines changed

.rubocop_todo.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2024-11-24 21:25:04 UTC using RuboCop version 1.68.0.
3+
# on 2025-02-01 14:38:28 UTC using RuboCop version 1.68.0.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
77
# versions of RuboCop, may require this file to be generated again.
88

9+
# Offense count: 1
10+
# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms.
11+
# CheckDefinitionPathHierarchyRoots: lib, spec, test, src
12+
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
13+
Naming/FileName:
14+
Exclude:
15+
- 'lib/strava-ruby-client.rb'
16+
- 'bin/strava-activities.rb'
17+
918
# Offense count: 13
1019
# This cop supports unsafe autocorrection (--autocorrect-all).
1120
# Configuration parameters: SkipBlocks, EnforcedStyle, OnlyStaticConstants.

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,23 @@ Use an access token obtained from [My API Application](https://www.strava.com/se
9797
client = Strava::Api::Client.new(
9898
access_token: "12345678987654321"
9999
)
100+
101+
client.athlete # => Strava::Models::Athlete
102+
```
103+
104+
Note that the token from the Strava website does not have enough permissions to retrieve your own activities. Use the [strava-oauth-token tool](#strava-oauth-token) to obtain a short lived with more access scopes.
105+
106+
```bash
107+
export STRAVA_CLIENT_ID=...
108+
export STRAVA_CLIENT_SECRET=...
109+
bundle exec ruby bin/strava-oauth-token
110+
```
111+
112+
Note the `access_token` from the browser window.
113+
114+
```bash
115+
export STRAVA_ACCESS_TOKEN=...
116+
bundle exec ruby bin/strava-activities.rb
100117
```
101118

102119
### Activities

bin/strava-activities.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# frozen_string_literal: true
2+
3+
require 'strava-ruby-client'
4+
5+
access_token = ENV['STRAVA_ACCESS_TOKEN'] || raise("Missing ENV['STRAVA_ACCESS_TOKEN'].")
6+
7+
client = Strava::Api::Client.new(
8+
access_token: access_token
9+
)
10+
11+
client.athlete_activities.each do |activity|
12+
puts activity.name
13+
end

0 commit comments

Comments
 (0)