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



304
305
306
# File 'lib/twurl/cli.rb', line 304

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

#debug_output_ioObject



312
313
314
# File 'lib/twurl/cli.rb', line 312

def debug_output_io
  super || STDERR
end

#hostObject



324
325
326
# File 'lib/twurl/cli.rb', line 324

def host
  super || DEFAULT_HOST
end

#oauth_client_optionsObject



297
298
299
300
301
302
# File 'lib/twurl/cli.rb', line 297

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

#protocolObject



320
321
322
# File 'lib/twurl/cli.rb', line 320

def protocol
  super || DEFAULT_PROTOCOL
end

#proxyObject



328
329
330
# File 'lib/twurl/cli.rb', line 328

def proxy
  super || nil
end

#request_methodObject



316
317
318
# File 'lib/twurl/cli.rb', line 316

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

#ssl?Boolean

Returns:

  • (Boolean)


308
309
310
# File 'lib/twurl/cli.rb', line 308

def ssl?
  protocol == 'https'
end