Sha256: 7a012f1357ab5eebc53e3a8eace2b46bc2dc42297b062f6b0d9e21c6bbc73bda

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

module Whatser
  class Follow < Whatser::Resource
    attr_accessor :id
    attr_accessor :name,:avatar_pic,:location
    attr_accessor :promoted,:collections_count
    attr_accessor :following,:followed,:foaf_count,:foaf
    
    class << self
      def list(opts={})
        api_request :get, "/api/follows", {:query => opts}
      end
      
      def followers(id, opts={})
        api_request :get, "/api/users/#{id}/followers", {:query => opts}
      end      
      
      def suggested(opts={})
        api_request :get, "/api/users/suggested", {:query => opts}
      end        
      
      def create(user_id, opts={})
        api_request :post, "/api/follows/#{user_id}", {:query => opts, :body => ''}
      end

      def delete(user_id)
        api_request :delete, "/api/follows/#{user_id}"
      end
      
      def ignore(user_id)
        delete(user_id)
      end
      
      def connection(user_id)
        api_request :get, "/api/users/#{user_id}/connection"
      end        
    end
    
    def save
      self.class.create( id )
    end      
    
    def delete
      self.class.ignore( id )
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
whatser-0.6.1 lib/whatser/resources/follow.rb