Class: Gophish::Campaign::Event

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Attributes, ActiveModel::Model
Defined in:
lib/gophish/campaign.rb

Instance Method Summary collapse

Instance Method Details

#has_details?Boolean

Returns:

  • (Boolean)


330
331
332
# File 'lib/gophish/campaign.rb', line 330

def has_details?
  !details.blank?
end

#inspectObject



351
352
353
# File 'lib/gophish/campaign.rb', line 351

def inspect
  to_s
end

#parsed_detailsObject



334
335
336
337
338
339
340
# File 'lib/gophish/campaign.rb', line 334

def parsed_details
  return {} if details.blank?

  JSON.parse details
rescue JSON::ParserError
  {}
end

#to_sObject



342
343
344
345
346
347
348
349
# File 'lib/gophish/campaign.rb', line 342

def to_s
  attributes_hash = {}
  self.class.attribute_names.each do |attr_name|
    value = send attr_name
    attributes_hash[attr_name.to_sym] = value unless value.nil?
  end
  attributes_hash.to_s
end