Class: Forms::SubmissionStatuses::Report

Inherits:
Object
  • Object
show all
Defined in:
lib/forms/submission_statuses/report.rb

Instance Method Summary collapse

Constructor Details

#initialize(user_account:, allowed_forms:) ⇒ Report

Returns a new instance of Report.



9
10
11
12
# File 'lib/forms/submission_statuses/report.rb', line 9

def initialize(user_account:, allowed_forms:)
  @gateway = Gateway.new(user_account:, allowed_forms:)
  @formatter = Formatter.new
end

Instance Method Details

#dataObject



19
20
21
# File 'lib/forms/submission_statuses/report.rb', line 19

def data
  @dataset = @gateway.data
end

#format_dataObject



23
24
25
26
27
28
29
30
# File 'lib/forms/submission_statuses/report.rb', line 23

def format_data
  results = @formatter.format_data(@dataset)

  OpenStruct.new(
    submission_statuses: results,
    errors: @dataset.errors
  )
end

#runObject



14
15
16
17
# File 'lib/forms/submission_statuses/report.rb', line 14

def run
  data
  format_data
end