Skip to content
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

Methods to know the type of content #113

Open
ricardopacheco opened this issue Mar 23, 2017 · 3 comments
Open

Methods to know the type of content #113

ricardopacheco opened this issue Mar 23, 2017 · 3 comments

Comments

@ricardopacheco
Copy link

Is it possible to have a method that returns the content type of the page? In oembed there is a key that returns this.

Example { title: 'example', type: 'video', url: ... }

@gottfrois
Copy link
Owner

sounds reasonable, we could fallback to use the content-type from the http request maybe?

@ricardopacheco
Copy link
Author

ricardopacheco commented Mar 23, 2017

Yea, ruby-oembed gem has an implementation in that sense that you said.

https://github.com/ruby-oembed/ruby-oembed/blob/master/lib/oembed/response.rb#L29

The question is to have the URL type in to_json and boolean methods to check for themselves, type @object.video? @object.image?

This will help, for example, render specific views for each case.

@ricardopacheco
Copy link
Author

@gottfrois You could put another hash with the request information?

Like this:

{
  request: {
    content-type: ...,
    ...
  },
  object: {
    url: '...',
    title: '...',
  }
}

This alternative hash could be returned by user option for example: generate (url, http_headers: true)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants