module EmergencyNumber
Helps fetch JSON data from API call and returns easy to work with object.
Constants
- VERSION
Final versioning for the gem.
Public Instance Methods
get_country(code = :us)
click to toggle source
Fetches list of Emergency Numbers from the Emergency Number API service.
@param code [Symbol] the language code. @return [Hash] returned as Hash object in normalized dot notation form.
@example Get list of number for Australia
EmergencyNumber.get_country(:au)
# File lib/emergency_number.rb, line 20 def get_country(code = :us) response = get("/#{code}/") body = JSON.parse(response.body, symbolize_names: true) body.extend(Normalize) end