Sha256: 9925d4dad99fe49dcb2ea64f9c4d6e2bdc13b306041cf429b579a35cf03d9aa9

Contents?: true

Size: 1.84 KB

Versions: 7

Compression:

Stored size: 1.84 KB

Contents

module OEmbed
  class Providers
    # Provider for instagram.com
    # See https://developers.facebook.com/docs/instagram/oembed/
    Instagram = OEmbed::Provider.new(
      "https://graph.facebook.com/v8.0/instagram_oembed",
      required_query_params: { access_token: 'OEMBED_FACEBOOK_TOKEN' },
      format: :json
    )
    Instagram << "http://instagr.am/p/*"
    Instagram << "http://instagram.com/p/*"
    Instagram << "http://www.instagram.com/p/*"
    Instagram << "https://instagr.am/p/*"
    Instagram << "https://instagram.com/p/*"
    Instagram << "https://www.instagram.com/p/*"

    Instagram << "http://instagr.am/tv/*"
    Instagram << "http://instagram.com/tv/*"
    Instagram << "http://www.instagram.com/tv/*"
    Instagram << "https://instagr.am/tv/*"
    Instagram << "https://instagram.com/tv/*"
    Instagram << "https://www.instagram.com/tv/*"

    Instagram << "http://instagram.com/reel/*"
    Instagram << "http://www.instagram.com/reel/*"
    Instagram << "https://instagram.com/reel/*"
    Instagram << "https://www.instagram.com/reel/*"

    # Note: even though Instagram is automatically registered as an official provider
    # it will NOT resolve any URLs unless its access_token is set
    # either via the OEMBED_FACEBOOK_TOKEN environment variable
    # or by calling `OEmbed::Providers::Instagram.access_token = @your_token`
    add_official_provider(Instagram, nil, access_token: {name: :facebook, method: :access_token})

    # Respond to the `new` method to maintain backwards compatibility with v0.14.0
    # See also:
    # * https://github.com/ruby-oembed/ruby-oembed/pull/75
    # * https://github.com/ruby-oembed/ruby-oembed/issues/77#issuecomment-727024682
    # @deprecated *Note*: This method will be be removed in the future.
    def Instagram.new(access_token:)
      self.access_token = access_token
      self
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
ruby-oembed-0.18.1 lib/oembed/providers/instagram.rb
ruby-oembed-0.18.0 lib/oembed/providers/instagram.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/ruby-oembed-0.17.0/lib/oembed/providers/instagram.rb
ruby-oembed-0.17.0 lib/oembed/providers/instagram.rb
ruby-oembed-0.16.1 lib/oembed/providers/instagram.rb
ruby-oembed-0.16.0 lib/oembed/providers/instagram.rb
ruby-oembed-0.15.0 lib/oembed/providers/instagram.rb