Sha256: 032b8238016d4619ca1f6fb7dba610a02bc700c298611ee7675b06febffca44f

Contents?: true

Size: 856 Bytes

Versions: 4

Compression:

Stored size: 856 Bytes

Contents

require "film_snob/video_site"

class FilmSnob
  class Instagram < VideoSite
    def self.valid_url_patterns
      [
        %r{https?://(?:(?:www).)?instagram.com/p/(\w+)},
        %r{https?://(?:(?:www).)?instagr.am/p/(\w+)}
      ]
    end

    def self.oembed_endpoint
      'http://api.instagram.com/oembed'
    end

    def clean_url
      @clean_url ||= "http://instagram.com/p/#{id}"
    end

    def html
      # instagram's oembed response does not include html, so we need to construct it
      # but first we need to ensure that the response was good
      # which we do by checking for the presence of the title,
      # which will raise an exception if it's not present
      title && %{<iframe src="//instagram.com/p/#{id}/embed/" width="612" height="710" frameborder="0" scrolling="no" allowtransparency="true"></iframe>}
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
film_snob-0.3.13 lib/film_snob/instagram.rb
film_snob-0.3.12 lib/film_snob/instagram.rb
film_snob-0.3.11 lib/film_snob/instagram.rb
film_snob-0.3.10 lib/film_snob/instagram.rb