Module: VideoInfo::Providers::VimeoAPI
- Defined in:
- lib/video_info/providers/vimeo_api.rb
Constant Summary collapse
- THUMBNAIL_LINK_REGEX =
/.*\/(\d+-[^_]+)/
Instance Method Summary collapse
- #api_key ⇒ Object
- #author ⇒ Object
- #author_thumbnail(width = 75) ⇒ Object
- #author_thumbnail_id ⇒ Object
- #author_url ⇒ Object
- #date ⇒ Object
- #keywords ⇒ Object
- #keywords_array ⇒ Object
- #stats ⇒ Object
- #thumbnail_id ⇒ Object
- #thumbnail_large ⇒ Object
- #thumbnail_medium ⇒ Object
- #thumbnail_small ⇒ Object
- #title ⇒ Object
- #view_count ⇒ Object
Instance Method Details
#api_key ⇒ Object
6 7 8 |
# File 'lib/video_info/providers/vimeo_api.rb', line 6 def api_key VideoInfo.provider_api_keys[:vimeo] end |
#author ⇒ Object
22 23 24 |
# File 'lib/video_info/providers/vimeo_api.rb', line 22 def _video["user"]["name"] end |
#author_thumbnail(width = 75) ⇒ Object
35 36 37 38 |
# File 'lib/video_info/providers/vimeo_api.rb', line 35 def (width = 75) "https://i.vimeocdn.com/portrait/" \ "#{}_#{width}x#{width}.jpg" end |
#author_thumbnail_id ⇒ Object
26 27 28 29 |
# File 'lib/video_info/providers/vimeo_api.rb', line 26 def = _video["user"]["pictures"]["uri"] @author_thumbnail_id ||= parse_picture_id_from_user() end |
#author_url ⇒ Object
31 32 33 |
# File 'lib/video_info/providers/vimeo_api.rb', line 31 def _video["user"]["link"] end |
#date ⇒ Object
64 65 66 |
# File 'lib/video_info/providers/vimeo_api.rb', line 64 def date Time.parse(_video["created_time"], Time.now.utc).utc end |
#keywords ⇒ Object
56 57 58 |
# File 'lib/video_info/providers/vimeo_api.rb', line 56 def keywords keywords_array end |
#keywords_array ⇒ Object
60 61 62 |
# File 'lib/video_info/providers/vimeo_api.rb', line 60 def keywords_array _video["tags"].map { |t| t["tag"] } end |
#stats ⇒ Object
72 73 74 |
# File 'lib/video_info/providers/vimeo_api.rb', line 72 def stats _video["stats"] end |
#thumbnail_id ⇒ Object
40 41 42 |
# File 'lib/video_info/providers/vimeo_api.rb', line 40 def thumbnail_id @thumbnail_id ||= parse_picture_id(_video.dig("pictures", "sizes").first["link"]) end |
#thumbnail_large ⇒ Object
52 53 54 |
# File 'lib/video_info/providers/vimeo_api.rb', line 52 def thumbnail_large generate_thumbnail(640) end |
#thumbnail_medium ⇒ Object
48 49 50 |
# File 'lib/video_info/providers/vimeo_api.rb', line 48 def thumbnail_medium generate_thumbnail(200, 150) end |
#thumbnail_small ⇒ Object
44 45 46 |
# File 'lib/video_info/providers/vimeo_api.rb', line 44 def thumbnail_small generate_thumbnail(100, 75) end |
#title ⇒ Object
18 19 20 |
# File 'lib/video_info/providers/vimeo_api.rb', line 18 def title _video["name"] end |
#view_count ⇒ Object
68 69 70 |
# File 'lib/video_info/providers/vimeo_api.rb', line 68 def view_count stats["plays"].to_i end |