My Phone Codes Gem
This gem provides information about country phone codes, country names, and related details. It allows you to search for country phone codes, find country information based on the phone code, and retrieve a list of all available country phone codes.
Installation
You can install the gem by adding it to your Gemfile:
gem 'my_phone_codes_gem'
then run:
bundle install
Or install it directly via RubyGems:
gem install my_phone_codes_gem
Usage/Examples
Get Information of a Specific Country
You can search for a specific country by name to get details including country code, phone code, ISO code, and flag.
MyPhoneCodesGem.get_phone_code("Canada")
This will return a hash with details of the country or a message saying "Country not found" if the country is not found.
Get Information of a Specific Country from Phone Code
You can search for a country by its phone code. The method will return the country’s details if found.
MyPhoneCodesGem.get_country_from_code("+1")
This will return a list of countries that use the given phone code, or "Country not found" if no match is found.
Get All Available Phone Codes
You can get all available phone codes with their respective details (country name, country code, phone code, country ISO code, and flag).
MyPhoneCodesGem.get_all_phone_codes
This will return an array of all country phone code records.