Sha256: 55f63a05f0617601f2eb25e4f067d739a43ed23db33b4f9277aef1fe7026a16b

Contents?: true

Size: 501 Bytes

Versions: 1

Compression:

Stored size: 501 Bytes

Contents

module Onebox
  module Engine
    class TwitterStatusOnebox
      include Engine
      include JSON

      matches_regexp Regexp.new("^http(?:s)?://(?:www\\.)?(?:(?:\\w)+\\.)?(twitter)\\.com(?:/)?(?:.)*/status(es)?/")

      def url
        "https://api.twitter.com/1/statuses/oembed.json?id=#{match[:id]}"
      end

      def to_html
        raw['html']
      end

      private

      def match
        @match ||= @url.match(%r{twitter\.com/.+?/status(es)?/(?<id>\d+)})
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
onebox-1.4.7 lib/onebox/engine/twitter_status_onebox.rb