Class: Twttr::Client::OAuthRequest
- Inherits:
-
Object
- Object
- Twttr::Client::OAuthRequest
- Defined in:
- lib/twttr/client/oauth_request.rb
Overview
OAuth helper methods
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(uri, config) ⇒ OAuthRequest
constructor
A new instance of OAuthRequest.
- #perform ⇒ Object
Constructor Details
#initialize(uri, config) ⇒ OAuthRequest
Returns a new instance of OAuthRequest.
9 10 11 12 13 14 15 |
# File 'lib/twttr/client/oauth_request.rb', line 9 def initialize(uri, config) @uri = uri @config = config @request = Net::HTTP::Get.new(uri) @request['Authorization'] = @response = nil end |
Instance Attribute Details
#response ⇒ Object
Returns the value of attribute response.
7 8 9 |
# File 'lib/twttr/client/oauth_request.rb', line 7 def response @response end |
Class Method Details
.get(uri, config) ⇒ Object
17 18 19 |
# File 'lib/twttr/client/oauth_request.rb', line 17 def self.get(uri, config) new(uri, config).perform end |
Instance Method Details
#perform ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/twttr/client/oauth_request.rb', line 21 def perform Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http| # :nocov: self.response = http.request request # :nocov: end raise Error::HTTPError, response. unless response.instance_of?(Net::HTTPOK) response end |