Class: VoiceML::VoiceV1IpRecordsResource

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

Overview

/v1/IpRecords + /v1/IpRecords/Sid

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ VoiceV1IpRecordsResource

Returns a new instance of VoiceV1IpRecordsResource.



23
24
25
# File 'lib/voiceml/resources/voice_v1.rb', line 23

def initialize(transport)
  @transport = transport
end

Instance Method Details

#create(ip_address:, friendly_name: nil, cidr_prefix_length: nil) ⇒ Object



33
34
35
36
37
38
# File 'lib/voiceml/resources/voice_v1.rb', line 33

def create(ip_address:, friendly_name: nil, cidr_prefix_length: nil)
  form = { 'IpAddress' => ip_address }
  form['FriendlyName']     = friendly_name unless friendly_name.nil?
  form['CidrPrefixLength'] = cidr_prefix_length unless cidr_prefix_length.nil?
  VoiceV1IpRecord.from_hash(@transport.request(:post, '/v1/IpRecords', form: form))
end

#delete(sid) ⇒ Object



50
51
52
53
# File 'lib/voiceml/resources/voice_v1.rb', line 50

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

#fetch(sid) ⇒ Object



40
41
42
# File 'lib/voiceml/resources/voice_v1.rb', line 40

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

#list(page_size: nil) ⇒ Object



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

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

#update(sid, friendly_name: nil) ⇒ Object



44
45
46
47
48
# File 'lib/voiceml/resources/voice_v1.rb', line 44

def update(sid, friendly_name: nil)
  form = {}
  form['FriendlyName'] = friendly_name unless friendly_name.nil?
  VoiceV1IpRecord.from_hash(@transport.request(:post, "/v1/IpRecords/#{sid}", form: form))
end