v3: branches - add default_branch (boolean) property
This commit is contained in:
parent
06486c57a5
commit
d7c9a367e9
|
@ -4,5 +4,9 @@ module Travis::API::V3
|
|||
belongs_to :last_build, class_name: 'Travis::API::V3::Models::Build'.freeze
|
||||
has_many :builds, foreign_key: [:repository_id, :branch], primary_key: [:repository_id, :name], order: 'builds.id DESC'.freeze, conditions: { event_type: 'push' }
|
||||
has_many :commits, foreign_key: [:repository_id, :branch], primary_key: [:repository_id, :name], order: 'commits.id DESC'.freeze
|
||||
|
||||
def default_branch
|
||||
name == repository.default_branch_name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@ require 'travis/api/v3/renderer/model_renderer'
|
|||
|
||||
module Travis::API::V3
|
||||
class Renderer::Branch < Renderer::ModelRenderer
|
||||
representation(:minimal, :name, :last_build)
|
||||
representation(:standard, :name, :repository, :last_build, :exists_on_github)
|
||||
representation(:minimal, :name)
|
||||
representation(:standard, :name, :repository, :default_branch, :exists_on_github, :last_build)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user