Module: Vonage

Extended by:
Forwardable
Defined in:
lib/vonage_rails.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.clientObject

Returns the value of attribute client.



9
10
11
# File 'lib/vonage_rails.rb', line 9

def client
  @client
end

Class Method Details

.setup(&block) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/vonage_rails.rb', line 13

def setup(&block)
  config = OpenStruct.new 
  config.instance_eval(&block)
  self.client = ::Vonage::Client.new(
    api_key: config.api_key,
    api_secret: config.api_secret,
    signature_secret: config.signature_secret,
    application_id: config.application_id,
    private_key: config.private_key.present? && File.exist?(config.private_key) ? File.read(config.private_key) : config.private_key
  )
end