Sha256: 47032a7d4f0108fdf65c91d1162b80f0ea77ce1a4a36c2dfb7782645b92fb059
Contents?: true
Size: 1.01 KB
Versions: 2
Compression:
Stored size: 1.01 KB
Contents
module Soundcloud # Subclass to force API users to pass a consumer key with each request. class PublicOAuthAccessToken < OAuthActiveResource::FakeOAuthAccessToken attr_accessor :token, :secret def initialize(key) @key = key @token = "public #{key}" @secret = 'Anonymous' # ensure that keys are symbols @options = @@default_options end def request(http_method, path, token = nil, request_options = {}, *arguments) # Force a relative path from an absolute path if path !~ /^\// @http = create_http(path) end _uri = URI.parse(path) # Append the consumer key to the request if _uri.query.nil? _uri.query = "consumer_key=#{@key}" else _uri.query += "&consumer_key=#{@key}" end path = "#{_uri.path}#{_uri.query ? "?#{_uri.query}" : ""}" rsp = http.request(create_http_request(http_method, path, token, request_options, *arguments, @key)) rsp end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
soundcloud-ruby-api-wrapper-0.4.7 | lib/soundcloud/public_oauth_access_token.rb |
soundcloud-ruby-api-wrapper-0.4.6 | lib/soundcloud/public_oauth_access_token.rb |