Module: DbAgile::Restful::Client::Get

Included in:
DbAgile::Restful::Client
Defined in:
lib/dbagile/restful/client/get.rb

Instance Method Summary collapse

Instance Method Details

#get(path, projection = nil) ⇒ Object

Makes a get request



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/dbagile/restful/client/get.rb', line 7

def get(path, projection = nil)
  with_uri(path, projection) do |uri|
    Net::HTTP.start(uri.host, uri.port) {|http|
      res = if uri.query
        http.get(uri.path + "?" + uri.query)
      else
        http.get(uri.path)
      end
      yield(res, http)
      res.body
    }
  end
end