mirror of
https://github.com/discourse/discourse.git
synced 2024-12-25 07:23:52 +08:00
b2a5f5802a
We have a custom implementation of #symbolize_keys in our Onebox helpers. This is likely a legacy from when Onebox was a standalone gem. This change replaces all usages with either #deep_symbolize_keys from ActiveSupport, or appropriate option to the JSON parser gem used.
17 lines
373 B
Ruby
17 lines
373 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Onebox
|
|
class Oembed < OpenGraph
|
|
def initialize(response)
|
|
@data = ::MultiJson.load(response, symbolize_keys: true)
|
|
|
|
# never use oembed from WordPress 4.4 (it's broken)
|
|
@data.delete(:html) if @data[:html] && @data[:html]["wp-embedded-content"]
|
|
end
|
|
|
|
def html
|
|
get(:html, nil, false)
|
|
end
|
|
end
|
|
end
|