Class: Odnoklassniki::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/odnoklassniki/config.rb

Constant Summary collapse

VALID_OPTIONS_KEYS =
[:access_token,
:client_id,
:client_secret,
:application_key].freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Config

Returns a new instance of Config.



17
18
19
20
21
22
# File 'lib/odnoklassniki/config.rb', line 17

def initialize(options={})
  @access_token = options[:access_token] || options['access_token']
  @client_id = options[:client_id] || options['client_id']
  @client_secret = options[:client_secret] || options['client_secret']
  @application_key = options[:application_key] || options['application_key']
end

Class Method Details

.configure {|config| ... } ⇒ Object

Yields:



11
12
13
14
15
# File 'lib/odnoklassniki/config.rb', line 11

def self.configure
  config = self.new
  yield config
  config
end

Instance Method Details

#optionsObject



24
25
26
27
28
# File 'lib/odnoklassniki/config.rb', line 24

def options
  options = {}
  VALID_OPTIONS_KEYS.each{ |pname| options[pname] = send(pname) }
  options
end