Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

geo-regions

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

geo-regions

  • 1.0.1
  • Rubygems
  • Socket score

Version published
Maintainers
2
Created
Source

geo-regions Ruby Gem

Gem License: MIT Build CodeQL Gem Version

A very simple ruby gem to get a list of states in a country. Also, you can get a list of cities in a state, and a list of all countries of the world.

How to use it?

  • Add to your project from RubyGems:
gem "geo-regions", "~> 1.0.0"
  • You can install it directly from the GitHub packages also:
source "https://rubygems.pkg.github.com/dcotecnologia" do
  gem "geo-regions", "~> 1.0.0"
end
  • Or:
gem "geo-regions", github: "dcotecnologia/geo-regions", tag: "v1.0.0"

By default, the gem uses the default locale of the i18n library. You can set a custom locale setting a custom configuration:

GR.configure do |config|
  config.locale = :en
end
  • Retrieve a list of cities:
GR::City.all
  • Retrieve a list of cities by state code and/or country code and/or similar name:
GR:City.find(state: "SP", country: "BR", name: "io Cl")

# expected response
=>
[<GR::City:0x00007f25991fe328
  @name="Rio Claro",
  @positions=GR::Geolite::CityPositions,
  @state=
    <GR::State:0x00007f25991fe3a0
      @code="SP",
      @country=
      #<GR::Country:0x00007f25991fe418
        @code="BR",
        @continent=
        #<GR::Continent:0x00007f25991fe468
          @code="SA",
          @name="\"SOUTH AMERICA\"">,
        @is_in_european_union=0,
        @name="Brazil">,
      @name="Sao Paulo">,
  @time_zone="America/Sao_Paulo">]

For more samples how to use the gem, check the HOW_TO_USE.md file.

If you want to edit the source code and/or contribuct to the gem, please, check the BUILDING.md and CONTRIBUTING.md files.

Problems?

Please do not directly email any committers with questions or problems. A community is best served when discussions are held in public.

Searching the issues for your problem is also a good idea.

Contributing

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet;
  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it;
  • Fork the project;
  • Start a feature/bugfix branch;
  • Commit and push until you are happy with your contribution;
  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.;
  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

License

Please see LICENSE for licensing details.

MaxMind databases

Database License: CC BY-SA 4.0

This product includes GeoLite2 data created by MaxMind, available from https://www.maxmind.com. You can find the License of the databases here.

Security Policy

Take a look at our security policy to learn more about versions supported with security updates and how to report bugs and vulnerabilities.

Creators and maintainers

FAQs

Package last updated on 02 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc