Class: Strava::Api::Client
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Web::Client
#endpoint
#delete, #get, #post, #put
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
6
7
8
9
10
11
|
# File 'lib/strava/api/client.rb', line 6
def initialize(options = {})
Config::ATTRIBUTES.each do |key|
send("#{key}=", options[key] || Strava::Api.config.send(key))
end
super
end
|
Class Method Details
.config ⇒ Object
32
33
34
|
# File 'lib/strava/api/client.rb', line 32
def config
Config
end
|
28
29
30
|
# File 'lib/strava/api/client.rb', line 28
def configure
block_given? ? yield(Config) : Config
end
|
Instance Method Details
#athlete ⇒ Object
17
18
19
|
# File 'lib/strava/api/client.rb', line 17
def athlete
Strava::Models::Athlete.new(get('athlete'))
end
|
#athlete_activities(options = {}) ⇒ Object
21
22
23
24
25
|
# File 'lib/strava/api/client.rb', line 21
def athlete_activities(options = {})
get('athlete/activities', options).map do |activity|
Strava::Models::Activity.new(activity)
end
end
|
13
14
15
|
# File 'lib/strava/api/client.rb', line 13
def
{ 'Authorization' => "Bearer #{access_token}" }
end
|