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



234
235
236
# File 'lib/twurl/cli.rb', line 234

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

#debug_output_ioObject



242
243
244
# File 'lib/twurl/cli.rb', line 242

def debug_output_io
  super || STDERR
end

#hostObject



254
255
256
# File 'lib/twurl/cli.rb', line 254

def host
  super || DEFAULT_HOST
end

#oauth_client_optionsObject



227
228
229
230
231
232
# File 'lib/twurl/cli.rb', line 227

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

#protocolObject



250
251
252
# File 'lib/twurl/cli.rb', line 250

def protocol
  super || DEFAULT_PROTOCOL
end

#request_methodObject



246
247
248
# File 'lib/twurl/cli.rb', line 246

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

#ssl?Boolean

Returns:

  • (Boolean)


238
239
240
# File 'lib/twurl/cli.rb', line 238

def ssl?
  protocol == 'https'
end