Class: Yt::Models::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/yt/models/configuration.rb

Overview

Stores runtime configuration information.

Configuration options are loaded from ‘~/.yt`, `.yt`, command line switches, and the `YT_OPTS` environment variable (listed in lowest to highest precedence).

Examples:

A server-to-server YouTube client app


Yt.configure do |config|
  config.api_key = 'ABCDEFGHIJ1234567890'
end

A web YouTube client app


Yt.configure do |config|
  config.client_id = 'ABCDEFGHIJ1234567890'
  config.client_secret = 'ABCDEFGHIJ1234567890'
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



25
26
27
28
29
# File 'lib/yt/models/configuration.rb', line 25

def initialize
  @client_id = ENV['YT_CLIENT_ID']
  @client_secret = ENV['YT_CLIENT_SECRET']
  @api_key = ENV['YT_API_KEY']
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



23
24
25
# File 'lib/yt/models/configuration.rb', line 23

def api_key
  @api_key
end

#client_idObject

Returns the value of attribute client_id.



23
24
25
# File 'lib/yt/models/configuration.rb', line 23

def client_id
  @client_id
end

#client_secretObject

Returns the value of attribute client_secret.



23
24
25
# File 'lib/yt/models/configuration.rb', line 23

def client_secret
  @client_secret
end