{"id":22743105,"url":"https://github.com/rikas/cloudflare_localizable","last_synced_at":"2025-04-14T08:42:41.600Z","repository":{"id":56843581,"uuid":"46282633","full_name":"rikas/cloudflare_localizable","owner":"rikas","description":"Gem to use in a Rails app to get country information easily if you're using CloudFlare. ","archived":false,"fork":false,"pushed_at":"2020-05-03T18:32:51.000Z","size":26,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-24T21:21:54.823Z","etag":null,"topics":["cloudflare","country","country-information","localization","rails"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rikas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-16T15:15:36.000Z","updated_at":"2023-08-14T09:24:17.000Z","dependencies_parsed_at":"2022-09-07T20:10:13.213Z","dependency_job_id":null,"html_url":"https://github.com/rikas/cloudflare_localizable","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rikas%2Fcloudflare_localizable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rikas%2Fcloudflare_localizable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rikas%2Fcloudflare_localizable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rikas%2Fcloudflare_localizable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rikas","download_url":"https://codeload.github.com/rikas/cloudflare_localizable/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248849681,"owners_count":21171621,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloudflare","country","country-information","localization","rails"],"created_at":"2024-12-11T01:16:33.745Z","updated_at":"2025-04-14T08:42:41.581Z","avatar_url":"https://github.com/rikas.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/rikas/cloudflare_localizable.svg?branch=master)](https://travis-ci.org/rikas/cloudflare_localizable)\n\n# CloudFlareLocalizable\n\nIf you're using [CloudFlare](https://www.cloudflare.com/) you can easily get the country\nof users requesting your pages. This is a very basic gem to help you get the country information in\nyour Rails applications when you're using CloudFlare services.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'cloudflare_localizable'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install cloudflare_localizable\n\n## Usage\n\nYou should include `CloudFlareLocalizable` in any Rails controller that needs country information.\nYou get a helper method called `cf_country` to be used whenever you need to know the country of the\nuser.\n\n```ruby\nclass ExampleController \u003c ApplicationController\n  include CloudFlareLocalizable\n\n  def index\n    cf_country.code # =\u003e \"BB\"\n    cf_country.name # =\u003e \"Barbados\"\n  end\nend\n```\n\nBecause it is a helper method you can use it in the views if you want.\n\n```html\n\u003cul\u003e\n  \u003cli\u003eCode: \u003c%= cf_country.code %\u003e\u003c/li\u003e\n  \u003cli\u003eName: \u003c%= cf_country.name %\u003e\u003c/li\u003e\n\u003c/ul\u003e\n```\n\n### What happens if we can't get the country information?\n\nIf something goes wrong, or the client is trying to spoof an unknown location, or CloufFlare can't\nget the country information for a given IP address then you get code `XX` and name `Unknown`.\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run\nthe tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new\nversion, update the version number in `version.rb`, and then run `bundle exec rake release`, which\nwill create a git tag for the version, push git commits and tags, and push the `.gem` file to\n[rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at\nhttps://github.com/rikas/cloudflare_localizable.\n\n\n## License\n\nThe gem is available as open source under the terms of the\n[MIT License](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frikas%2Fcloudflare_localizable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frikas%2Fcloudflare_localizable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frikas%2Fcloudflare_localizable/lists"}