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
14
# File 'lib/go_transit/client.rb', line 8

def get(path)
  uri = URI("#{GoTransit.base_url}/#{API_VERSION}/#{path}"\
            "?key=#{GoTransit.api_key}")
  response = Net::HTTP.get_response(uri)
  json = JSON.parse(response.body)
  Response.new(json)
end