Class: GdsApi::Mapit
Defined Under Namespace
Classes: Location
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #area_for_code(code_type, code) ⇒ Object
- #areas_for_type(type) ⇒ Object
- #location_for_postcode(postcode) ⇒ Object
Methods inherited from Base
#client, #create_client, #get_list!, #initialize, #url_for_slug
Constructor Details
This class inherits a constructor from GdsApi::Base
Instance Method Details
#area_for_code(code_type, code) ⇒ Object
15 16 17 |
# File 'lib/gds_api/mapit.rb', line 15 def area_for_code(code_type, code) get_json("#{base_url}/code/#{code_type}/#{code}.json") end |
#areas_for_type(type) ⇒ Object
11 12 13 |
# File 'lib/gds_api/mapit.rb', line 11 def areas_for_type(type) get_json("#{base_url}/areas/#{type}.json") end |
#location_for_postcode(postcode) ⇒ Object
6 7 8 9 |
# File 'lib/gds_api/mapit.rb', line 6 def location_for_postcode(postcode) response = get_json("#{base_url}/postcode/#{CGI.escape postcode}.json") Location.new(response) unless response.nil? end |