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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1d01b5270b58b9764104d86befbc364c0e54004d
4
- data.tar.gz: 5125800db737d0cc20621730b854b8f49a8257bd
3
+ metadata.gz: 7caf9345cb6f7c4e7c5e03ac4510157df95c56eb
4
+ data.tar.gz: e1d1fb3378530a071cb296347626eeec55d793f8
5
5
  SHA512:
6
- metadata.gz: a52bfabb0050d6aa28bf1ba9e6737338bb1c66f0ebdc65a7b2acb1aeda2bc805cb99d70b5da25025ffe4d0efe7d8c97036cac5c2dd1ff6e195947596b83b063d
7
- data.tar.gz: 3034c2fb435822f2d8f8263270f433af7a6cc58f83a6a67cc8e10bd7f4089f07c84f40db510b79fe91aee700b151cbdd583e004e4796067ed260b9b0c21570f8
6
+ metadata.gz: eb67fc68f2540e27bbbe47f8f4fd597dbe3b6be8042292f92631f7a91143961a940e52a08a9f27c6cbb3d983defbc4dab478d31a9b408d535e3f3019835cba9a
7
+ data.tar.gz: 07ea89400c7534054dd34f68387b1812a6efe3288a74513c8fbb3e5ea132886529205c3b17fbcdc130dfe477d8edb8cb3d33f2b70c3c5d08283f0b0026354530
data/.travis.yml ADDED
@@ -0,0 +1,11 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - 1.9.3
5
+ - 2.0
6
+ - 2.1
7
+ - 2.2.1
8
+
9
+ addons:
10
+ code_climate:
11
+ repo_token: e45cb4cbea2601c1f2c94402aac0be86b2a79b993fe669c06f53dd0069f23cfd
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- social-url (0.0.1)
4
+ social-url (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,13 +1,15 @@
1
- # social_url
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/)[Responsible 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
@@ -2,6 +2,7 @@ require 'erb'
2
2
  require 'social_url/version'
3
3
  require 'social_url/message'
4
4
  require 'social_url/facebook'
5
+ require 'social_url/google'
5
6
  require 'social_url/twitter'
6
7
 
7
8
  module SocialUrl
@@ -0,0 +1,13 @@
1
+ module SocialUrl
2
+ class Google
3
+ def initialize(options)
4
+ @options = options
5
+ end
6
+
7
+ def url
8
+ params = "url=#{@options[:url]}"
9
+
10
+ "https://plus.google.com/share?#{params}"
11
+ end
12
+ end
13
+ end
@@ -1,3 +1,3 @@
1
1
  module SocialUrl
2
- VERSION = '0.1.1'
2
+ VERSION = '0.2.0'
3
3
  end
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 from your
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.1.1
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 from your
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