Class: VoiceML::RoutesV2SipDomainsResource

Inherits:
Object
  • Object
show all
Defined in:
lib/voiceml/resources/routes_v2.rb

Overview

Operations on /v2/SipDomains/SipDomain. Keyed by domain name; account is resolved from HTTP Basic auth.

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ RoutesV2SipDomainsResource

Returns a new instance of RoutesV2SipDomainsResource.



18
19
20
# File 'lib/voiceml/resources/routes_v2.rb', line 18

def initialize(transport)
  @transport = transport
end

Instance Method Details

#fetch(domain_name) ⇒ Object



22
23
24
# File 'lib/voiceml/resources/routes_v2.rb', line 22

def fetch(domain_name)
  RoutesV2SipDomain.from_hash(@transport.request(:get, "/v2/SipDomains/#{domain_name}"))
end

#update(domain_name, voice_region: nil, friendly_name: nil) ⇒ Object



26
27
28
29
30
31
# File 'lib/voiceml/resources/routes_v2.rb', line 26

def update(domain_name, voice_region: nil, friendly_name: nil)
  form = {}
  form['VoiceRegion'] = voice_region unless voice_region.nil?
  form['FriendlyName'] = friendly_name unless friendly_name.nil?
  RoutesV2SipDomain.from_hash(@transport.request(:post, "/v2/SipDomains/#{domain_name}", form: form))
end