class PDJSON::Message
Public Class Methods
new(body)
click to toggle source
# File lib/grappling/pd-json.rb, line 16 def initialize(body) @body = body @json = JSON.parse(body) end
Public Instance Methods
description()
click to toggle source
# File lib/grappling/pd-json.rb, line 37 def description @json["data"]["incident"]["trigger_summary_data"]["subject"] end
is_acknowledge?()
click to toggle source
# File lib/grappling/pd-json.rb, line 25 def is_acknowledge? type == "incident.acknowledge" end
is_resolve?()
click to toggle source
# File lib/grappling/pd-json.rb, line 29 def is_resolve? type == "incident.resolve" end
is_trigger?()
click to toggle source
# File lib/grappling/pd-json.rb, line 21 def is_trigger? type == "incident.trigger" end
to_h()
click to toggle source
# File lib/grappling/pd-json.rb, line 41 def to_h @json end
to_json()
click to toggle source
# File lib/grappling/pd-json.rb, line 45 def to_json @body end
user()
click to toggle source
# File lib/grappling/pd-json.rb, line 33 def user {:email => user_hash["email"], :name => user_hash["name"], :id => user_hash["id"], :url => user_hash["html_url"]} end
Private Instance Methods
type()
click to toggle source
# File lib/grappling/pd-json.rb, line 50 def type @json["type"] end
user_hash()
click to toggle source
# File lib/grappling/pd-json.rb, line 54 def user_hash if is_resolve? @json["data"]["incident"]["resolved_by_user"] else @json["data"]["incident"]["assigned_to_user"] end end