Class: GoTransit::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/go_transit/client.rb

Constant Summary collapse

API_VERSION =
"V1".freeze

Instance Method Summary collapse

Instance Method Details

#get(path) ⇒ Object



8
9
10
11
12
13
# File 'lib/go_transit/client.rb', line 8

def get(path)
  uri = URI("#{GoTransit.base_url}/#{API_VERSION}/#{path}"\
            "?key=#{GoTransit.api_key}")
  http_response = Net::HTTP.get_response(uri)
  Response.new(parse_body(http_response), http_response.code.to_i)
end