Sha256: b08cef24aeb7a38e2ce71f0a8295b61befe73dc8427e345ff7dbcca97bf66618

Contents?: true

Size: 989 Bytes

Versions: 1

Compression:

Stored size: 989 Bytes

Contents

module SoundcloudAuth
  class Error < StandardError; end

  def self.config(environment=RAILS_ENV)
    @config ||= {}
    @config[environment] ||= YAML.load(File.open(RAILS_ROOT + '/config/soundcloud_auth.yml').read)[environment]
  end
  
  def self.base_url
    config['base_url'] || 'http://api.soundcloud.com'    
  end

  def self.path_prefix
    URI.parse(base_url).path
  end

  def self.oauth_callback?
    config.key?('oauth_callback')
  end

  def self.oauth_callback
    config['oauth_callback']
  end

  def self.remember_for
    (config['remember_for'] || 14).to_i
  end
  
  def self.consumer
    
    options = {
      :site => TwitterAuth.base_url,
      :request_token_path => "/oauth/request_token",
      :access_token_path => "/oauth/access_token",
      :authorize_path => "/oauth/authorize"
    }
    
    OAuth::Consumer.new(
      config['key'],
      config['secret'],
      options
    )
    
  end
  
=end
  
end

require 'soundcloud_auth/controller_extensions'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
soundcloud-auth-0.1.0 lib/soundcloud_auth.rb