social-url 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +11 -0
- data/Gemfile.lock +1 -1
- data/README.md +7 -2
- data/lib/social_url.rb +1 -0
- data/lib/social_url/google.rb +13 -0
- data/lib/social_url/version.rb +1 -1
- data/social-url.gemspec +1 -1
- data/test/lib/social_url/facebook_test.rb +1 -1
- data/test/lib/social_url/google_test.rb +19 -0
- data/test/lib/social_url/twitter_test.rb +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7caf9345cb6f7c4e7c5e03ac4510157df95c56eb
|
4
|
+
data.tar.gz: e1d1fb3378530a071cb296347626eeec55d793f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb67fc68f2540e27bbbe47f8f4fd597dbe3b6be8042292f92631f7a91143961a940e52a08a9f27c6cbb3d983defbc4dab478d31a9b408d535e3f3019835cba9a
|
7
|
+
data.tar.gz: 07ea89400c7534054dd34f68387b1812a6efe3288a74513c8fbb3e5ea132886529205c3b17fbcdc130dfe477d8edb8cb3d33f2b70c3c5d08283f0b0026354530
|
data/.travis.yml
ADDED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,13 +1,15 @@
|
|
1
|
-
#
|
1
|
+
# social-url
|
2
2
|
|
3
3
|
A simple gem to generate social media sharing links.
|
4
4
|
Supports multiple platforms with a plugin architecture.
|
5
5
|
|
6
|
+
[![Gem Version](https://badge.fury.io/rb/social-url.svg)](http://badge.fury.io/rb/social-url) [![Code Climate](https://codeclimate.com/github/richardvenneman/social-url/badges/gpa.svg)](https://codeclimate.com/github/richardvenneman/social-url) [![Dependency Status](https://gemnasium.com/richardvenneman/social-url.svg)](https://gemnasium.com/richardvenneman/social-url) [![Test Coverage](https://codeclimate.com/github/richardvenneman/social-url/badges/coverage.svg)](https://codeclimate.com/github/richardvenneman/social-url/coverage) [![Build Status](http://img.shields.io/travis/richardvenneman/social-url.svg)](https://travis-ci.org/richardvenneman/social-url)
|
7
|
+
|
6
8
|
## Introduction
|
7
9
|
|
8
10
|
This gem was created to help quickly set up sharing links for web pages. This should help you create simple and fast sharing links to social media networks as opposed to performance-heavy third-party sharing widgets.
|
9
11
|
|
10
|
-
Read more about (https://jonsuh.com/blog/social-share-links
|
12
|
+
Read more about [Responsible Social Share Links](https://jonsuh.com/blog/social-share-links) (by [@jonsuh](https://github.com/jonsuh)).
|
11
13
|
|
12
14
|
## Installation
|
13
15
|
|
@@ -40,7 +42,10 @@ message = SocialUrl::Message.new({
|
|
40
42
|
hashtags: %w(nature sunset)
|
41
43
|
})
|
42
44
|
|
45
|
+
# Use the network methods to easily get sharing URLs
|
46
|
+
|
43
47
|
message.twitter_url #=> 'https://twitter.com/intent/tweet/?text=Hello%20World&url=http%3A%2F%2Fexample.com&hashtags=nature,sunset'
|
48
|
+
message.facebook_url #=> 'https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fexample.com'
|
44
49
|
```
|
45
50
|
|
46
51
|
### Available networks
|
data/lib/social_url.rb
CHANGED
data/lib/social_url/version.rb
CHANGED
data/social-url.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
|
|
7
7
|
s.email = 'richardvenneman@me.com'
|
8
8
|
s.homepage = 'https://github.com/richardvenneman/social-url'
|
9
9
|
s.summary = 'Generates social media sharing links'
|
10
|
-
s.description = 'A simple gem to generate social sharing links
|
10
|
+
s.description = 'A simple gem to generate social sharing links for your
|
11
11
|
messages. Supports multiple social platforms trough a plugin
|
12
12
|
architecture.'
|
13
13
|
|
@@ -7,9 +7,9 @@ module SocialUrl
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def test_url
|
10
|
+
opts = SocialUrl.normalize(@options)
|
10
11
|
url = 'https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fexample.com'
|
11
12
|
|
12
|
-
opts = SocialUrl.normalize(@options)
|
13
13
|
assert_equal url, Facebook.new(opts).url
|
14
14
|
end
|
15
15
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module SocialUrl
|
4
|
+
class GoogleTest < Minitest::Test
|
5
|
+
def setup
|
6
|
+
@options = {
|
7
|
+
text: 'Hello World',
|
8
|
+
url: 'http://example.com'
|
9
|
+
}
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_url
|
13
|
+
opts = SocialUrl.normalize(@options)
|
14
|
+
url = 'https://plus.google.com/share?url=http%3A%2F%2Fexample.com'
|
15
|
+
|
16
|
+
assert_equal url, Google.new(opts).url
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -13,13 +13,13 @@ module SocialUrl
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def test_url
|
16
|
+
opts = SocialUrl.normalize(@options)
|
16
17
|
url = ['https://twitter.com/intent/tweet/?text=Hello%20World',
|
17
18
|
'&url=http%3A%2F%2Fexample.com',
|
18
19
|
'&hashtags=nature,sunset',
|
19
20
|
'&via=twitterdev',
|
20
21
|
'&related=twitter%3ATwitter%20News,twitterapi%3ATwitter%20API%20News'].join
|
21
22
|
|
22
|
-
opts = SocialUrl.normalize(@options)
|
23
23
|
assert_equal url, Twitter.new(opts).url
|
24
24
|
end
|
25
25
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: social-url
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Venneman
|
@@ -81,7 +81,7 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0.4'
|
83
83
|
description: |-
|
84
|
-
A simple gem to generate social sharing links
|
84
|
+
A simple gem to generate social sharing links for your
|
85
85
|
messages. Supports multiple social platforms trough a plugin
|
86
86
|
architecture.
|
87
87
|
email: richardvenneman@me.com
|
@@ -90,6 +90,7 @@ extensions: []
|
|
90
90
|
extra_rdoc_files: []
|
91
91
|
files:
|
92
92
|
- ".gitignore"
|
93
|
+
- ".travis.yml"
|
93
94
|
- Gemfile
|
94
95
|
- Gemfile.lock
|
95
96
|
- Guardfile
|
@@ -97,11 +98,13 @@ files:
|
|
97
98
|
- Rakefile
|
98
99
|
- lib/social_url.rb
|
99
100
|
- lib/social_url/facebook.rb
|
101
|
+
- lib/social_url/google.rb
|
100
102
|
- lib/social_url/message.rb
|
101
103
|
- lib/social_url/twitter.rb
|
102
104
|
- lib/social_url/version.rb
|
103
105
|
- social-url.gemspec
|
104
106
|
- test/lib/social_url/facebook_test.rb
|
107
|
+
- test/lib/social_url/google_test.rb
|
105
108
|
- test/lib/social_url/message_test.rb
|
106
109
|
- test/lib/social_url/twitter_test.rb
|
107
110
|
- test/lib/social_url_test.rb
|
@@ -132,6 +135,7 @@ specification_version: 4
|
|
132
135
|
summary: Generates social media sharing links
|
133
136
|
test_files:
|
134
137
|
- test/lib/social_url/facebook_test.rb
|
138
|
+
- test/lib/social_url/google_test.rb
|
135
139
|
- test/lib/social_url/message_test.rb
|
136
140
|
- test/lib/social_url/twitter_test.rb
|
137
141
|
- test/lib/social_url_test.rb
|