Class: Twilio::REST::Events::V1::SubscriptionContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Events::V1::SubscriptionContext
- Defined in:
- lib/twilio-ruby/rest/events/v1/subscription.rb,
lib/twilio-ruby/rest/events/v1/subscription/subscribed_event.rb
Defined Under Namespace
Classes: SubscribedEventContext, SubscribedEventInstance, SubscribedEventList, SubscribedEventPage
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the SubscriptionInstance.
-
#fetch ⇒ SubscriptionInstance
Fetch the SubscriptionInstance.
-
#initialize(version, sid) ⇒ SubscriptionContext
constructor
Initialize the SubscriptionContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#subscribed_events(type = :unset) ⇒ SubscribedEventList, SubscribedEventContext
Access the subscribed_events.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(description: :unset, sink_sid: :unset) ⇒ SubscriptionInstance
Update the SubscriptionInstance.
Constructor Details
#initialize(version, sid) ⇒ SubscriptionContext
Initialize the SubscriptionContext
173 174 175 176 177 178 179 180 181 182 |
# File 'lib/twilio-ruby/rest/events/v1/subscription.rb', line 173 def initialize(version, sid) super(version) # Path Solution @solution = { sid: sid, } @uri = "/Subscriptions/#{@solution[:sid]}" # Dependents @subscribed_events = nil end |
Instance Method Details
#delete ⇒ Boolean
Delete the SubscriptionInstance
186 187 188 189 190 191 192 193 |
# File 'lib/twilio-ruby/rest/events/v1/subscription.rb', line 186 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#fetch ⇒ SubscriptionInstance
Fetch the SubscriptionInstance
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
# File 'lib/twilio-ruby/rest/events/v1/subscription.rb', line 198 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) SubscriptionInstance.new( @version, payload, sid: @solution[:sid], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
272 273 274 275 |
# File 'lib/twilio-ruby/rest/events/v1/subscription.rb', line 272 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Events.V1.SubscriptionContext #{context}>" end |
#subscribed_events(type = :unset) ⇒ SubscribedEventList, SubscribedEventContext
Access the subscribed_events
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 |
# File 'lib/twilio-ruby/rest/events/v1/subscription.rb', line 247 def subscribed_events(type=:unset) raise ArgumentError, 'type cannot be nil' if type.nil? if type != :unset return SubscribedEventContext.new(@version, @solution[:sid],type ) end unless @subscribed_events @subscribed_events = SubscribedEventList.new( @version, subscription_sid: @solution[:sid], ) end @subscribed_events end |
#to_s ⇒ Object
Provide a user friendly representation
265 266 267 268 |
# File 'lib/twilio-ruby/rest/events/v1/subscription.rb', line 265 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Events.V1.SubscriptionContext #{context}>" end |
#update(description: :unset, sink_sid: :unset) ⇒ SubscriptionInstance
Update the SubscriptionInstance
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
# File 'lib/twilio-ruby/rest/events/v1/subscription.rb', line 219 def update( description: :unset, sink_sid: :unset ) data = Twilio::Values.of({ 'Description' => description, 'SinkSid' => sink_sid, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) SubscriptionInstance.new( @version, payload, sid: @solution[:sid], ) end |