Class: WssAgent::ResponseInventory

Inherits:
Response
  • Object
show all
Defined in:
lib/wss_agent/response_inventory.rb

Constant Summary

Constants inherited from Response

WssAgent::Response::BAD_REQUEST_STATUS, WssAgent::Response::SERVER_ERROR_STATUS, WssAgent::Response::SUCCESS_STATUS

Instance Attribute Summary

Attributes inherited from Response

#data, #response, #response_data, #status

Instance Method Summary collapse

Methods inherited from Response

#initialize, #parse_error, #parse_response, #response_success?, #success?

Constructor Details

This class inherits a constructor from WssAgent::Response

Instance Method Details

#messageObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/wss_agent/response_inventory.rb', line 3

def message
  if success?
    @message = "White Source update results: \n"
    @message << "  White Source organization: #{data['organization']} \n"

    if data['createdProjects'].empty?
      @message << "  No new projects found \n"
    else
      @message << "  #{data['createdProjects'].size} newly created projects: "
      @message << data['createdProjects'].join(' ')
    end

    if data['updatedProjects'].empty?
      @message << "\n  No projects were updated \n"
    else
      @message << "  #{data['updatedProjects'].size} existing projects were updated: "
      @message << data['updatedProjects'].join(' ')
    end

    @message
  else
    super
  end
end