Class: Twilio::REST::Trunking::V1::TrunkContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Trunking::V1::TrunkContext
- Defined in:
- lib/twilio-ruby/rest/trunking/v1/trunk.rb,
lib/twilio-ruby/rest/trunking/v1/trunk/recording.rb,
lib/twilio-ruby/rest/trunking/v1/trunk/phone_number.rb,
lib/twilio-ruby/rest/trunking/v1/trunk/credential_list.rb,
lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb,
lib/twilio-ruby/rest/trunking/v1/trunk/ip_access_control_list.rb
Defined Under Namespace
Classes: CredentialListContext, CredentialListInstance, CredentialListList, CredentialListPage, IpAccessControlListContext, IpAccessControlListInstance, IpAccessControlListList, IpAccessControlListPage, OriginationUrlContext, OriginationUrlInstance, OriginationUrlList, OriginationUrlPage, PhoneNumberContext, PhoneNumberInstance, PhoneNumberList, PhoneNumberPage, RecordingContext, RecordingInstance, RecordingList, RecordingPage
Instance Method Summary collapse
-
#credentials_lists(sid = :unset) ⇒ CredentialListList, CredentialListContext
Access the credentials_lists.
-
#delete ⇒ Boolean
Delete the TrunkInstance.
-
#fetch ⇒ TrunkInstance
Fetch the TrunkInstance.
-
#initialize(version, sid) ⇒ TrunkContext
constructor
Initialize the TrunkContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#ip_access_control_lists(sid = :unset) ⇒ IpAccessControlListList, IpAccessControlListContext
Access the ip_access_control_lists.
-
#origination_urls(sid = :unset) ⇒ OriginationUrlList, OriginationUrlContext
Access the origination_urls.
-
#phone_numbers(sid = :unset) ⇒ PhoneNumberList, PhoneNumberContext
Access the phone_numbers.
-
#recordings ⇒ RecordingList, RecordingContext
Access the recordings.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(friendly_name: :unset, domain_name: :unset, disaster_recovery_url: :unset, disaster_recovery_method: :unset, transfer_mode: :unset, secure: :unset, cnam_lookup_enabled: :unset, transfer_caller_id: :unset) ⇒ TrunkInstance
Update the TrunkInstance.
Constructor Details
#initialize(version, sid) ⇒ TrunkContext
Initialize the TrunkContext
182 183 184 185 186 187 188 189 190 191 192 193 194 195 |
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 182 def initialize(version, sid) super(version) # Path Solution @solution = { sid: sid, } @uri = "/Trunks/#{@solution[:sid]}" # Dependents @recordings = nil @credentials_lists = nil @ip_access_control_lists = nil @phone_numbers = nil @origination_urls = nil end |
Instance Method Details
#credentials_lists(sid = :unset) ⇒ CredentialListList, CredentialListContext
Access the credentials_lists
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 |
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 288 def credentials_lists(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return CredentialListContext.new(@version, @solution[:sid],sid ) end unless @credentials_lists @credentials_lists = CredentialListList.new( @version, trunk_sid: @solution[:sid], ) end @credentials_lists end |
#delete ⇒ Boolean
Delete the TrunkInstance
199 200 201 202 203 204 205 206 |
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 199 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#fetch ⇒ TrunkInstance
Fetch the TrunkInstance
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 211 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) TrunkInstance.new( @version, payload, sid: @solution[:sid], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
370 371 372 373 |
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 370 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Trunking.V1.TrunkContext #{context}>" end |
#ip_access_control_lists(sid = :unset) ⇒ IpAccessControlListList, IpAccessControlListContext
Access the ip_access_control_lists
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 |
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 307 def ip_access_control_lists(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return IpAccessControlListContext.new(@version, @solution[:sid],sid ) end unless @ip_access_control_lists @ip_access_control_lists = IpAccessControlListList.new( @version, trunk_sid: @solution[:sid], ) end @ip_access_control_lists end |
#origination_urls(sid = :unset) ⇒ OriginationUrlList, OriginationUrlContext
Access the origination_urls
345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 |
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 345 def origination_urls(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return OriginationUrlContext.new(@version, @solution[:sid],sid ) end unless @origination_urls @origination_urls = OriginationUrlList.new( @version, trunk_sid: @solution[:sid], ) end @origination_urls end |
#phone_numbers(sid = :unset) ⇒ PhoneNumberList, PhoneNumberContext
Access the phone_numbers
326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 |
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 326 def phone_numbers(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return PhoneNumberContext.new(@version, @solution[:sid],sid ) end unless @phone_numbers @phone_numbers = PhoneNumberList.new( @version, trunk_sid: @solution[:sid], ) end @phone_numbers end |
#recordings ⇒ RecordingList, RecordingContext
Access the recordings
278 279 280 281 282 283 |
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 278 def recordings RecordingContext.new( @version, @solution[:sid] ) end |
#to_s ⇒ Object
Provide a user friendly representation
363 364 365 366 |
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 363 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Trunking.V1.TrunkContext #{context}>" end |
#update(friendly_name: :unset, domain_name: :unset, disaster_recovery_url: :unset, disaster_recovery_method: :unset, transfer_mode: :unset, secure: :unset, cnam_lookup_enabled: :unset, transfer_caller_id: :unset) ⇒ TrunkInstance
Update the TrunkInstance
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 |
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 238 def update( friendly_name: :unset, domain_name: :unset, disaster_recovery_url: :unset, disaster_recovery_method: :unset, transfer_mode: :unset, secure: :unset, cnam_lookup_enabled: :unset, transfer_caller_id: :unset ) data = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'DomainName' => domain_name, 'DisasterRecoveryUrl' => disaster_recovery_url, 'DisasterRecoveryMethod' => disaster_recovery_method, 'TransferMode' => transfer_mode, 'Secure' => secure, 'CnamLookupEnabled' => cnam_lookup_enabled, 'TransferCallerId' => transfer_caller_id, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) TrunkInstance.new( @version, payload, sid: @solution[:sid], ) end |