Class: Strava::Web::Client

Inherits:
Object
  • Object
show all
Includes:
Connection, Request
Defined in:
lib/strava/web/client.rb

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.



9
10
11
12
13
14
# File 'lib/strava/web/client.rb', line 9

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

.configObject



25
26
27
# File 'lib/strava/web/client.rb', line 25

def config
  Config
end

.configureObject



21
22
23
# File 'lib/strava/web/client.rb', line 21

def configure
  block_given? ? yield(Config) : Config
end

Instance Method Details

#endpointObject

Raises:

  • (NotImplementedError)


16
17
18
# File 'lib/strava/web/client.rb', line 16

def endpoint
  raise NotImplementedError
end

#parse_args(id_or_options, options = {}) ⇒ Object



30
31
32
33
34
35
36
37
38
# File 'lib/strava/web/client.rb', line 30

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