-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restore backwards compatibility with 0.13.0 Facebook/Instagram providers #78
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a2f9adf
to
616ae32
Compare
Also switch to use a subject rather than `let(:provider_class)`
...because it kept adding duplicate requests & I couldn't figure out why
...which is the specific bit of backwards compatibility that broke in 0.14.0
...with forged "200 OK" responses in the VCR cassette, so that the test pass despite the legacy Instagram oEmbed endpoint having been deprecated on October 23rd.
# Conflicts: # lib/oembed/providers.rb
...where, if there exists an OEMBED_FACEBOOK_TOKEN env var, the Instagram class responds to enough of the instance methods to work on a basic level.
...which is a fine balance. I want to make it possible to capture real-world Instagram & Facebook API responses into a VCR cassette. Also I want to make it fairly difficult for developers to accidentally record their secrets into a VCR cassette.
...in preparation for adding a new initialize option
...which makes way for an upcoming "required_query_params" argument
...by using the OEmbed::Provider#includes? method, which always returns false if there are missing required_query_params. Also lots more test coverage for OEmbed::Providers.find
...with a class-like `Instagram.new` method to avoid breaking things for folks who added v0.14.0 work-arounds
...since it explains the additional env var for CI testing.
…-backwards-compatibility # Conflicts: # CHANGELOG.rdoc # spec/provider_spec.rb # spec/support/shared_examples_for_providers.rb
...to prevent developers' local OEMBED_FACEBOOK_TOKEN env var from leaking into the cassettes, while still allowing "200 OK" responses to be recorded!
...and ensure the "behaves like a custom OEmbed::Provider class" tests don't leak scope, since the "new" method modiefies the instance now.
...with a class-like `FacebookPost.new` method to avoid breaking things for folks who added v0.14.0 work-arounds
...with a class-like `FacebookVideo.new` method to avoid breaking things for folks who added v0.14.0 work-arounds
Also test a different photo URL pattern.
Instead add support for calling `add_official_provider` with `:access_token` options. Also move all built-in providers into a separate ruby file.
9c611a8
to
81219e3
Compare
8a2ebb2
to
fc757e7
Compare
@elektronaut In order to fix Issue #77 I built on top of your PR to add the concept of |
Required *quite* a bit of re-refactoring, but I think we got there! # Conflicts: # CHANGELOG.rdoc # lib/oembed/providers.rb # spec/cassettes/OEmbed_Providers_Youtube.yml # spec/providers/youtube_spec.rb
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR resolves Issue #77 by converting the built-in Facebook & Instagram providers back into
OEmbed::Provider
instances, therefore restoring backwards compatibility with version< 0.14.0
using this syntax:Don't want to use an environment variable? You can use this syntax instead:
It also temporarily implements a class-like
#new
method on the built-inFacebookPost
,FacebookVideo
&Instagram
providers, to maintain compatibility with version~> 0.14.0
for folks who many have been using this syntax (my suggested short-term fix for Issue #77):More broadly, this PR also adds the generic concept
required_query_params
forOEmbed::Provider
instances! In the short term this let me DRI up the implementation for the 3 built-in Facebook providers. In the long term I can improve the built-in Embedly provider to use this pattern and we'll be ready for any future providers that require custom query params (either for access tokens, or for any other reason)