travis-api/lib/travis/api/serialize/v2/http/annotations.rb
2016-06-18 17:52:48 +02:00

39 lines
931 B
Ruby

require 'travis/api/serialize/formats'
module Travis
module Api
module Serialize
module V2
module Http
class Annotations
include Formats
def initialize(annotations, options = {})
@annotations = annotations
end
def data
{
"annotations" => @annotations.map { |annotation| build_annotation(annotation) },
}
end
private
def build_annotation(annotation)
{
"id" => annotation.id,
"job_id" => annotation.job_id,
"description" => annotation.description,
"url" => annotation.url,
"status" => annotation.status,
"provider_name" => annotation.annotation_provider.name,
}
end
end
end
end
end
end
end