def render(node)
      asset = nil
      begin
        asset = node['data']['target']
      rescue
        fail "Node target is not an asset - Node: #{node}"
      end

      # Check by class name instead of instance type to
      # avoid dependending on the Contentful SDK.
      return render_asset(asset, node) if asset.class.ancestors.map(&:to_s).any? { |name| name.include?('Asset') }

      if asset.is_a?(::Hash)
        unless asset.key?('fields') && asset['fields'].key?('file')
          fail "Node target is not an asset - Node: #{node}"
        end

        return render_hash(asset, node)
      end

      fail "Node target is not an asset - Node: #{node}"
    end
def render(node)
      asset = nil
      begin
        asset = node['data']['target']
      rescue
        fail "Node target is not an asset - Node: #{node}"
      end

      # Check by class name instead of instance type to
      # avoid dependending on the Contentful SDK.
      return render_asset(asset, node) if asset.class.ancestors.map(&:to_s).any? { |name| name.include?('Asset') }

      if asset.is_a?(::Hash)
        unless asset.key?('fields') && asset['fields'].key?('file')
          fail "Node target is not an asset - Node: #{node}"
        end

        return render_hash(asset, node)
      end

      fail "Node target is not an asset - Node: #{node}"
    end
Renders asset nodes