Class: Twilio::REST::Chat::V3::ChannelContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Chat::V3::ChannelContext
- Defined in:
- lib/twilio-ruby/rest/chat/v3/channel.rb
Instance Method Summary collapse
-
#initialize(version, service_sid, sid) ⇒ ChannelContext
constructor
Initialize the ChannelContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(type: :unset, messaging_service_sid: :unset, x_twilio_webhook_enabled: :unset) ⇒ ChannelInstance
Update the ChannelInstance.
-
#update_with_metadata(type: :unset, messaging_service_sid: :unset, x_twilio_webhook_enabled: :unset) ⇒ ChannelInstance
Update the ChannelInstanceMetadata.
Constructor Details
#initialize(version, service_sid, sid) ⇒ ChannelContext
Initialize the ChannelContext
51 52 53 54 55 56 57 58 59 60 |
# File 'lib/twilio-ruby/rest/chat/v3/channel.rb', line 51 def initialize(version, service_sid, sid) super(version) # Path Solution @solution = { service_sid: service_sid, sid: sid, } @uri = "/Services/#{@solution[:service_sid]}/Channels/#{@solution[:sid]}" end |
Instance Method Details
#inspect ⇒ Object
Provide a detailed, user friendly representation
141 142 143 144 |
# File 'lib/twilio-ruby/rest/chat/v3/channel.rb', line 141 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Chat.V3.ChannelContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
134 135 136 137 |
# File 'lib/twilio-ruby/rest/chat/v3/channel.rb', line 134 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Chat.V3.ChannelContext #{context}>" end |
#update(type: :unset, messaging_service_sid: :unset, x_twilio_webhook_enabled: :unset) ⇒ ChannelInstance
Update the ChannelInstance
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/twilio-ruby/rest/chat/v3/channel.rb', line 67 def update( type: :unset, messaging_service_sid: :unset, x_twilio_webhook_enabled: :unset ) data = Twilio::Values.of({ 'Type' => type, 'MessagingServiceSid' => messaging_service_sid, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, }) payload = @version.update('POST', @uri, data: data, headers: headers) ChannelInstance.new( @version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], ) end |
#update_with_metadata(type: :unset, messaging_service_sid: :unset, x_twilio_webhook_enabled: :unset) ⇒ ChannelInstance
Update the ChannelInstanceMetadata
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/twilio-ruby/rest/chat/v3/channel.rb', line 99 def ( type: :unset, messaging_service_sid: :unset, x_twilio_webhook_enabled: :unset ) data = Twilio::Values.of({ 'Type' => type, 'MessagingServiceSid' => messaging_service_sid, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, }) response = @version.('POST', @uri, data: data, headers: headers) channel_instance = ChannelInstance.new( @version, response.body, service_sid: @solution[:service_sid], sid: @solution[:sid], ) ChannelInstanceMetadata.new( @version, channel_instance, response.headers, response.status_code ) end |