Class: VoiceML::VoiceV1ByocTrunksResource

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

Overview

/v1/ByocTrunks + /v1/ByocTrunks/Sid

Constant Summary collapse

TRUNK_FIELDS =
{
  'FriendlyName' => :friendly_name,
  'VoiceUrl' => :voice_url,
  'VoiceMethod' => :voice_method,
  'VoiceFallbackUrl' => :voice_fallback_url,
  'VoiceFallbackMethod' => :voice_fallback_method,
  'StatusCallbackUrl' => :status_callback_url,
  'StatusCallbackMethod' => :status_callback_method,
  'CnamLookupEnabled' => :cnam_lookup_enabled,
  'ConnectionPolicySid' => :connection_policy_sid,
  'FromDomainSid' => :from_domain_sid
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ VoiceV1ByocTrunksResource

Returns a new instance of VoiceV1ByocTrunksResource.



103
104
105
# File 'lib/voiceml/resources/voice_v1.rb', line 103

def initialize(transport)
  @transport = transport
end

Instance Method Details

#create(**kwargs) ⇒ Object



113
114
115
# File 'lib/voiceml/resources/voice_v1.rb', line 113

def create(**kwargs)
  VoiceV1ByocTrunk.from_hash(@transport.request(:post, '/v1/ByocTrunks', form: build_form(kwargs)))
end

#delete(sid) ⇒ Object



125
126
127
128
# File 'lib/voiceml/resources/voice_v1.rb', line 125

def delete(sid)
  @transport.request(:delete, "/v1/ByocTrunks/#{sid}")
  nil
end

#fetch(sid) ⇒ Object



117
118
119
# File 'lib/voiceml/resources/voice_v1.rb', line 117

def fetch(sid)
  VoiceV1ByocTrunk.from_hash(@transport.request(:get, "/v1/ByocTrunks/#{sid}"))
end

#list(page_size: nil) ⇒ Object



107
108
109
110
111
# File 'lib/voiceml/resources/voice_v1.rb', line 107

def list(page_size: nil)
  params = {}
  params['PageSize'] = page_size unless page_size.nil?
  VoiceV1ByocTrunkList.new(@transport.request(:get, '/v1/ByocTrunks', params: params))
end

#update(sid, **kwargs) ⇒ Object



121
122
123
# File 'lib/voiceml/resources/voice_v1.rb', line 121

def update(sid, **kwargs)
  VoiceV1ByocTrunk.from_hash(@transport.request(:post, "/v1/ByocTrunks/#{sid}", form: build_form(kwargs)))
end