Class: Twilio::REST::Routes::V2::TrunkContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Routes::V2::TrunkContext
- Defined in:
- lib/twilio-ruby/rest/routes/v2/trunk.rb
Instance Method Summary collapse
-
#fetch ⇒ TrunkInstance
Fetch the TrunkInstance.
-
#initialize(version, sip_trunk_domain) ⇒ TrunkContext
constructor
Initialize the TrunkContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(voice_region: :unset, friendly_name: :unset) ⇒ TrunkInstance
Update the TrunkInstance.
Constructor Details
#initialize(version, sip_trunk_domain) ⇒ TrunkContext
Initialize the TrunkContext
48 49 50 51 52 53 54 55 56 |
# File 'lib/twilio-ruby/rest/routes/v2/trunk.rb', line 48 def initialize(version, sip_trunk_domain) super(version) # Path Solution @solution = { sip_trunk_domain: sip_trunk_domain, } @uri = "/Trunks/#{@solution[:sip_trunk_domain]}" end |
Instance Method Details
#fetch ⇒ TrunkInstance
Fetch the TrunkInstance
60 61 62 63 64 65 66 67 68 |
# File 'lib/twilio-ruby/rest/routes/v2/trunk.rb', line 60 def fetch payload = @version.fetch('GET', @uri) TrunkInstance.new( @version, payload, sip_trunk_domain: @solution[:sip_trunk_domain], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
103 104 105 106 |
# File 'lib/twilio-ruby/rest/routes/v2/trunk.rb', line 103 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Routes.V2.TrunkContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
96 97 98 99 |
# File 'lib/twilio-ruby/rest/routes/v2/trunk.rb', line 96 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Routes.V2.TrunkContext #{context}>" end |
#update(voice_region: :unset, friendly_name: :unset) ⇒ TrunkInstance
Update the TrunkInstance
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/twilio-ruby/rest/routes/v2/trunk.rb', line 75 def update( voice_region: :unset, friendly_name: :unset ) data = Twilio::Values.of({ 'VoiceRegion' => voice_region, 'FriendlyName' => friendly_name, }) payload = @version.update('POST', @uri, data: data) TrunkInstance.new( @version, payload, sip_trunk_domain: @solution[:sip_trunk_domain], ) end |