Class: AlchemyAPI::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/alchemy-api/config.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.apikeyObject

Returns the value of attribute apikey.



4
5
6
# File 'lib/alchemy-api/config.rb', line 4

def apikey
  @apikey
end

.modesObject

Returns the value of attribute modes.



5
6
7
# File 'lib/alchemy-api/config.rb', line 5

def modes
  @modes
end

Class Method Details

.add_mode(key, klass) ⇒ Object



8
9
10
11
12
# File 'lib/alchemy-api/config.rb', line 8

def self.add_mode(key, klass)
  @modes = {} unless @modes

  @modes[key] = klass
end

.default_optionsObject



14
15
16
17
18
# File 'lib/alchemy-api/config.rb', line 14

def self.default_options
  {
    outputMode: output_mode
  }
end

.output_modeObject



20
21
22
# File 'lib/alchemy-api/config.rb', line 20

def self.output_mode
  @output_mode || :json
end

.output_mode=(value) ⇒ Object



24
25
26
27
28
# File 'lib/alchemy-api/config.rb', line 24

def self.output_mode=(value)
  fail InvalidOutputMode unless valid_output_modes.include?(value.to_s)

  @output_mode = value
end

.valid_output_modesObject



30
31
32
# File 'lib/alchemy-api/config.rb', line 30

def self.valid_output_modes
  ['xml', 'json', 'rdf', 'rel-tag', 'rel-tag-raw']
end