Class: Zemus::Kickstarter
- Inherits:
-
Object
- Object
- Zemus::Kickstarter
- Defined in:
- lib/zemus/kickstarter.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(url) ⇒ Kickstarter
constructor
A new instance of Kickstarter.
- #kickstarter_id ⇒ Object
- #to_embed ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(url) ⇒ Kickstarter
Returns a new instance of Kickstarter.
8 9 10 |
# File 'lib/zemus/kickstarter.rb', line 8 def initialize(url) @url = url end |
Class Method Details
.valid?(url) ⇒ Boolean
4 5 6 |
# File 'lib/zemus/kickstarter.rb', line 4 def self.valid?(url) url =~ /kickstarter.com\/projects\// end |
Instance Method Details
#kickstarter_id ⇒ Object
23 24 25 26 |
# File 'lib/zemus/kickstarter.rb', line 23 def kickstarter_id id = @url.split("kickstarter.com/projects/").last.split("?").first id.gsub("#", "") end |
#to_embed ⇒ Object
16 17 18 19 20 21 |
# File 'lib/zemus/kickstarter.rb', line 16 def = "<iframe width='100%' height='600px' scrolling='no' src='http://www.kickstarter.com/projects/#{kickstarter_id}/widget/video.html' frameborder='0'> </iframe>" += "<a href='#{url}' target='_blank' class='btn btn-default btn-xs'><i class='glyphicon glyphicon-heart'></i> Back this on Kickstarter!</a>" end |
#url ⇒ Object
12 13 14 |
# File 'lib/zemus/kickstarter.rb', line 12 def url "http://www.kickstarter.com/projects/#{kickstarter_id}" end |