Class: Twurl::Options

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/twurl/cli.rb

Constant Summary collapse

DEFAULT_REQUEST_METHOD =
'get'
DEFAULT_HOST =
'api.twitter.com'
DEFAULT_PROTOCOL =
'https'

Instance Method Summary collapse

Instance Method Details

#base_urlObject



368
369
370
# File 'lib/twurl/cli.rb', line 368

def base_url
  "#{protocol}://#{host}"
end

#debug_output_ioObject



372
373
374
# File 'lib/twurl/cli.rb', line 372

def debug_output_io
  super || STDERR
end

#hostObject



384
385
386
# File 'lib/twurl/cli.rb', line 384

def host
  super || DEFAULT_HOST
end

#oauth_client_optionsObject



361
362
363
364
365
366
# File 'lib/twurl/cli.rb', line 361

def oauth_client_options
  OAuthClient::OAUTH_CLIENT_OPTIONS.inject({}) do |options, option|
    options[option] = send(option)
    options
  end
end

#protocolObject



380
381
382
# File 'lib/twurl/cli.rb', line 380

def protocol
  super || DEFAULT_PROTOCOL
end

#proxyObject



388
389
390
# File 'lib/twurl/cli.rb', line 388

def proxy
  super || nil
end

#request_methodObject



376
377
378
# File 'lib/twurl/cli.rb', line 376

def request_method
  super || (data.empty? ? DEFAULT_REQUEST_METHOD : 'post')
end