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



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

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

#debug_output_ioObject



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

def debug_output_io
  super || STDERR
end

#hostObject



393
394
395
# File 'lib/twurl/cli.rb', line 393

def host
  super || DEFAULT_HOST
end

#oauth_client_optionsObject



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

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

#protocolObject



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

def protocol
  super || DEFAULT_PROTOCOL
end

#proxyObject



397
398
399
# File 'lib/twurl/cli.rb', line 397

def proxy
  super || nil
end

#request_methodObject



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

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

#ssl?Boolean

Returns:

  • (Boolean)


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

def ssl?
  protocol == 'https'
end