{"id":15562119,"url":"https://github.com/mrkamel/uri_for","last_synced_at":"2026-06-29T04:31:27.412Z","repository":{"id":4954261,"uuid":"6111646","full_name":"mrkamel/uri_for","owner":"mrkamel","description":"Build smart URIs from hashes in your rails code","archived":false,"fork":false,"pushed_at":"2013-02-27T18:07:59.000Z","size":128,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T04:43:58.571Z","etag":null,"topics":[],"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/mrkamel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-10-07T11:24:26.000Z","updated_at":"2014-01-18T02:35:43.000Z","dependencies_parsed_at":"2022-09-13T19:14:23.719Z","dependency_job_id":null,"html_url":"https://github.com/mrkamel/uri_for","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mrkamel/uri_for","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrkamel%2Furi_for","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrkamel%2Furi_for/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrkamel%2Furi_for/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrkamel%2Furi_for/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrkamel","download_url":"https://codeload.github.com/mrkamel/uri_for/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrkamel%2Furi_for/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34913586,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-29T02:00:05.398Z","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":[],"created_at":"2024-10-02T16:11:50.858Z","updated_at":"2026-06-29T04:31:27.391Z","avatar_url":"https://github.com/mrkamel.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# UriFor\n\nUriFor helps to generate http and https URIs from simple hashes using ruby stdlib's URI module.\nIf you don't provide e.g., the host, port, etc. UriFor tries to use the values from your controller, if possible.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n    gem \"uri_for\", :git =\u003e \"git://github.com/mrkamel/uri_for.git\"\n\nAnd then execute:\n\n    $ bundle\n\n## Usage\n\nIn your standard or mailer views, controllers and models, simply use:\n\n\u003cpre\u003e\nuri_for :host =\u003e \"example.org\", :path =\u003e \"/path/to/file\" # =\u003e \"http://example.org/path/to/file\n\u003c/pre\u003e\n\nOr the short way:\n\n\u003cpre\u003e\nirb\u003e uri_for :path =\u003e \"/path/to/file\n=\u003e \"http://example.org/path/to/file\" # example.org is taken from the current request\n\u003c/pre\u003e\n\nHowever, usually, you want to provide the uri via your models:\n\n\u003cpre\u003e\nclass SomeModel \u0026lt; ActiveRecord::Base\n  def image_uri\n    { :host =\u003e APP_CONFIG[\"image_host\"], :path =\u003e \"/path/to/file\" }\n  end\nend\n\n# In your views:\n\nuri_for SomeModel.first.image_uri # =\u003e \"http://example.org/path/to/file\"\n\u003c/pre\u003e\n\nUriFor even takes control of whether to use http or https:\n\n\u003cpre\u003e\nuri_for :port =\u003e 443, :path =\u003e \"/path/to/file\" # =\u003e \"https://example.org/path/to/file\"\n\u003c/pre\u003e\n\nAgain, if you don't provide the port with the hash, UriFor will try to use it from\nthe current request, if accessible.\n\nWithin mailer views and models UriFor of course can't use the current\nrequest to set these smart defaults. Smart defaults are only available within\nyour controllers and standard views. However, you can always provide the\nport and host manually.\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am \"Added some feature\"`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrkamel%2Furi_for","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrkamel%2Furi_for","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrkamel%2Furi_for/lists"}