Sha256: ff408625760e44864bdc5447fa347a5387fe1b0e7b99f02b6b0fabf0b1a605d9

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

require "citybikes_api/version"
require "httparty"

# A collection of methods to facilitate citybikes api requests.
module CitybikesApi
  # The base url for all endpoint requests.
  BASE_URL = "http://api.citybik.es/v2"

  # Networks Endpoint
  #
  # @param [Hash] options An object of named URL parameters to pass along with the request.
  # @param [Hash] options [String] :field A comma-separated string of network object attributes.
  #
  # @example CityBikesApi.networks
  # @example CityBikesApi.networks({:fields => "id,name,href"})
  #
  def self.networks(options = {})
    HTTParty.get("#{BASE_URL}/networks", :query => options)
  end

  # Network Endpoint
  #
  # @param [String] network_id The unique bike-share network identifier assigned by citybikes.
  # @param [Hash] options An object of named URL parameters to pass along with the request.
  # @param [Hash] options [String] :field A comma-separated string of network object attributes.
  #
  # @example CityBikesApi.network("capital-bikeshare")
  # @example CityBikesApi.network("capital-bikeshare", {:fields => "id,name,href"})
  #
  def self.network(network_id, options = {})
    HTTParty.get("#{BASE_URL}/networks/#{network_id}", :query => options)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
citybikes_api-2.0.1 lib/citybikes_api.rb