Sha256: 8434b7d664dc729ec833fb2e1e91aa7a952c45a7fe3fb21216836d6ce16ef8cd
Contents?: true
Size: 583 Bytes
Versions: 3
Compression:
Stored size: 583 Bytes
Contents
require 'faraday' require 'faraday_middleware' require 'json' module MLB # @private class Request # Perform an HTTP GET request def self.get(path, options={}, raw=false) response = connection(raw).get do |request| request.url(path, options) end raw ? response : response.body end private def self.connection(raw=false) Faraday.new(:url => 'http://api.freebase.com') do |connection| connection.use FaradayMiddleware::ParseJson unless raw connection.adapter Faraday.default_adapter end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mlb-0.5.9 | lib/mlb/request.rb |
mlb-0.5.8 | lib/mlb/request.rb |
mlb-0.5.7 | lib/mlb/request.rb |