Skip to content

Commit

Permalink
Merge pull request #93 from papes1ns/add-matterport-provider
Browse files Browse the repository at this point in the history
Add Matterport provider
  • Loading branch information
metavida committed Feb 25, 2024
2 parents 899a902 + d131d7f commit 54a8497
Show file tree
Hide file tree
Showing 4 changed files with 155 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/oembed/providers/builtin_providers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
require 'oembed/providers/facebook_post'
require 'oembed/providers/facebook_video'
require 'oembed/providers/instagram'
require 'oembed/providers/matterport'
require 'oembed/providers/tiktok'

module OEmbed
Expand Down
12 changes: 12 additions & 0 deletions lib/oembed/providers/matterport.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module OEmbed
class Providers
# Provider for my.matterport.com
Matterport = OEmbed::Provider.new(
"https://my.matterport.com/api/v1/models/oembed/",
format: :json
)
Matterport << "https://*.matterport.com/show/*"

add_official_provider(Matterport)
end
end
119 changes: 119 additions & 0 deletions spec/cassettes/OEmbed_Providers_Matterport.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions spec/providers/matterport_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
require 'spec_helper'

describe 'OEmbed::Providers::Matterport' do
use_custom_vcr_casette('OEmbed_Providers_Matterport')
include OEmbedSpecHelper

let(:provider) { OEmbed::Providers::Matterport }

expected_valid_urls = %w(
https://my.matterport.com/show/?m=FmDYedjofjo
)
expected_invalid_urls = %w(
https://matterport.com/discover/space/7ffnfBNamei
)

describe 'behaving like an OEmbed::Provider instance' do
it_should_behave_like(
"an OEmbed::Providers instance",
expected_valid_urls,
expected_invalid_urls
)
end
end

0 comments on commit 54a8497

Please sign in to comment.