{"id":21539836,"url":"https://github.com/richardvenneman/social-url","last_synced_at":"2025-10-27T10:13:02.109Z","repository":{"id":34869297,"uuid":"38873706","full_name":"richardvenneman/social-url","owner":"richardvenneman","description":":sparkles: A simple gem to generate social sharing links for your messages","archived":false,"fork":false,"pushed_at":"2021-04-28T21:40:44.000Z","size":58,"stargazers_count":6,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T04:43:38.942Z","etag":null,"topics":["facebook","google-plus","pinterest","social-buttons","social-media","social-network","social-share","social-url","twitter"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/richardvenneman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-10T09:55:06.000Z","updated_at":"2022-10-04T01:11:33.000Z","dependencies_parsed_at":"2022-08-29T01:10:20.228Z","dependency_job_id":null,"html_url":"https://github.com/richardvenneman/social-url","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/richardvenneman%2Fsocial-url","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/richardvenneman%2Fsocial-url/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/richardvenneman%2Fsocial-url/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/richardvenneman%2Fsocial-url/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/richardvenneman","download_url":"https://codeload.github.com/richardvenneman/social-url/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248150039,"owners_count":21055849,"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":["facebook","google-plus","pinterest","social-buttons","social-media","social-network","social-share","social-url","twitter"],"created_at":"2024-11-24T04:16:31.819Z","updated_at":"2025-10-27T10:13:01.976Z","avatar_url":"https://github.com/richardvenneman.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ✨ social-url\n\nA simple gem to generate social media sharing URLs.\n\n[![Build Status](https://travis-ci.org/richardvenneman/social-url.svg?branch=master)](https://travis-ci.org/richardvenneman/social-url)\n[![Gem Version](https://badge.fury.io/rb/social-url.svg)](https://badge.fury.io/rb/social-url)\n[![Maintainability](https://api.codeclimate.com/v1/badges/18b840bd059f4e83442c/maintainability)](https://codeclimate.com/github/richardvenneman/social-url/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/18b840bd059f4e83442c/test_coverage)](https://codeclimate.com/github/richardvenneman/social-url/test_coverage)\n\nSupported networks: Google+, Facebook, Pinterest, Twitter and `mailto:`.\n\n## Introduction\n\nThis gem was created to help you create social media sharing URLs. Create a message once and make it sharable on multiple networks with each their own specific parameters.\n\nUse this to create fast sharing links as opposed to performance-heavy third-party sharing widgets.\n\nRead more about [Responsible Social Share Links](https://jonsuh.com/blog/social-share-links) (by [@jonsuh](https://github.com/jonsuh)).\n\n## Usage\n\nSetup a new message to share on social networks using the `Message` class:\n\n```ruby\nmessage = SocialUrl::Message.new({\n  text: 'Hello World',\n  url: 'http://example.com',\n  hashtags: %w(nature sunset)\n})\n```\n\nUse the message's network methods to get the sharing URLs:\n\n- `facebook_url`\n- `google_url`\n- `mailto_url`\n- `pinterest_url`\n- `twitter_url`\n\n```ruby\nmessage.twitter_url #=\u003e 'https://twitter.com/intent/tweet/?text=Hello%20World\u0026url=http%3A%2F%2Fexample.com\u0026hashtags=nature,sunset'\nmessage.facebook_url #=\u003e 'https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fexample.com'\n...\n```\n\n### Parameters\n\nThis gem translates the options passed to the `SocialUrl::Message` into the correct parameters for each network. Supported options are:\n\n| Network       | Supported parameters |\n| ------------- | -------------------- |\n| Facebook      | `url` (String) |\n| Google        | `url` (String) |\n| mailto        | `url` (String)\u003cbr\u003e`text` (String) |\n| Pinterest     | `url` (String)\u003cbr\u003e`text` (String)\u003cbr\u003e`media` (String) |\n| Twitter        | `url` (String)\u003cbr\u003e`text` (String)\u003cbr\u003e`hashtags` (Array of Strings)\u003cbr\u003e`via` (String)\u003cbr\u003e`related` (Array of Strings) |\n\n### Utilities\n\nThe `SocialUrl` class provides normalization functionality for URL parameters and exposes the available networks:\n\n```ruby\nSocialUrl.networks #=\u003e [:facebook, :google, :twitter, ...]\n\nSocialUrl.normalize_string('Hello World') #=\u003e 'Hello%20World'\nSocialUrl.normalize_array(%w(nature sunset)) #=\u003e 'nature,sunset'\nSocialUrl.normalize_array(['twitter:Twitter News', 'twitterapi:Twitter API News']) #=\u003e 'twitter%3ATwitter%20News,twitterapi%3ATwitter%20API%20News'\n```\n\n## Installation\n\nThis library is test with the following Rubies: 2.3.8, 2.4.5, 2.5.3.\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'social-url'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install social-url\n\n## Contributing\n\nI'm happy to accept any pull requests for new networks. Adding a new network is relatively easy. Say you'd want to add `mynetwork` support:\n\n1. Create `lib/social_url/networks/mynetwork.rb` and `test/lib/social_url/networks/mynetwork_test.rb`\n2. Add tests and implementation (take a look at the current networks)\n\n## License\n\nThis library is released under the [MIT License](http://www.opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frichardvenneman%2Fsocial-url","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frichardvenneman%2Fsocial-url","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frichardvenneman%2Fsocial-url/lists"}