Module: SoundcloudAuth

Defined in:
lib/soundcloud_auth.rb,
app/models/soundcloud_auth/generic_user.rb,
lib/soundcloud_auth/controller_extensions.rb

Defined Under Namespace

Modules: ControllerExtensions Classes: Error, GenericUser

Class Method Summary collapse

Class Method Details

.base_urlObject



9
10
11
# File 'lib/soundcloud_auth.rb', line 9

def self.base_url
  config['base_url'] || 'http://api.soundcloud.com'    
end

.config(environment = RAILS_ENV) ⇒ Object



4
5
6
7
# File 'lib/soundcloud_auth.rb', line 4

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

.consumerObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/soundcloud_auth.rb', line 29

def self.consumer
  
  options = {
    :site => SoundcloudAuth.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

.oauth_callbackObject



21
22
23
# File 'lib/soundcloud_auth.rb', line 21

def self.oauth_callback
  config['oauth_callback']
end

.oauth_callback?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/soundcloud_auth.rb', line 17

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

.path_prefixObject



13
14
15
# File 'lib/soundcloud_auth.rb', line 13

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

.remember_forObject



25
26
27
# File 'lib/soundcloud_auth.rb', line 25

def self.remember_for
  (config['remember_for'] || 14).to_i
end