Module: NYCGeoClient::Client::Blockface

Included in:
NYCGeoClient::Client
Defined in:
lib/nyc_geo_client/client/blockface.rb

Overview

Defines methods related to branches

Instance Method Summary collapse

Instance Method Details

#blockface(on_street:, cross_street_one:, cross_street_two:, borough:, borough_cross_street_one: nil, borough_cross_street_two: nil, compass_direction: nil) ⇒ Hashie::Mash

Returns information about a segment defined by an on street between two cross-streets.

Examples:

information about a segment defined by an on street between two cross-streets

NYCGeoClient.blockface('34 st', 'fifht ave', 'sixth ave', 'manhattan')

Parameters:

  • on_street (String)

    The street on which the segment is found

  • cross_street_one (String)

    The first cross street

  • cross_street_two (String)

    The second cross street

  • borough (String)

    The borough in which the on_street is located

  • extra (Hash)

    optional params:

    • boroughCrossStreetOne: The borough in which the cross_street_one is located if it differs from the borough parameter

    • boroughCrossStreetTwo: The borough in which the cross_street_two is located if it differs from the borough parameter

    • compassDirection: Used when requesting information about only one side of the street (north, south, west, east, n, s, w, e)

Returns:

  • (Hashie::Mash)


20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/nyc_geo_client/client/blockface.rb', line 20

def blockface(on_street:, cross_street_one:, cross_street_two:, borough:, borough_cross_street_one: nil, borough_cross_street_two: nil, compass_direction: nil)
  options = {
    onStreet:    on_street,
    crossStreetOne: cross_street_one,
    crossStreetTwo: cross_street_two,
    borough: borough,
    boroughCrossStreetOne: borough_cross_street_one,
    boroughCrossStreetTwo: borough_cross_street_two,
    compassDirection: compass_direction
  }.reject { |k, v| v.nil? }
  get(blockface_path, options)
end