{"id":13879654,"url":"https://github.com/heroku/salesforce_id_formatter","last_synced_at":"2025-10-12T11:37:40.334Z","repository":{"id":33617301,"uuid":"37269531","full_name":"heroku/salesforce_id_formatter","owner":"heroku","description":"Convert 18-char Salesforce IDs to 15-char ones, and vice versa","archived":false,"fork":false,"pushed_at":"2021-10-12T14:25:21.000Z","size":10,"stargazers_count":6,"open_issues_count":3,"forks_count":4,"subscribers_count":97,"default_branch":"master","last_synced_at":"2025-10-03T04:15:36.104Z","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/heroku.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null}},"created_at":"2015-06-11T15:29:05.000Z","updated_at":"2023-05-30T15:05:56.000Z","dependencies_parsed_at":"2022-08-17T19:30:31.154Z","dependency_job_id":null,"html_url":"https://github.com/heroku/salesforce_id_formatter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/heroku/salesforce_id_formatter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heroku%2Fsalesforce_id_formatter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heroku%2Fsalesforce_id_formatter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heroku%2Fsalesforce_id_formatter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heroku%2Fsalesforce_id_formatter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/heroku","download_url":"https://codeload.github.com/heroku/salesforce_id_formatter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heroku%2Fsalesforce_id_formatter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278551509,"owners_count":26005389,"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-10-06T02:00:05.630Z","response_time":65,"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-08-06T08:02:27.869Z","updated_at":"2025-10-12T11:37:40.302Z","avatar_url":"https://github.com/heroku.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"Salesforce originally used case-sensitive 15-character alphanumeric IDs.\nLater on, added three error-correcting characters to make their 18-character ID.\n\n## Usage\n\n#### `SalesforceIdFormatter.to_18`\n\n- Converts a 15-char String to its equivalent 18-char ID as a String:\n  `SalesforceIdFormatter.to_18('70130000001tcyI')  # =\u003e  '70130000001tcyIAAQ'``\n- Leaves a 18-char String unaltered:\n  `SalesforceIdFormatter.to_18('70130000001tcyIAAQ') # =\u003e  '70130000001tcyIAAQ'`\n- Raises `SalesforceIdFormatter::InvalidId` if the given ID doesn't follow\n  Salesforce's conventions\nhttp://www.salesforce.com/us/developer/docs/api/Content/field_types.htm#i1435616\nTL;DR: 15 or 18 alphanumeric, case-sensitive chars\n\n#### `SalesforceIdFormatter.to_15`\n\n- Applies the same rules as `to_18`, returning 15-char IDs instead.\n\n#### `SalesforceIdFormatter.valid_id?`\n\n- Returns false if passed string is either not 15/18 characters or is not\n  alphanumeric.\n\n## Attribution\nCode is a modified version of https://gist.github.com/jbaylor-rpx/2691624\n(original doesn't seem to calculate control digits correctly)\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'salesforce_id_formatter'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install salesforce_id_formatter\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, 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 version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\n1. Fork it ( https://github.com/[my-github-username]/salesforce_id_formatter/fork )\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheroku%2Fsalesforce_id_formatter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fheroku%2Fsalesforce_id_formatter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheroku%2Fsalesforce_id_formatter/lists"}