zemus 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/zemus/kickstarter.rb +7 -2
- data/lib/zemus/version.rb +1 -1
- data/spec/zemus/kickstarter_spec.rb +4 -0
- metadata +2 -2
data/lib/zemus/kickstarter.rb
CHANGED
@@ -9,15 +9,20 @@ module Zemus
|
|
9
9
|
@url = url
|
10
10
|
end
|
11
11
|
|
12
|
+
def url
|
13
|
+
"http://www.kickstarter.com/projects/#{kickstarter_id}"
|
14
|
+
end
|
15
|
+
|
12
16
|
def to_embed
|
13
17
|
embed = "<iframe width='100%' height='600' scrolling='no' src='http://www.kickstarter.com/projects/#{kickstarter_id}/widget/video.html' frameborder='0'> </iframe>"
|
14
|
-
embed += "<a href='#{
|
18
|
+
embed += "<a href='#{url}' target='_blank' class='btn btn-default btn-xs'><i class='glyphicon glyphicon-heart'></i> Back this on Kickstarter!</a>"
|
15
19
|
|
16
20
|
embed
|
17
21
|
end
|
18
22
|
|
19
23
|
def kickstarter_id
|
20
|
-
@url.split("kickstarter.com/projects/").last.split("?").first
|
24
|
+
id = @url.split("kickstarter.com/projects/").last.split("?").first
|
25
|
+
id.gsub("#", "")
|
21
26
|
end
|
22
27
|
end
|
23
28
|
end
|
data/lib/zemus/version.rb
CHANGED
@@ -4,5 +4,9 @@ describe Zemus::Kickstarter do
|
|
4
4
|
it "embeds kickstarter" do
|
5
5
|
Zemus::Kickstarter.new("http://www.kickstarter.com/projects/sleepninja/monsters-ate-my-birthday-cake").to_embed.
|
6
6
|
should eq("<iframe width='100%' height='600' scrolling='no' src='http://www.kickstarter.com/projects/sleepninja/monsters-ate-my-birthday-cake/widget/video.html' frameborder='0'> </iframe><a href='http://www.kickstarter.com/projects/sleepninja/monsters-ate-my-birthday-cake' target='_blank' class='btn btn-default btn-xs'><i class='glyphicon glyphicon-heart'></i> Back this on Kickstarter!</a>")
|
7
|
+
|
8
|
+
# fix for a bug where a kickstarter URL had a # sign at the end
|
9
|
+
Zemus::Kickstarter.new("http://www.kickstarter.com/projects/sleepninja/monsters-ate-my-birthday-cake#").to_embed.
|
10
|
+
should eq("<iframe width='100%' height='600' scrolling='no' src='http://www.kickstarter.com/projects/sleepninja/monsters-ate-my-birthday-cake/widget/video.html' frameborder='0'> </iframe><a href='http://www.kickstarter.com/projects/sleepninja/monsters-ate-my-birthday-cake' target='_blank' class='btn btn-default btn-xs'><i class='glyphicon glyphicon-heart'></i> Back this on Kickstarter!</a>")
|
7
11
|
end
|
8
12
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zemus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-10-
|
13
|
+
date: 2013-10-30 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|