flakey 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/flakey.gemspec +2 -0
- data/lib/flakey/twitter.rb +19 -4
- data/lib/flakey/version.rb +1 -1
- data/spec/flakey/twitter_spec.rb +3 -3
- metadata +19 -3
data/flakey.gemspec
CHANGED
data/lib/flakey/twitter.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'active_support/core_ext/hash/except'
|
1
2
|
# THis class is used to generate standard Twitter buttons as documented
|
2
3
|
# on the [Twitter developers site](https://twitter.com/about/resources/buttons).
|
3
4
|
|
@@ -40,8 +41,8 @@ module Flakey
|
|
40
41
|
BASE_URL + "/#{handle}"
|
41
42
|
end
|
42
43
|
|
43
|
-
# Generate a tweet button. This method needs the Twitter
|
44
|
-
# to be loaded on the page to work correctly.
|
44
|
+
# Generate a traditional tweet button. This method needs the Twitter
|
45
|
+
# JavaScript to be loaded on the page to work correctly.
|
45
46
|
#
|
46
47
|
# Takes a hash of options to use when generating the button.
|
47
48
|
#
|
@@ -77,8 +78,8 @@ module Flakey
|
|
77
78
|
link_to label, SHARE_URL, :class => class_list, :data => data_attr
|
78
79
|
end
|
79
80
|
|
80
|
-
# Generate a follow button. This method needs the Twitter
|
81
|
-
# to be loaded on the page in order to work correctly.
|
81
|
+
# Generate a traditional follow button. This method needs the Twitter
|
82
|
+
# JavaScript to be loaded on the page in order to work correctly.
|
82
83
|
#
|
83
84
|
# Takes a hash of options to use when generating the button.
|
84
85
|
#
|
@@ -104,5 +105,19 @@ module Flakey
|
|
104
105
|
link_to label, twitter_profile_url(handle),
|
105
106
|
class: class_list, data: { :"show-count" => show_count, size: size }
|
106
107
|
end
|
108
|
+
|
109
|
+
# Generate a link which will open a dialog for following the user with
|
110
|
+
# whe specified user_id or screen_name.
|
111
|
+
def follow_intent_link(options = {})
|
112
|
+
text = options[:text] || ''
|
113
|
+
user_id_to_follow = options[:user_id] || ''
|
114
|
+
screen_name_to_follow = options[:screen_name] || ''
|
115
|
+
|
116
|
+
intent_url = 'https://twitter.com/intent/user?'
|
117
|
+
intent_url += user_id_to_follow.to_s unless user_id_to_follow == ''
|
118
|
+
intent_url += screen_name_to_follow.to_s unless screen_name_to_follow == ''
|
119
|
+
|
120
|
+
link_to text, intent_url, options.except(:text, :user_id, :screen_name)
|
121
|
+
end
|
107
122
|
end
|
108
123
|
end
|
data/lib/flakey/version.rb
CHANGED
data/spec/flakey/twitter_spec.rb
CHANGED
@@ -7,7 +7,7 @@ end
|
|
7
7
|
describe Flakey::Twitter do
|
8
8
|
subject { DummyHelper.new }
|
9
9
|
|
10
|
-
describe "twitter_handle" do
|
10
|
+
describe "#twitter_handle" do
|
11
11
|
it "should output the twitter handle" do
|
12
12
|
subject.twitter_handle.should == 'grinnick'
|
13
13
|
end
|
@@ -17,7 +17,7 @@ describe Flakey::Twitter do
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
describe "tweet_button" do
|
20
|
+
describe "#tweet_button" do
|
21
21
|
before { subject.stub_chain('request.url') { '' } }
|
22
22
|
|
23
23
|
it "should append to the class list" do
|
@@ -35,7 +35,7 @@ describe Flakey::Twitter do
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
-
describe "follow_button" do
|
38
|
+
describe "#follow_button" do
|
39
39
|
before { subject.stub_chain('request.url') { '' } }
|
40
40
|
|
41
41
|
it "should append to the class list" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flakey
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,6 +11,22 @@ bindir: bin
|
|
11
11
|
cert_chain: []
|
12
12
|
date: 2013-07-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: active_support
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
14
30
|
- !ruby/object:Gem::Dependency
|
15
31
|
name: rspec
|
16
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -85,7 +101,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
85
101
|
version: '0'
|
86
102
|
segments:
|
87
103
|
- 0
|
88
|
-
hash: -
|
104
|
+
hash: -2829677380088096704
|
89
105
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
106
|
none: false
|
91
107
|
requirements:
|
@@ -94,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
110
|
version: '0'
|
95
111
|
segments:
|
96
112
|
- 0
|
97
|
-
hash: -
|
113
|
+
hash: -2829677380088096704
|
98
114
|
requirements: []
|
99
115
|
rubyforge_project:
|
100
116
|
rubygems_version: 1.8.25
|