Class: Direct::API::V5::DefaultSettings

Inherits:
Object
  • Object
show all
Defined in:
lib/direct/api/v5/default_settings.rb

Overview

Default API settings store

Constant Summary collapse

DEFAULT_HOST =
'api.direct.yandex.com'.freeze
DEFAULT_LANGUAGE =
'en'.freeze

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.auth_tokenObject

Returns the value of attribute auth_token.



12
13
14
# File 'lib/direct/api/v5/default_settings.rb', line 12

def auth_token
  @auth_token
end

.client_loginObject

Returns the value of attribute client_login.



13
14
15
# File 'lib/direct/api/v5/default_settings.rb', line 13

def 
  
end

.hostObject

Return configured host or default value



16
17
18
# File 'lib/direct/api/v5/default_settings.rb', line 16

def host
  @host
end

.languageObject

Return configured language or default value



21
22
23
# File 'lib/direct/api/v5/default_settings.rb', line 21

def language
  @language
end

Class Method Details

.configure {|_self| ... } ⇒ Object

Set default settings from block

Yields:

  • (_self)

Yield Parameters:



35
36
37
# File 'lib/direct/api/v5/default_settings.rb', line 35

def configure
  yield(self)
end

.load_from_yml(yml_file) ⇒ Object

Set default settings from .yml file



26
27
28
29
30
31
32
# File 'lib/direct/api/v5/default_settings.rb', line 26

def load_from_yml(yml_file)
  settings = YAML.load_file(yml_file)[ENV['RAILS_ENV']] || {}
  @host = settings['host']
  @language = settings['language']
  @auth_token = settings['auth_token']
   = settings['client_login']
end