{"id":33574268,"url":"https://github.com/what3words/w3w-ruby-wrapper","last_synced_at":"2025-11-28T13:05:19.229Z","repository":{"id":24790481,"uuid":"28204266","full_name":"what3words/w3w-ruby-wrapper","owner":"what3words","description":"Ruby wrapper for the what3words API","archived":false,"fork":false,"pushed_at":"2025-01-15T12:18:15.000Z","size":120,"stargazers_count":16,"open_issues_count":0,"forks_count":7,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-10-17T17:32:19.624Z","etag":null,"topics":["geocoding","ruby","what3words-api"],"latest_commit_sha":null,"homepage":"https://developer.what3words.com/public-api","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/what3words.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-12-18T22:25:28.000Z","updated_at":"2025-10-06T08:59:27.000Z","dependencies_parsed_at":"2025-01-15T11:56:36.515Z","dependency_job_id":"848bc62a-e773-4e20-8e77-915a9f39a64f","html_url":"https://github.com/what3words/w3w-ruby-wrapper","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/what3words/w3w-ruby-wrapper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/what3words%2Fw3w-ruby-wrapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/what3words%2Fw3w-ruby-wrapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/what3words%2Fw3w-ruby-wrapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/what3words%2Fw3w-ruby-wrapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/what3words","download_url":"https://codeload.github.com/what3words/w3w-ruby-wrapper/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/what3words%2Fw3w-ruby-wrapper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27308371,"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","status":"online","status_checked_at":"2025-11-28T02:00:06.623Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["geocoding","ruby","what3words-api"],"created_at":"2025-11-28T13:03:10.022Z","updated_at":"2025-11-28T13:05:19.220Z","avatar_url":"https://github.com/what3words.png","language":"Ruby","readme":"# \u003cimg src=\"https://what3words.com/assets/images/w3w_square_red.png\" width=\"32\" height=\"32\" alt=\"what3words\"\u003e\u0026nbsp;what3words Ruby wrapper\n\n[![Build Status](https://travis-ci.org/what3words/w3w-ruby-wrapper.svg?branch=master)](https://travis-ci.org/what3words/w3w-ruby-wrapper)\n\nThe Ruby wrapper is useful for Ruby developers who wish to seamlessly integrate the [what3words Public API](https://developer.what3words.com/public-api) into their Ruby applications, without the hassle of having to manage the low level API calls themselves.\n\nThe what3words API is a fast, simple interface which allows you to convert what3words addresses such as `///index.home.raft` to latitude and longitude coordinates such as `-0.203586, 51.521251` and vice versa. It features a powerful autosuggest function, which can validate and autocorrect user input and limit it to certain geographic areas (this powers the search box on our map site). It allows you to request a section of the what3words grid (which can be requested as GeoJSON for easy display on online maps), and to request the list of all languages supported by what3words. For advanced users, autosuggest can be used to post-process voice output.\n\nAll coordinates are latitude,longitude pairs in standard `WGS-84` (as commonly used worldwide in GPS systems). All latitudes must be in the range of `-90 to 90 (inclusive)`.\n\n## Installation\n\nThe library is available through [RubyGems](https://rubygems.org/gems/what3words).\n\nYou can simply add this line to your application's Gemfile:\n\n```\n    gem 'what3words', '~\u003e 3.4'\n```\n\nAnd then execute:\n\n```shell\n    $ bundle\n```\n\nOr install it yourself as:\n\n```shell\n    $ gem install what3words\n```\n\n## Usage\n\nSign up for an API key at [https://developer.what3words.com](https://developer.what3words.com)\n\nSee [https://developer.what3words.com/public-api/docs](https://developer.what3words.com/public-api/docs) for all parameters that can be passed to the API calls.\n\nIf not using Bundler, require it:\n\n```ruby\n    require 'what3words'\n```\n\nThen:\n\n```ruby\n    what3words = What3Words::API.new(:key =\u003e \"YOURAPIKEY\")\n```\n\nConvert to Coordinates: convert a what3words address into GPS coordinates (WGS84)\n\n```ruby\nwhat3words.convert_to_coordinates 'prom.cape.pump'\n```\n\n**Expected Output**\n```\n# =\u003e {:country=\u003e\"GB\", :square=\u003e{:southwest=\u003e{:lng=\u003e-0.195426, :lat=\u003e51.484449}, :northeast=\u003e{:lng=\u003e-0.195383, :lat=\u003e51.484476}}, :nearestPlace=\u003e\"Kensington, London\", :coordinates=\u003e{:lng=\u003e-0.195405, :lat=\u003e51.484463}, :words=\u003e\"prom.cape.pump\", :language=\u003e\"en\", :map=\u003e\"https://w3w.co/prom.cape.pump\"}\n```\n\n## API\n### Convert to Coordinates\nConvert a what3words address into GPS coordinates and return what3words for the same position.\n\n```ruby\nwhat3words.convert_to_coordinates \"prom.cape.pump\"\n```\n\n**Expected Output**\n```\n# =\u003e {:country=\u003e\"GB\", :square=\u003e{:southwest=\u003e{:lng=\u003e-0.195426, :lat=\u003e51.484449}, :northeast=\u003e{:lng=\u003e-0.195383, :lat=\u003e51.484476}}, :nearestPlace=\u003e\"Kensington, London\", :coordinates=\u003e{:lng=\u003e-0.195405, :lat=\u003e51.484463}, :words=\u003e\"prom.cape.pump\", :language=\u003e\"en\", :map=\u003e\"https://w3w.co/prom.cape.pump\"}\n```\nSupported keyword params for `convert_to_coordinates` call:\n\n* `words` A what3words address as a string\n* `format`  Return data format type. It can be one of json (the default) or geojson\n\n\n### Convert to 3WA\nConvert position information, latitude and longitude coordinates, into a what3words address.\n\n```ruby\nwhat3words.convert_to_3wa [29.567041, 106.587875]\n```\n\n**Expected Output**\n```\n# =\u003e {:country=\u003e\"CN\", :square=\u003e{:southwest=\u003e{:lng=\u003e106.58786, :lat=\u003e29.567028}, :northeast=\u003e{:lng=\u003e106.587891, :lat=\u003e29.567055}}, :nearestPlace=\u003e\"Chongqing\", :coordinates=\u003e{:lng=\u003e106.587875, :lat=\u003e29.567041}, :words=\u003e\"disclose.strain.redefined\", :language=\u003e\"en\", :map=\u003e\"https://w3w.co/disclose.strain.redefined\"}\n```\n\nConvert position information to a what3words address in a specific language\n\n```ruby\nwhat3words.convert_to_3wa [29.567041, 106.587875], language: 'fr'\n```\n\n**Expected Output**\n```\n# =\u003e :country=\u003e\"CN\", :square=\u003e{:southwest=\u003e{:lng=\u003e106.58786, :lat=\u003e29.567028}, :northeast=\u003e{:lng=\u003e106.587891, :lat=\u003e29.567055}}, :nearestPlace=\u003e\"Chongqing\", :coordinates=\u003e{:lng=\u003e106.587875, :lat=\u003e29.567041}, :words=\u003e\"courgette.rabotons.infrason\", :language=\u003e\"fr\", :map=\u003e\"https://w3w.co/courgette.rabotons.infrason\"}\n```\n\nSupported keyword params for `convert_to_3wa` call:\n\n* `coordinates` The coordinates of the location to convert to what3words address\n* `language` (defaults to en) - A supported what3words address language as an ISO 639-1 2 letter code\n* `format` Return data format type. It can be one of json (the default) or geojson\n\n### Autosuggest\nReturns a list of what3words addresses based on user input and other parameters.\n\nThis resource provides corrections for the following types of input error:\n- typing errors\n- spelling errors\n- misremembered words (e.g. singular vs. plural)\n- words in the wrong order\n\nThe autosuggest resource determines possible corrections to the supplied what3words address string based on the probability of the input errors listed above and returns a ranked list of suggestions. This resource can also take into consideration the geographic proximity of possible corrections to a given location to further improve the suggestions returned.\n\nSee [https://developer.what3words.com/public-api/docs#autosuggest](https://developer.what3words.com/public-api/docs#autosuggest) for detailed information\n\nGets suggestions in french for this address:\n\n```ruby\nwhat3words.autosuggest 'trop.caler.perdre', language: 'fr'\n```\n\n**Expected Output**\n```\n# =\u003e {:suggestions=\u003e[{:country=\u003e\"FR\", :nearestPlace=\u003e\"Saint-Lary-Soulan, Hautes-Pyrénées\", :words=\u003e\"trier.caler.perdre\", :rank=\u003e1, :language=\u003e\"fr\"}, {:country=\u003e\"ET\", :nearestPlace=\u003e\"Asbe Teferi, Oromiya\", :words=\u003e\"trôler.caler.perdre\", :rank=\u003e2, :language=\u003e\"fr\"}, {:country=\u003e\"CN\", :nearestPlace=\u003e\"Ulanhot, Inner Mongolia\", :words=\u003e\"froc.caler.perdre\", :rank=\u003e3, :language=\u003e\"fr\"}]}\n```\n\nGets suggestions for a different number of suggestions, i.e. 10 for this address:\n\n```ruby\nwhat3words.autosuggest 'disclose.strain.redefin', language: 'en', 'n-results': 10\n```\n\n**Expected Output**\n```\n# =\u003e {:suggestions=\u003e[{:country=\u003e\"SO\", :nearestPlace=\u003e\"Jamaame, Lower Juba\", :words=\u003e\"disclose.strain.redefine\", :rank=\u003e1, :language=\u003e\"en\"}, {:country=\u003e\"ZW\", :nearestPlace=\u003e\"Mutoko, Mashonaland East\", :words=\u003e\"discloses.strain.redefine\", :rank=\u003e2, :language=\u003e\"en\"}, {:country=\u003e\"MM\", :nearestPlace=\u003e\"Mogok, Mandalay\", :words=\u003e\"disclose.strains.redefine\", :rank=\u003e3, :language=\u003e\"en\"}, {:country=\u003e\"CN\", :nearestPlace=\u003e\"Chongqing\", :words=\u003e\"disclose.strain.redefined\", :rank=\u003e4, :language=\u003e\"en\"}, {:country=\u003e\"ZM\", :nearestPlace=\u003e\"Binga, Matabeleland North\", :words=\u003e\"disclosing.strain.redefine\", :rank=\u003e5, :language=\u003e\"en\"}, {:country=\u003e\"XH\", :nearestPlace=\u003e\"Leh, Ladakh\", :words=\u003e\"disclose.straining.redefine\", :rank=\u003e6, :language=\u003e\"en\"}, {:country=\u003e\"US\", :nearestPlace=\u003e\"Kamas, Utah\", :words=\u003e\"disclose.strain.redefining\", :rank=\u003e7, :language=\u003e\"en\"}, {:country=\u003e\"GN\", :nearestPlace=\u003e\"Boké\", :words=\u003e\"disclose.strained.redefine\", :rank=\u003e8, :language=\u003e\"en\"}, {:country=\u003e\"BO\", :nearestPlace=\u003e\"Pailón, Santa Cruz\", :words=\u003e\"discloses.strains.redefine\", :rank=\u003e9, :language=\u003e\"en\"}, {:country=\u003e\"US\", :nearestPlace=\u003e\"McGrath, Alaska\", :words=\u003e\"discloses.strain.redefined\", :rank=\u003e10, :language=\u003e\"en\"}]}\n```\n\nGets suggestions when the coordinates for focus has been provided for this address:\n\n```ruby\nwhat3words.autosuggest 'filled.count.soap', focus: [51.4243877,-0.34745]\n```\n\n**Expected Output**\n```\n# =\u003e {:suggestions=\u003e[{:country=\u003e\"US\", :nearestPlace=\u003e\"Homer, Alaska\", :words=\u003e\"fund.with.code\", :rank=\u003e1, :language=\u003e\"en\"}, {:country=\u003e\"AU\", :nearestPlace=\u003e\"Kumpupintil, Western Australia\", :words=\u003e\"funk.with.code\", :rank=\u003e2, :language=\u003e\"en\"}, {:country=\u003e\"US\", :nearestPlace=\u003e\"Charleston, West Virginia\", :words=\u003e\"fund.with.cove\", :rank=\u003e3, :language=\u003e\"en\"}]}\n```\n\nGets suggestions for a different number of focus results for this address:\n\n```ruby\nwhat3words.autosuggest 'disclose.strain.redefin', language: 'en', 'n-focus-results': 3\n```\n\n**Expected Output**\n```\n# =\u003e {:suggestions=\u003e[{:country=\u003e\"SO\", :nearestPlace=\u003e\"Jamaame, Lower Juba\", :words=\u003e\"disclose.strain.redefine\", :rank=\u003e1, :language=\u003e\"en\"}, {:country=\u003e\"ZW\", :nearestPlace=\u003e\"Mutoko, Mashonaland East\", :words=\u003e\"discloses.strain.redefine\", :rank=\u003e2, :language=\u003e\"en\"}, {:country=\u003e\"MM\", :nearestPlace=\u003e\"Mogok, Mandalay\", :words=\u003e\"disclose.strains.redefine\", :rank=\u003e3, :language=\u003e\"en\"}]}\n```\n\nGets suggestions for a voice input type mode, i.e. generic-voice, for this address:\n\n```ruby\nwhat3words.autosuggest 'fun with code', 'input-type': 'generic-voice', language: 'en'\n```\n\n**Expected Output**\n```\n# =\u003e {:suggestions=\u003e[{:country=\u003e\"US\", :nearestPlace=\u003e\"Homer, Alaska\", :words=\u003e\"fund.with.code\", :rank=\u003e1, :language=\u003e\"en\"}, {:country=\u003e\"AU\", :nearestPlace=\u003e\"Kumpupintil, Western Australia\", :words=\u003e\"funk.with.code\", :rank=\u003e2, :language=\u003e\"en\"}, {:country=\u003e\"US\", :nearestPlace=\u003e\"Charleston, West Virginia\", :words=\u003e\"fund.with.cove\", :rank=\u003e3, :language=\u003e\"en\"}]}\n```\n\nGets suggestions for a restricted area by clipping to country for this address:\n\n```ruby\nwhat3words.autosuggest 'disclose.strain.redefin', 'clip-to-country': 'GB,BE'\n```\n\n**Expected Output**\n```\n# =\u003e {:suggestions=\u003e[{:country=\u003e\"GB\", :nearestPlace=\u003e\"Nether Stowey, Somerset\", :words=\u003e\"disclose.retrain.redefined\", :rank=\u003e1, :language=\u003e\"en\"}, {:country=\u003e\"BE\", :nearestPlace=\u003e\"Zemst, Flanders\", :words=\u003e\"disclose.strain.reckon\", :rank=\u003e2, :language=\u003e\"en\"}, {:country=\u003e\"GB\", :nearestPlace=\u003e\"Waddington, Lincolnshire\", :words=\u003e\"discloses.trains.redefined\", :rank=\u003e3, :language=\u003e\"en\"}]}\n```\n\nGets suggestions for a restricted area by clipping to a bounding-box for this address:\n\n```ruby\nwhat3words.autosuggest 'disclose.strain.redefin', 'clip-to-bounding-box': [51.521, -0.343, 52.6, 2.3324]\n```\n\n**Expected Output**\n```\n# =\u003e {:suggestions=\u003e[{:country=\u003e\"GB\", :nearestPlace=\u003e\"Saxmundham, Suffolk\", :words=\u003e\"discloses.strain.reddish\", :rank=\u003e1, :language=\u003e\"en\"}]}\n```\n\n\nGets suggestions for a restricted area by clipping to a circle in km for this address:\n\n```ruby\nwhat3words.autosuggest 'disclose.strain.redefin', 'clip-to-circle': [51.521, -0.343, 142]\n```\n\n**Expected Output**\n```\n# =\u003e {:suggestions=\u003e[{:country=\u003e\"GB\", :nearestPlace=\u003e\"Market Harborough, Leicestershire\", :words=\u003e\"discloses.strain.reduce\", :rank=\u003e1, :language=\u003e\"en\"}]}\n```\n\nGets suggestions for a restricted area by clipping to a polygon for this address:\n\n```ruby\nwhat3words.autosuggest 'disclose.strain.redefin', 'clip-to-polygon': [51.521, -0.343, 52.6, 2.3324, 54.234, 8.343, 51.521, -0.343]\n```\n\n**Expected Output**\n```\n# =\u003e {:suggestions=\u003e[{:country=\u003e\"GB\", :nearestPlace=\u003e\"Saxmundham, Suffolk\", :words=\u003e\"discloses.strain.reddish\", :rank=\u003e1, :language=\u003e\"en\"}]}\n```\n\nGets suggestions for a restricted area by clipping to a polygon for this address:\n\n```ruby\nwhat3words.w3w.autosuggest 'disclose.strain.redefin', 'prefer-land': false, 'n-results': 10\n```\n\n**Expected Output**\n```\n# =\u003e {:suggestions=\u003e[{:country=\u003e\"SO\", :nearestPlace=\u003e\"Jamaame, Lower Juba\", :words=\u003e\"disclose.strain.redefine\", :rank=\u003e1, :language=\u003e\"en\"}, {:country=\u003e\"ZW\", :nearestPlace=\u003e\"Mutoko, Mashonaland East\", :words=\u003e\"discloses.strain.redefine\", :rank=\u003e2, :language=\u003e\"en\"}, {:country=\u003e\"MM\", :nearestPlace=\u003e\"Mogok, Mandalay\", :words=\u003e\"disclose.strains.redefine\", :rank=\u003e3, :language=\u003e\"en\"}, {:country=\u003e\"CN\", :nearestPlace=\u003e\"Chongqing\", :words=\u003e\"disclose.strain.redefined\", :rank=\u003e4, :language=\u003e\"en\"}, {:country=\u003e\"ZM\", :nearestPlace=\u003e\"Binga, Matabeleland North\", :words=\u003e\"disclosing.strain.redefine\", :rank=\u003e5, :language=\u003e\"en\"}, {:country=\u003e\"XH\", :nearestPlace=\u003e\"Leh, Ladakh\", :words=\u003e\"disclose.straining.redefine\", :rank=\u003e6, :language=\u003e\"en\"}, {:country=\u003e\"US\", :nearestPlace=\u003e\"Kamas, Utah\", :words=\u003e\"disclose.strain.redefining\", :rank=\u003e7, :language=\u003e\"en\"}, {:country=\u003e\"GN\", :nearestPlace=\u003e\"Boké\", :words=\u003e\"disclose.strained.redefine\", :rank=\u003e8, :language=\u003e\"en\"}, {:country=\u003e\"BO\", :nearestPlace=\u003e\"Pailón, Santa Cruz\", :words=\u003e\"discloses.strains.redefine\", :rank=\u003e9, :language=\u003e\"en\"}, {:country=\u003e\"US\", :nearestPlace=\u003e\"McGrath, Alaska\", :words=\u003e\"discloses.strain.redefined\", :rank=\u003e10, :language=\u003e\"en\"}]}\n```\n\nSupported keyword params for `autosuggest` call:\n  * `input` The full or partial what3words address to obtain suggestions for. At minimum this must be the first two complete words plus at least one character from the third word.\n  * `language` A supported what3words address language as an ISO 639-1 2 letter code. This setting is on by default. Use false to disable this setting and receive more suggestions in the sea.\n  * `n_results` The number of AutoSuggest results to return. A maximum of 100 results can be specified, if a number greater than this is requested, this will be truncated to the maximum. The default is 3.\n  * `n_focus_results` Specifies the number of results (must be \u003c= n_results) within the results set which will have a focus. Defaults to n_results. This allows you to run autosuggest with a mix of focussed and unfocussed results, to give you a \"blend\" of the two.\n  * `clip-to-country` Restricts autosuggest to only return results inside the countries specified by comma-separated list of uppercase ISO 3166-1 alpha-2 country codes (for example, to restrict to Belgium and the UK, use clip_to_country=\"GB,BE\").\n  * `clip-to-bounding-box` Restrict autosuggest results to a bounding box, specified by coordinates.\n  * `clip-to-circle` Restrict autosuggest results to a circle, specified by the center of the circle, latitude and longitude, and a distance in kilometres which represents the radius. For convenience, longitude is allowed to wrap around 180 degrees. For example 181 is equivalent to -179.\n  * `clip-to-polygon` Restrict autosuggest results to a polygon, specified by a list of coordinates. The polygon should be closed, i.e. the first element should be repeated as the last element; also the list should contain at least 4 entries. The API is currently limited to accepting up to 25 pairs.\n  * `input-type` For power users, used to specify voice input mode. Can be text (default), vocon-hybrid, nmdp-asr or generic-voice.\n  * `prefer-land` Makes autosuggest prefer results on land to those in the sea.\n\n### Grid\nReturns a section of the 3m x 3m what3words grid for a given area.\n\nSee [https://developer.what3words.com/public-api/docs#grid-section](https://developer.what3words.com/public-api/docs#grid-section) for detailed information.\n\nGets grid for these bounding box northeast 52.208867,0.117540,52.207988,0.116126.\n\n```ruby\nwhat3words.grid_section '52.208867,0.117540,52.207988,0.116126'\n```\n\n**Expected Output**\n```\n# =\u003e {:lines=\u003e[{:start=\u003e{:lng=\u003e0.116126, :lat=\u003e52.20801}, :end=\u003e{:lng=\u003e0.11754, :lat=\u003e52.20801}}, {:start=\u003e{:lng=\u003e0.116126, :lat=\u003e52.208037}, :end=\u003e{:lng=\u003e0.11754, :lat=\u003e52.208037}}, {:start=\u003e{:lng=\u003e0.116126, :lat=\u003e52.208064}, :end=\u003e{:lng=\u003e0.11754, :lat=\u003e52.208064}}, ___...___ ]}\n```\n\nSupported keyword params for `grid_section` call:\n  * `bounding-box` The bounding box is specified by the northeast and southwest corner coordinates, for which the grid should be returned\n  * `format` Return data format type. It can be one of json (the default) or geojson\n\n### Get Languages\nRetrieve a list of available what3words languages.\n\n```ruby\nwhat3words.available_languages\n```\n\n**Expected Output**\n```\n# =\u003e {:languages=\u003e[{:nativeName=\u003e\"Deutsch\", :code=\u003e\"de\", :name=\u003e\"German\"}, {:nativeName=\u003e\"हिन्दी\", :code=\u003e\"hi\", :name=\u003e\"Hindi\"}, {:nativeName=\u003e\"Português\", :code=\u003e\"pt\", :name=\u003e\"Portuguese\"}, {:nativeName=\u003e\"Magyar\", :code=\u003e\"hu\", :name=\u003e\"Hungarian\"}, {:nativeName=\u003e\"Українська\", :code=\u003e\"uk\", :name=\u003e\"Ukrainian\"}, {:nativeName=\u003e\"Bahasa Indonesia\", :code=\u003e\"id\", :name=\u003e\"Bahasa Indonesia\"}, {:nativeName=\u003e\"اردو\", :code=\u003e\"ur\", :name=\u003e\"Urdu\"}, ___...___]}\n```\n\nSee [https://developer.what3words.com/public-api/docs#available-languages](https://developer.what3words.com/public-api/docs#available-languages) for the original API call documentation.\n\n### RegEx functions\n\nThis section introduces RegEx functions that can assist with checking and finding possible what3words addresses in strings. The three main functions covered are:\n\n    `isPossible3wa` – Match what3words address format;\n    `findPossible3wa` – Find what3words address in Text;\n    `isValid3wa` – Verify a what3words address with the API;\n\n#### isPossible3wa\n\nOur API wrapper RegEx function `isPossible3wa` can be used used to detect if a text string (like `filled.count.soap`) in the format of a what3words address without having to ask the API. This functionality checks if a given string could be a what3words address. It returns true if it could be, otherwise false.\n\n**Note**: This function checks the text format but not the validity of a what3words address. Use `isValid3wa` to verify validity.\n\n```ruby\nrequire 'what3words'\n\ndef main\n  # Initialize the What3Words API with your API key\n  api_key = 'YOUR_API_KEY'\n  w3w = What3Words::API.new(:key =\u003e api_key)\n\n  # Example what3words addresses\n  addresses = [\"filled.count.soap\", \"not a 3wa\", \"not.3wa address\"]\n\n  # Check if the addresses are possible what3words addresses\n  addresses.each do |address|\n    is_possible = w3w.isPossible3wa(address)\n    puts \"Is '#{address}' a possible what3words address? #{is_possible}\"\n  end\nend\n\nif __FILE__ == $0\n  main\nend\n```\n\n**Expected Output**\n\n    isPossible3wa(“filled.count.soap”) returns true\n    isPossible3wa(“not a 3wa”) returns false\n    isPossible3wa(“not.3wa address”)returns false\n\n#### findPossible3wa\n\nOur API wrapper RegEx function `findPossible3wa` can be used to detect a what3words address within a block of text, useful for finding a what3words address in fields like Delivery Notes. For example, it can locate a what3words address in a note like “Leave at my front door ///filled.count.soap”. The function will match if there is a what3words address within the text. If no possible addresses are found, it returns an empty list.\n\n**Note**:\n\n- This function checks the text format but not the validity of a what3words address. Use `isValid3wa` to verify validity.\n- This function is designed to work across languages but do not work for `Vietnamese (VI)` due to spaces within words.\n\n```ruby\nrequire 'what3words'\n\ndef main\n  # Initialize the what3words API with your API key\n  api_key = 'YOUR_API_KEY'\n  w3w = What3Words::API.new(:key =\u003e api_key)\n\n  # Example texts\n  texts = [\n    \"Please leave by my porch at filled.count.soap\",\n    \"Please leave by my porch at filled.count.soap or deed.tulip.judge\",\n    \"Please leave by my porch at\"\n  ]\n\n  # Check if the texts contain possible what3words addresses\n  texts.each do |text|\n    possible_addresses = w3w.findPossible3wa(text)\n    puts \"Possible what3words addresses in '#{text}': #{possible_addresses}\"\n  end\nend\n\nif __FILE__ == $0\n  main\nend\n```\n\n**Expected Output**\n\n    findPossible3wa(“Please leave by my porch at filled.count.soap”) returns ['filled.count.soap']\n    findPossible3wa(“Please leave by my porch at filled.count.soap or deed.tulip.judge”) returns ['filled.count.soap', 'deed.tulip.judge']\n    findPossible3wa(“Please leave by my porch at”) returns []\n\n#### isValid3wa\n\nOur API wrapper RegEx function `isValid3wa` can be used to determine if a string is a valid what3words address by checking it against the what3words RegEx filter and verifying it with the what3words API.\n\n```ruby\nrequire 'what3words'\n\ndef main\n  # Initialize the what3words API with your API key\n  api_key = 'YOUR_API_KEY'\n  w3w = What3Words::API.new(:key =\u003e api_key)\n\n  # Example addresses\n  addresses = [\n    \"filled.count.soap\",\n    \"filled.count.\",\n    \"coding.is.cool\"\n  ]\n\n  # Check if the addresses are valid what3words addresses\n  addresses.each do |address|\n    is_valid = w3w.isValid3wa(address)\n    puts \"Is '#{address}' a valid what3words address? #{is_valid}\"\n  end\nend\n\nif __FILE__ == $0\n  main\nend\n```\n**Expected Outputs**\n\n    isValid3wa(“filled.count.soap”) returns True\n    isValid3wa(“filled.count.”) returns False\n    isValid3wa(“coding.is.cool”) returns False\n\nAlso make sure to replace `\u003cYOUR_API_KEY\u003e` with your actual API key. These functionalities provide different levels of validation for what3words addresses, from simply identifying potential addresses to verifying their existence on Earth.\n\n\nSee [https://developer.what3words.com/tutorial/ruby#regex-functions](https://developer.what3words.com/tutorial/ruby#regex-functions) for further documentation.\n\n\n## Testing\n\n* Prerequisite : we are using [bundler](https://rubygems.org/gems/bundler) `$ gem install bundler`\n\n* W3W-API-KEY: For safe storage of your API key on your computer, you can define that API key using your system’s environment variables.\n```bash\n$ export W3W_API_KEY=\u003cSecret API Key\u003e\n```\n\n* on your cloned folder\n1. `$ cd w3w-ruby-wrapper`\n1. `$ bundle update`\n1. `$ rake rubocop spec`\n\nTo run the tests, type on your terminal:\n```bash\n$ bundle exec rspec\n```\n\n## Issues\n\nFind a bug or want to request a new feature? Please let us know by submitting an issue.\n\n## Contributing\nAnyone and everyone is welcome to contribute.\n\n1. Fork it (http://github.com/what3words/w3w-ruby-wrapper and click \"Fork\")\n1. Create your feature branch (`git checkout -b my-new-feature`)\n1. Commit your changes (`git commit -am 'Add some feature'`)\n1. Don't forget to update README and bump [version](./lib/what3words/version.rb) using [semver](https://semver.org/)\n1. Push to the branch (`git push origin my-new-feature`)\n1. Create new Pull Request\n\n# Revision History\n\n* `v3.4.0`  15/01/25 - Update dependencies and upgrade ruby gemspec\n* `v3.3.0`  12/08/24 - Update error message to handle c2c calls and dependencies\n* `v3.2.0`  17/07/24 - Update regex patterns\n* `v3.1.0`  16/07/24 - Update tests and code to host the regex functions\n* `v3.0.0`  12/05/22 - Update endpoints and tests to API v3, added HTTP headers\n* `v2.2.0`  03/01/18 - Enforce Ruby 2.4 Support - Thanks to PR from Dimitrios Zorbas [@Zorbash](https://github.com/zorbash)\n* `v2.1.1`  22/05/17 - Update gemspec to use rubocop 0.48.1, and fixes spec accordingly\n* `v2.1.0`  28/03/17 - Added multilingual version of `autosuggest` and `standardblend`\n* `v2.0.4`  27/03/17 - Updated README with `languages` method result updated from live result\n* `v2.0.3`  24/10/16 - Fixed `display` in `assemble_common_request_params`\n* `v2.0.2`  10/06/16 - Added travis-ci builds\n* `v2.0.0`  10/06/16 - Updated wrapper to use what3words API v2\n\n## Licensing\n\nThe MIT License (MIT)\n\nA copy of the license is available in the repository's [license](LICENSE.txt) file.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhat3words%2Fw3w-ruby-wrapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwhat3words%2Fw3w-ruby-wrapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhat3words%2Fw3w-ruby-wrapper/lists"}