Class: Strava::Web::Client
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Request
#delete, #get, #post, #put
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
11
12
13
14
15
16
|
# File 'lib/strava/web/client.rb', line 11
def initialize(options = {})
Strava::Web::Config::ATTRIBUTES.each do |key|
send("#{key}=", options[key] || Strava::Web.config.send(key))
end
@logger ||= Strava::Logger.logger
end
|
Class Method Details
.config ⇒ Object
27
28
29
|
# File 'lib/strava/web/client.rb', line 27
def config
Config
end
|
23
24
25
|
# File 'lib/strava/web/client.rb', line 23
def configure
block_given? ? yield(Config) : Config
end
|
Instance Method Details
#endpoint ⇒ Object
18
19
20
|
# File 'lib/strava/web/client.rb', line 18
def endpoint
raise NotImplementedError
end
|
#parse_args(id_or_options, options = {}) ⇒ Object
32
33
34
35
36
37
38
39
40
|
# File 'lib/strava/web/client.rb', line 32
def parse_args(id_or_options, options = {})
if id_or_options.is_a?(Hash)
throw ArgumentError.new('Required argument :id missing') if id_or_options[:id].nil?
[id_or_options[:id], id_or_options.except(:id)]
else
throw ArgumentError.new('Required argument :id missing') if id_or_options.nil?
[id_or_options, options]
end
end
|