class Forrst::User::PublicPosts
Constants
- RESOURCE
Attributes
posts[R]
username[R]
Public Class Methods
new(username)
click to toggle source
# File lib/forrst/user/public_posts.rb, line 22 def initialize(username) raise Exceptions::InvalidUsername unless username.is_a? String @username = username end
Public Instance Methods
retrieve()
click to toggle source
# File lib/forrst/user/public_posts.rb, line 10 def retrieve return posts unless posts.nil? response = get("#{RESOURCE}?username=#{@username}") @posts = ListOfPosts.new(response) response['resp'].map { |p| @posts.add_post(Forrst::Post.new(p)) } @posts end
Private Instance Methods
get(uri)
click to toggle source
# File lib/forrst/user/public_posts.rb, line 27 def get(uri) begin response = RestClient.get uri Yajl::Parser.parse(response.body) if response.code == 200 rescue RestClient::ResourceNotFound raise Exceptions::UserNotFound end end