flakey 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/flakey.rb +2 -0
- data/lib/flakey/base.rb +9 -0
- data/lib/flakey/buffer.rb +32 -0
- data/lib/flakey/facebook.rb +4 -2
- data/lib/flakey/twitter.rb +4 -5
- data/lib/flakey/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d187c4c3ce3d93de1645f91188907f18e16dc02
|
4
|
+
data.tar.gz: 650a378fb981aaad343ffaecf3f9d9f6f857424d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0191415d53b96b87038fca53fa7ee125db6c44f4fad61f459e81075ae91d79e805dd6bb5578b04e9e39d0bb3a94f59dc4fae41558efa7fa634d4255538a85abf
|
7
|
+
data.tar.gz: b5e89cf998a0abbb42c8fa194e1e5fbb4b2830bcf39d73a5319b71140fd3178c48d47cd7e6015f9703f8af5dbecb8aa1d3c77e49e396bebcc92cfa1a17bdeb27
|
data/lib/flakey.rb
CHANGED
data/lib/flakey/base.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
module Flakey
|
2
|
+
module Buffer
|
3
|
+
include Base
|
4
|
+
|
5
|
+
SHARE_URL = "https://bufferapp.com/add"
|
6
|
+
|
7
|
+
def buffer_button(options = {})
|
8
|
+
defaults = {
|
9
|
+
url: default_url,
|
10
|
+
label: "Buffer",
|
11
|
+
target: '_blank',
|
12
|
+
class: 'buffer-add-button'
|
13
|
+
}
|
14
|
+
settings = defaults.merge(options)
|
15
|
+
|
16
|
+
url = "#{SHARE_URL}?url=#{CGI.escape(settings[:url])}"
|
17
|
+
|
18
|
+
if settings.has_key?(:text) && settings[:text] != ''
|
19
|
+
url += "&text=#{CGI.escape(settings[:text])}"
|
20
|
+
end
|
21
|
+
|
22
|
+
# Delete these so we can pass the settings directly into link_to
|
23
|
+
%w[url text].each { |url_key| settings.delete(url_key.to_sym) }
|
24
|
+
|
25
|
+
if block_given?
|
26
|
+
link_to(url, settings, &block)
|
27
|
+
else
|
28
|
+
link_to settings.delete(:label), url, settings
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/flakey/facebook.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
module Flakey
|
2
2
|
module Facebook
|
3
|
+
include Base
|
4
|
+
|
3
5
|
SHARE_URL = 'https://www.facebook.com/sharer/sharer.php'
|
4
6
|
#
|
5
7
|
# Needed to be able to pass a block down into link_to.
|
@@ -32,7 +34,7 @@ module Flakey
|
|
32
34
|
#
|
33
35
|
# Returns a HTML string.
|
34
36
|
def like_button(options = {})
|
35
|
-
url = options[:url] ||
|
37
|
+
url = options[:url] || default_url
|
36
38
|
layout = options[:layout] || 'button_count'
|
37
39
|
width = options[:width] || 250
|
38
40
|
send = options[:send] || false
|
@@ -52,7 +54,7 @@ module Flakey
|
|
52
54
|
# Returns a HTML string.
|
53
55
|
def share_button(options = {}, &block)
|
54
56
|
defaults = {
|
55
|
-
url:
|
57
|
+
url: default_url,
|
56
58
|
label: 'Share',
|
57
59
|
target: '_blank',
|
58
60
|
class: 'facebook-share-button'
|
data/lib/flakey/twitter.rb
CHANGED
@@ -5,6 +5,7 @@ require 'active_support/core_ext/hash/except'
|
|
5
5
|
|
6
6
|
module Flakey
|
7
7
|
module Twitter
|
8
|
+
include Base
|
8
9
|
|
9
10
|
BASE_URL = "https://twitter.com"
|
10
11
|
SHARE_URL = BASE_URL + "/share"
|
@@ -64,7 +65,7 @@ module Flakey
|
|
64
65
|
#
|
65
66
|
# Returns a HTML string.
|
66
67
|
def tweet_button(options = {})
|
67
|
-
url = options[:url] ||
|
68
|
+
url = options[:url] || default_url
|
68
69
|
text = options[:text] || ''
|
69
70
|
hashtags = options[:hashtags] || Flakey.configuration.tweet_hashtags
|
70
71
|
via = options[:via] || Flakey.configuration.tweet_via
|
@@ -138,7 +139,7 @@ module Flakey
|
|
138
139
|
|
139
140
|
def tweet_url(options = {})
|
140
141
|
defaults = {
|
141
|
-
url:
|
142
|
+
url: default_url,
|
142
143
|
related: Flakey.configuration.tweet_related,
|
143
144
|
hashtags: Flakey.configuration.tweet_hashtags,
|
144
145
|
via: Flakey.configuration.tweet_via
|
@@ -166,8 +167,6 @@ module Flakey
|
|
166
167
|
}
|
167
168
|
settings = defaults.merge(options)
|
168
169
|
|
169
|
-
label = settings.delete(:label)
|
170
|
-
|
171
170
|
# Delete these so we can pass the settings directly into link_to
|
172
171
|
%w[url text hashtags related via].each do |url_key|
|
173
172
|
settings.delete(url_key.to_sym)
|
@@ -176,7 +175,7 @@ module Flakey
|
|
176
175
|
if block_given?
|
177
176
|
link_to(url, settings, &block)
|
178
177
|
else
|
179
|
-
link_to label, url, settings
|
178
|
+
link_to settings.delete(:label), url, settings
|
180
179
|
end
|
181
180
|
end
|
182
181
|
end
|
data/lib/flakey/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flakey
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Tuite
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -81,6 +81,8 @@ files:
|
|
81
81
|
- Rakefile
|
82
82
|
- flakey.gemspec
|
83
83
|
- lib/flakey.rb
|
84
|
+
- lib/flakey/base.rb
|
85
|
+
- lib/flakey/buffer.rb
|
84
86
|
- lib/flakey/configuration.rb
|
85
87
|
- lib/flakey/engine.rb
|
86
88
|
- lib/flakey/facebook.rb
|
@@ -115,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
117
|
version: '0'
|
116
118
|
requirements: []
|
117
119
|
rubyforge_project:
|
118
|
-
rubygems_version: 2.
|
120
|
+
rubygems_version: 2.1.11
|
119
121
|
signing_key:
|
120
122
|
specification_version: 4
|
121
123
|
summary: Makes a bunch of helper methods available for including in your Rails views.
|