Class: Nexmo::Voice::Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key, api_secret, options = {}) ⇒ Client

Returns a new instance of Client.



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/nexmo/voice.rb', line 15

def initialize(api_key, api_secret, options = {})
  @nexmo_adaptor = RestClient::Resource.new(BASE_URL, timeout: options.fetch(:timeout, 10))

  @api_config = {
    api_key: api_key,
    api_secret: api_secret
  }

  @calls = Calls.new(self)
  @ttses = Ttses.new(self)
end

Instance Attribute Details

#api_configObject

Returns the value of attribute api_config.



12
13
14
# File 'lib/nexmo/voice.rb', line 12

def api_config
  @api_config
end

#callsObject

Returns the value of attribute calls.



12
13
14
# File 'lib/nexmo/voice.rb', line 12

def calls
  @calls
end

#nexmo_adaptorObject

Returns the value of attribute nexmo_adaptor.



12
13
14
# File 'lib/nexmo/voice.rb', line 12

def nexmo_adaptor
  @nexmo_adaptor
end

#ttsesObject

Returns the value of attribute ttses.



12
13
14
# File 'lib/nexmo/voice.rb', line 12

def ttses
  @ttses
end

Instance Method Details

#get(resource, entity = {}) ⇒ Object



27
28
29
# File 'lib/nexmo/voice.rb', line 27

def get(resource, entity = {})
  @nexmo_adaptor[resource.class::RELATIVE_URL].get(params: entity.merge(@api_config))
end