Module: T::Authorizable
- Included in:
- CLI
- Defined in:
- lib/t/authorizable.rb
Instance Method Summary collapse
Instance Method Details
#consumer ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/t/authorizable.rb', line 4 def consumer OAuth::Consumer.new( ['consumer-key'], ['consumer-secret'], :site => base_url ) end |
#generate_authorize_url(request_token) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/t/authorizable.rb', line 12 def (request_token) request = consumer.create_signed_request(:get, consumer., request_token, pin_auth_parameters) params = request['Authorization'].sub(/^OAuth\s+/, '').split(/,\s+/).map do |param| key, value = param.split('=') value =~ /"(.*?)"/ "#{key}=#{CGI::escape($1)}" end.join('&') "#{base_url}#{request.path}?#{params}" end |
#pin_auth_parameters ⇒ Object
22 23 24 |
# File 'lib/t/authorizable.rb', line 22 def pin_auth_parameters {:oauth_callback => 'oob'} end |