Class: Nexmo::HTTP::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/nexmo/http.rb

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Options

Returns a new instance of Options.


7
8
9
10
11
12
13
14
15
# File 'lib/nexmo/http.rb', line 7

def initialize(hash)
  @hash = hash || {}

  @hash.each_key do |name|
    next if defined_options.key?(name)

    raise ArgumentError, "#{name.inspect} is not a valid option"
  end
end

Instance Method Details

#set(http) ⇒ Object


17
18
19
20
21
# File 'lib/nexmo/http.rb', line 17

def set(http)
  @hash.each do |name, value|
    http.public_send(defined_options.fetch(name), value)
  end
end