Module: CitybikesApi

Defined in:
lib/citybikes_api.rb,
lib/citybikes_api/version.rb

Overview

A collection of methods to facilitate citybikes api requests.

Constant Summary collapse

BASE_URL =

The base url for all endpoint requests.

"http://api.citybik.es/v2"
VERSION =

The major version of this gem should correspond to the citybikes api version.

"2.0.1"

Class Method Summary collapse

Class Method Details

.network(network_id, options = {}) ⇒ Object

Network Endpoint

Examples:

CityBikesApi.network("capital-bikeshare")

CityBikesApi.network("capital-bikeshare", => "id,name,href")

Parameters:

  • network_id (String)

    The unique bike-share network identifier assigned by citybikes.

  • options (Hash) (defaults to: {})

    An object of named URL parameters to pass along with the request.

  • options (Hash) (defaults to: {})

    [String] :field A comma-separated string of network object attributes.



30
31
32
# File 'lib/citybikes_api.rb', line 30

def self.network(network_id, options = {})
  HTTParty.get("#{BASE_URL}/networks/#{network_id}", :query => options)
end

.networks(options = {}) ⇒ Object

Networks Endpoint

Examples:

CityBikesApi.networks

CityBikesApi.networks(=> "id,name,href")

Parameters:

  • options (Hash) (defaults to: {})

    An object of named URL parameters to pass along with the request.

  • options (Hash) (defaults to: {})

    [String] :field A comma-separated string of network object attributes.



17
18
19
# File 'lib/citybikes_api.rb', line 17

def self.networks(options = {})
  HTTParty.get("#{BASE_URL}/networks", :query => options)
end