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
Overview
PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact [email protected].
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.
Constructor Details
#initialize(version, sid) ⇒ SubscriptionContext
Initialize the SubscriptionContext
176 177 178 179 180 181 182 183 184 185 |
# File 'lib/twilio-ruby/rest/events/v1/subscription.rb', line 176 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
199 200 201 |
# File 'lib/twilio-ruby/rest/events/v1/subscription.rb', line 199 def delete @version.delete('DELETE', @uri) end |
#fetch ⇒ SubscriptionInstance
Fetch the SubscriptionInstance
190 191 192 193 194 |
# File 'lib/twilio-ruby/rest/events/v1/subscription.rb', line 190 def fetch payload = @version.fetch('GET', @uri) SubscriptionInstance.new(@version, payload, sid: @solution[:sid], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
230 231 232 233 |
# File 'lib/twilio-ruby/rest/events/v1/subscription.rb', line 230 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
207 208 209 210 211 212 213 214 215 216 217 218 219 |
# File 'lib/twilio-ruby/rest/events/v1/subscription.rb', line 207 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
223 224 225 226 |
# File 'lib/twilio-ruby/rest/events/v1/subscription.rb', line 223 def to_s context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Events.V1.SubscriptionContext #{context}>" end |