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

Parameters:

  • version (Version)

    Version that contains the resource

  • account_sid (String)

    The unique id of the Account responsible for this resource.

  • sid (String)

    A 34 character string that uniquely identifies the resource to fetch.


169
170
171
172
173
174
175
176
177
178
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list.rb', line 169

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

Delete the IpAccessControlListInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise


215
216
217
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list.rb', line 215

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

#fetchIpAccessControlListInstance

Fetch the IpAccessControlListInstance

Returns:


183
184
185
186
187
188
189
190
191
192
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list.rb', line 183

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

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

#inspectObject

Provide a detailed, user friendly representation


250
251
252
253
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list.rb', line 250

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

Returns:

Raises:

  • (ArgumentError)

223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list.rb', line 223

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


243
244
245
246
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list.rb', line 243

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

Parameters:

  • friendly_name (String) (defaults to: nil)

    A human readable descriptive text, up to 64 characters long.

Returns:


199
200
201
202
203
204
205
206
207
208
209
210
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list.rb', line 199

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