Sha256: 02728e8618ca37d030e3fd05589da803ce61a41bb59f888cb3088db95e8903be

Contents?: true

Size: 898 Bytes

Versions: 4

Compression:

Stored size: 898 Bytes

Contents

module Dimelo::CCP
  class FeedbackComment < Dimelo::CCP::API::Model
    include ::Dimelo::CCP::API::Common::Publishable

    STATUS_COMMENT_PATH = 'feedbacks/%{feedback_id}/status_comments/%{id}'
    COMMENT_PATH = 'feedbacks/%{feedback_id}/comments/%{id}'

    path COMMENT_PATH

    attributes :id, :feedback_id, :body, :body_format, :flow_state, :user_id, :type, :status_id, :attachments_count, :created_at, :updated_at, :permalink, :ipaddr
    submit_attributes :body, :body_format, :user_id, :feedback_id, :status_id, :created_at

    belongs_to :user
    belongs_to :feedback

    def create
      self.class.path(STATUS_COMMENT_PATH) if status_id
      super
    ensure
      self.class.path(COMMENT_PATH) if status_id
    end

    def update
      self.class.path(STATUS_COMMENT_PATH) if status_id
      super
    ensure
      self.class.path(COMMENT_PATH) if status_id
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dimelo_ccp_api-0.5.0 lib/dimelo/ccp/api/model/feedback_comment.rb
dimelo_ccp_api-0.4.4 lib/dimelo/ccp/api/model/feedback_comment.rb
dimelo_ccp_api-0.4.3 lib/dimelo/ccp/api/model/feedback_comment.rb
dimelo_ccp_api-0.4.2 lib/dimelo/ccp/api/model/feedback_comment.rb