Class: EmbeddedURL::SlideShare

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/embedded_url/slideshare.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ SlideShare

Returns a new instance of SlideShare.



22
23
24
# File 'lib/embedded_url/slideshare.rb', line 22

def initialize(url)
  @url = url
end

Class Method Details

.api_key=(key) ⇒ Object



14
15
16
# File 'lib/embedded_url/slideshare.rb', line 14

def self.api_key=(key)
  default_params :api_key => key
end

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



10
11
12
# File 'lib/embedded_url/slideshare.rb', line 10

def self.configure
  yield self
end

.shared_secret=(secret) ⇒ Object



18
19
20
# File 'lib/embedded_url/slideshare.rb', line 18

def self.shared_secret=(secret)
  @@shared_secret = secret
end

Instance Method Details

#to_embeddedObject



26
27
28
29
30
31
32
33
# File 'lib/embedded_url/slideshare.rb', line 26

def to_embedded
  if @url =~ /slideshare\.net/
    now = Time.now.to_i.to_s
    hashed = Digest::SHA1.hexdigest("#{@@shared_secret}#{now}")
    result = SlideShare.get('/get_slideshow', :query => {:ts => now, :hash => hashed, :slideshow_url => @url})
    result['Slideshow']['Embed']
  end
end