Class: XcodeResultBundleProcessor::TestSummaries::Activity

Inherits:
Object
  • Object
show all
Defined in:
lib/xcoderesultbundleprocessor/test_summaries/test_summaries.rb

Class Method Summary collapse

Class Method Details

.parse(activity_summary) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/xcoderesultbundleprocessor/test_summaries/test_summaries.rb', line 37

def self.parse(activity_summary)
  screenshot      = Array(activity_summary['Attachments']).find { |attachment| attachment['Name'] == 'Screenshot' }
  screenshot_path = nil
  unless screenshot.nil?
    screenshot_path = screenshot['FileName']
  end

  snapshot      = Array(activity_summary['Attachments']).find { |attachment| attachment['Name'] == 'Snapshot' }
  snapshot_path = nil
  unless snapshot.nil?
    snapshot_path = snapshot['FileName']
  end

  Activity.new(
      title:           activity_summary['Title'],
      screenshot_path: screenshot_path,
      snapshot_path:   snapshot_path,
      subactivities:   Array(activity_summary['SubActivities']).map { |subactivity| Activity.parse(subactivity) }
  )
end