Class: BuildWatcher::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/build_watcher/message.rb

Constant Summary collapse

MSG_START =
"\002"
MSG_END =
"\003"
MSG_SEP =
"\037"

Class Method Summary collapse

Class Method Details

.project_info_request(project_index) ⇒ Object



24
25
26
# File 'lib/build_watcher/message.rb', line 24

def project_info_request(project_index)
  wrap separate("G", project_index)
end

.project_info_request!(project_index, public_key_returned, private_key_returned) ⇒ Object

Returns an array of the request which would be generated, as well as the associated response for this request.

Only intended for testing purposes!



32
33
34
# File 'lib/build_watcher/message.rb', line 32

def project_info_request!(project_index, public_key_returned, private_key_returned)
  [project_info_request(project_index), project_info_response(public_key_returned, private_key_returned)]
end

.project_info_response(public_key, private_key) ⇒ Object



36
37
38
# File 'lib/build_watcher/message.rb', line 36

def project_info_response(public_key, private_key)
  wrap separate("I", public_key, private_key)
end

.project_qty_requestObject



8
9
10
# File 'lib/build_watcher/message.rb', line 8

def project_qty_request
  quantity_request
end

.project_qty_request!(number_of_projects_to_return) ⇒ Object

Returns an array of the request which would be generated, as well as the associated response for this request.

Only intended for testing purposes!



16
17
18
# File 'lib/build_watcher/message.rb', line 16

def project_qty_request!(number_of_projects_to_return)
  [quantity_request, project_qty_response(number_of_projects_to_return)]
end

.project_qty_response(number_of_projects) ⇒ Object



20
21
22
# File 'lib/build_watcher/message.rb', line 20

def project_qty_response(number_of_projects)
  wrap separate("N", number_of_projects)
end

.project_status(public_key, status) ⇒ Object



40
41
42
43
44
45
# File 'lib/build_watcher/message.rb', line 40

def project_status(public_key, status)
  unless status && [:nobuilds,:running, :failed, :successful].include?(status.to_sym)
    raise ArgumentError, "Invalid status supplied (provided: '#{status}')"
  end
  wrap separate("S", public_key, status.split(//).first.upcase)
end