Sha256: 9ce97f0d7529a3053584fd31905663625b8151585fc2de03474e2bd52f635ed8

Contents?: true

Size: 909 Bytes

Versions: 1

Compression:

Stored size: 909 Bytes

Contents

require_relative 'journal_detail'

module RedmineRest
  module Models
    class Issue < ActiveResource::Base
      #
      # Class that represents issue journals.
      #
      # Redmine REST provides journals only through `/issues.xml?include=journals`,
      # so there's no reason to use active_resource
      #
      class Journal
        attr_accessor :id, :user, :notes,
                      :created_on, :details

        attr_reader :broken # for indication that something is wrong

        def initialize(params, _persisted)
          params.each { |attr, value| public_send("#{attr}=", value) }
        rescue
          @broken = true
        end

        def user=(value)
          @user = User.new(value, true)
        end

        def details=(value)
          value = [value] unless value.is_a? Array
          @details = value.map { |v| Detail.new(v) }
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
redmine_rest-0.8.0 lib/redmine_rest/models/issue/journal.rb