lib/pinboard/client.rb in pinboard-0.0.3 vs lib/pinboard/client.rb in pinboard-0.0.4
- old
+ new
@@ -9,15 +9,15 @@
@auth = { :username => options[:username],
:password => options[:password] }
end
def posts(params={})
- options = {}
+ options = {}
options[:basic_auth] = @auth
- options[:query] = params
+ options[:query] = params
posts = self.class.get('/posts/all', options)['posts']['post']
- if !posts.nil?
- posts.map { |p| Post.new(Util.symbolize_keys(p)) }
- end
+ posts = [] if posts.nil?
+ posts = [posts] if posts.class != Array
+ posts.map { |p| Post.new(Util.symbolize_keys(p)) }
end
end
end