Module: SCOAuthActiveResource

Defined in:
lib/soundcloud/sc_oauth_active_resource.rb

Class Method Summary collapse

Class Method Details

.register(add_to_module, model_module, options = {}) ⇒ Object

TODO check if klass has ancestor OAuthActiveResource



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/soundcloud/sc_oauth_active_resource.rb', line 11

def self.register(add_to_module, model_module, options = {})
    
  oauth_connection = options[:access_token]
  
  if oauth_connection.nil?
    oauth_connection = Soundcloud::PublicOAuthAccessToken.new(options[:consumer_key])
  end

  temp_hash = {:access_token => oauth_connection}
  options.merge!(temp_hash)

  mod = OAuthActiveResource.register(add_to_module, model_module, options)
  return mod
end