Class: Videodrome::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/videodrome/connection.rb

Overview

Connection class to make the requests to Youtube API.

Constant Summary collapse

API_SERVER =
"https://www.googleapis.com"
API_SERVICE =
"youtube"
API_VERSION =
"v3"

Instance Method Summary collapse

Instance Method Details

#get(params = {}) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/videodrome/connection.rb', line 8

def get(params = {})
  defaults = {
    :part => "snippet,player,contentDetails,status"
  }
  defaults[:key] = ENV["VIDEODROME_YOUTUBE_API_KEY"] if ENV["VIDEODROME_YOUTUBE_API_KEY"]
  response = connection.get(search_path, defaults.merge(params))
  JSON.parse(response.body)
end