feat(IssueWrapper): add custom field information

This commit is contained in:
Christian Orthmann
2019-01-25 11:59:57 +01:00
parent c2e26ba560
commit ebecc81fce
3 changed files with 27 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
class RedmineWebhook::CustomFieldValueWrapper
def initialize(custom_field_value)
@custom_field_value = custom_field_value
end
def to_hash
{
custom_field_id: @custom_field_value.custom_field_id,
value: @custom_field_value.value
}
end
end

View File

@@ -0,0 +1,13 @@
class RedmineWebhook::CustomFieldWrapper
def initialize(custom_field)
@custom_field = custom_field
end
def to_hash
{
id: @custom_field.id,
name: @custom_field.name,
possible_values: @custom_field.possible_values
}
end
end

View File

@@ -20,6 +20,8 @@ module RedmineWebhook
:estimated_hours => @issue.estimated_hours,
:is_private => @issue.is_private,
:lock_version => @issue.lock_version,
:custom_fields => @issue.custom_fields.collect { |custom_field| RedmineWebhook::CustomFieldWrapper.new(custom_field).to_hash },
:custom_field_values => @issue.custom_field_values.collect { |value| RedmineWebhook::CustomFieldValueWrapper.new(value).to_hash },
:project => RedmineWebhook::ProjectWrapper.new(@issue.project).to_hash,
:status => RedmineWebhook::StatusWrapper.new(@issue.status).to_hash,
:tracker => RedmineWebhook::TrackerWrapper.new(@issue.tracker).to_hash,