class Troo::API::Headers
Attributes
uri[R]
Public Class Methods
build!(uri, headers = {})
click to toggle source
@param [String] @param [Hash] @return [Hash]
# File lib/troo/api/headers.rb, line 8 def build!(uri, headers = {}) new(uri, headers).build! end
new(uri, headers = {})
click to toggle source
@param [String] @param [Hash] @return [Troo::API::Headers]
# File lib/troo/api/headers.rb, line 16 def initialize(uri, headers = {}) @uri, @headers = uri, headers end
Public Instance Methods
build!()
click to toggle source
@return [Hash]
# File lib/troo/api/headers.rb, line 21 def build! defaults.merge!(@headers) end
Private Instance Methods
application()
click to toggle source
# File lib/troo/api/headers.rb, line 35 def application OAuth::Token.new(Troo.configuration.api_oauth_token, Troo.configuration.api_oauth_token_secret) end
consumer()
click to toggle source
# File lib/troo/api/headers.rb, line 44 def consumer OAuth::Consumer.new(Troo.configuration.api_key, Troo.configuration.api_token, OAuthSettings.new(uri: uri).to_hash) end
defaults()
click to toggle source
# File lib/troo/api/headers.rb, line 29 def defaults { 'Authorization' => consumer.sign!(wrapper, application) } end
wrapper()
click to toggle source
# File lib/troo/api/headers.rb, line 40 def wrapper Net::HTTP::Get.new(uri) end