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



333
334
335
# File 'lib/twurl/cli.rb', line 333

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

#debug_output_ioObject



341
342
343
# File 'lib/twurl/cli.rb', line 341

def debug_output_io
  super || STDERR
end

#hostObject



353
354
355
# File 'lib/twurl/cli.rb', line 353

def host
  super || DEFAULT_HOST
end

#oauth_client_optionsObject



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

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

#protocolObject



349
350
351
# File 'lib/twurl/cli.rb', line 349

def protocol
  super || DEFAULT_PROTOCOL
end

#proxyObject



357
358
359
# File 'lib/twurl/cli.rb', line 357

def proxy
  super || nil
end

#request_methodObject



345
346
347
# File 'lib/twurl/cli.rb', line 345

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

#ssl?Boolean

Returns:

  • (Boolean)


337
338
339
# File 'lib/twurl/cli.rb', line 337

def ssl?
  protocol == 'https'
end