Method: RedhatAccess::Telemetry::MessagingService#weekly_summary_data

Defined in:
app/services/redhat_access/telemetry/messaging_service.rb

#weekly_summary_data(username) ⇒ Object



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'app/services/redhat_access/telemetry/messaging_service.rb', line 65

def weekly_summary_data(username)
  User.as username do
    options = {:method => :GET,
               :resource => WEEKLY_SUMMARY_PATH,
               :params => {},
               :payload => nil,
               :use_subsets => true
    }
    json_data = http_request(options, true)
    # Sample expected output: {
    #     "total_systems": 43,
    #     "checking_in_pct": 2,
    #     "total_actions": 22,
    #     "high_severity_hits": 11,
    #     "new_rules": [
    #         {
    #             "rule_id": "vfs_cache_pressure|VFS_CACHE_PRESSURE_TOO_HIGH",
    #             "summary": Rule summary,
    #             "description": "VFS cache pressue"
    #         }
    #     ]
    # }
    data = JSON.parse(json_data, object_class: OpenStruct)
    info = {
        user: User.current,
        data: data
    }
    info
  end
end