Class: Twilio::REST::Monitor::V1::AlertContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Monitor::V1::AlertContext
- Defined in:
- lib/twilio-ruby/rest/monitor/v1/alert.rb
Instance Method Summary collapse
-
#fetch ⇒ AlertInstance
Fetch the AlertInstance.
-
#fetch_with_metadata ⇒ AlertInstance
Fetch the AlertInstanceMetadata.
-
#initialize(version, sid) ⇒ AlertContext
constructor
Initialize the AlertContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
Constructor Details
#initialize(version, sid) ⇒ AlertContext
Initialize the AlertContext
191 192 193 194 195 196 197 198 199 200 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 191 def initialize(version, sid) super(version) # Path Solution @solution = { sid: sid, } @uri = "/Alerts/#{@solution[:sid]}" end |
Instance Method Details
#fetch ⇒ AlertInstance
Fetch the AlertInstance
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 204 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) AlertInstance.new( @version, payload, sid: @solution[:sid], ) end |
#fetch_with_metadata ⇒ AlertInstance
Fetch the AlertInstanceMetadata
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 223 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) alert_instance = AlertInstance.new( @version, response.body, sid: @solution[:sid], ) AlertInstanceMetadata.new( @version, alert_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
255 256 257 258 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 255 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Monitor.V1.AlertContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
248 249 250 251 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 248 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Monitor.V1.AlertContext #{context}>" end |