Class: Twilio::REST::Api::V2010::AccountContext::SipList::IpAccessControlListContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list.rb,
lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list/ip_address.rb

Defined Under Namespace

Classes: IpAddressContext, IpAddressInstance, IpAddressList, IpAddressPage

Instance Method Summary collapse

Constructor Details

#initialize(version, account_sid, sid) ⇒ IpAccessControlListContext

Initialize the IpAccessControlListContext



176
177
178
179
180
181
182
183
184
185
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list.rb', line 176

def initialize(version, , sid)
  super(version)

  # Path Solution
  @solution = {account_sid: , sid: sid, }
  @uri = "/Accounts/#{@solution[:account_sid]}/SIP/IpAccessControlLists/#{@solution[:sid]}.json"

  # Dependents
  @ip_addresses = nil
end

Instance Method Details

#deleteBoolean

Deletes the IpAccessControlListInstance



232
233
234
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list.rb', line 232

def delete
  @version.delete('delete', @uri)
end

#fetchIpAccessControlListInstance

Fetch a IpAccessControlListInstance



190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list.rb', line 190

def fetch
  params = Twilio::Values.of({})

  payload = @version.fetch(
      'GET',
      @uri,
      params,
  )

  IpAccessControlListInstance.new(
      @version,
      payload,
      account_sid: @solution[:account_sid],
      sid: @solution[:sid],
  )
end

#inspectObject

Provide a detailed, user friendly representation



267
268
269
270
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list.rb', line 267

def inspect
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Api.V2010.IpAccessControlListContext #{context}>"
end

#ip_addresses(sid = :unset) ⇒ IpAddressList, IpAddressContext

Access the ip_addresses

Raises:

  • (ArgumentError)


240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list.rb', line 240

def ip_addresses(sid=:unset)
  raise ArgumentError, 'sid cannot be nil' if sid.nil?

  if sid != :unset
    return IpAddressContext.new(@version, @solution[:account_sid], @solution[:sid], sid, )
  end

  unless @ip_addresses
    @ip_addresses = IpAddressList.new(
        @version,
        account_sid: @solution[:account_sid],
        ip_access_control_list_sid: @solution[:sid],
    )
  end

  @ip_addresses
end

#to_sObject

Provide a user friendly representation



260
261
262
263
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list.rb', line 260

def to_s
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Api.V2010.IpAccessControlListContext #{context}>"
end

#update(friendly_name: nil) ⇒ IpAccessControlListInstance

Update the IpAccessControlListInstance



212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list.rb', line 212

def update(friendly_name: nil)
  data = Twilio::Values.of({'FriendlyName' => friendly_name, })

  payload = @version.update(
      'POST',
      @uri,
      data: data,
  )

  IpAccessControlListInstance.new(
      @version,
      payload,
      account_sid: @solution[:account_sid],
      sid: @solution[:sid],
  )
end