lib/sinatra_client.rb in sinatra_client-0.0.3 vs lib/sinatra_client.rb in sinatra_client-0.0.4

- old
+ new

@@ -9,12 +9,13 @@ def initialize(current_user_id = nil) @current_user_id = current_user_id @url = URI::HTTP.build(userinfo: "#{ENV['API_NAME']}:#{ENV['API_PASSWORD']}", host: ENV['SINATRA_HOST'], port: ENV['SINATRA_PORT'], path: '/api/v1') end - def get_user_posts(user_id) + def get_user_posts(user_id, page) url.path << "/users/#{user_id}/posts" + url.query = URI.encode_www_form({ page: page }) parse RestClient.get(url.to_s) end def create_post(post) url.path << '/posts' @@ -68,6 +69,5 @@ def parse(response) JSON.parse(response.body) end end -