Class: Gitlab::HookData::ReleaseBuilder
- Inherits:
-
BaseBuilder
- Object
- BaseBuilder
- Gitlab::HookData::ReleaseBuilder
- Defined in:
- lib/gitlab/hook_data/release_builder.rb
Constant Summary
Constants inherited from BaseBuilder
BaseBuilder::MARKDOWN_SIMPLE_IMAGE
Instance Attribute Summary
Attributes inherited from BaseBuilder
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from BaseBuilder
Constructor Details
This class inherits a constructor from Gitlab::HookData::BaseBuilder
Class Method Details
.safe_hook_attributes ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/gitlab/hook_data/release_builder.rb', line 6 def self.safe_hook_attributes %i[ id created_at description name released_at tag ].freeze end |
Instance Method Details
#build(action) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/gitlab/hook_data/release_builder.rb', line 19 def build(action) attrs = { object_kind: object_kind, project: release.project.hook_attrs, description: absolute_image_urls(release.description), url: Gitlab::UrlBuilder.build(release), action: action, assets: { count: release.assets_count, links: release.links.map(&:hook_attrs), sources: release.sources.map(&:hook_attrs) }, commit: release.commit.hook_attrs } release.attributes.with_indifferent_access.slice(*self.class.safe_hook_attributes) .merge!(attrs) end |