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
183 184 185 186 187 188 189 190 191 192 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 183 def initialize(version, sid) super(version) # Path Solution @solution = { sid: sid, } @uri = "/Alerts/#{@solution[:sid]}" end |
Instance Method Details
#fetch ⇒ AlertInstance
Fetch the AlertInstance
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 196 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
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 215 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
247 248 249 250 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 247 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Monitor.V1.AlertContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
240 241 242 243 |
# File 'lib/twilio-ruby/rest/monitor/v1/alert.rb', line 240 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Monitor.V1.AlertContext #{context}>" end |