Sha256: 4ead0956a7b2db2a6dbdbd65d36b442a670997e5affaed484d4e9dfb7d753979

Contents?: true

Size: 546 Bytes

Versions: 1

Compression:

Stored size: 546 Bytes

Contents

require 'faraday'
require 'faraday_middleware'

module MLB
  # @private
  class Request
    # Perform an HTTP GET request
    def self.get(path, options = {})
      connection.get do |request|
        request.url(path, options)
      end.body
    end

  private

    def self.connection
      Faraday.new(:url => 'https://www.googleapis.com', :ssl => {:verify => false}) do |builder|
        builder.request :url_encoded
        builder.use FaradayMiddleware::ParseJson
        builder.adapter Faraday.default_adapter
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mlb-0.7.0 lib/mlb/request.rb