Class OAuthActiveResource::Resource
In: lib/oauth_active_resource/resource.rb
Parent: ActiveResource::Base

Methods

Attributes

oauth_connection  [RW] 

Public Class methods

has_many allows resources with sub-resources which arent nested to be accessable.

Example: User 123 (example.com/users/123/) has many friends The list of friends can be accessed by example.com/users/123/friends Our class definition:

  class User < Resource
    has_many :friends
  end

  user = User.find(123)
  user.friends.each do |friend|
    p friend.name
  end

  # adding a friend
  stranger = User.find(987)
  user.friends << stranger
  user.friends.save
 => sends a PUT with collection of friends to http://example.com/users/123/friends

allows you to POST/PUT an oauth authenticated multipart request

Public Instance methods

TODO remove when soundcloud api is fixed

 if self has no id, try extracting from uri

[Validate]