Class: ArticleTechnical::PromoteAttachment::Result

Inherits:
Data
  • Object
show all
Defined in:
app/services/article_technical/promote_attachment.rb

Overview

Immutable outcome of an attachment promotion or relinking attempt.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(success: nil, publication: nil, content_link: nil, publication_created: false, attachment_detached: false, errors: []) ⇒ Result

Creates a normalized service result.

Parameters:

  • success (Boolean, nil) (defaults to: nil)

    whether the operation completed

  • publication (Item, nil) (defaults to: nil)

    resolved or created Publication

  • content_link (ContentLink, nil) (defaults to: nil)

    resulting curated link

  • publication_created (Boolean) (defaults to: false)

    whether this call created the Publication

  • attachment_detached (Boolean) (defaults to: false)

    whether this call removed the legacy attachment

  • errors (Array<String>) (defaults to: [])

    validation or processing errors



64
65
66
67
68
69
# File 'app/services/article_technical/promote_attachment.rb', line 64

def initialize(
  success: nil, publication: nil, content_link: nil,
  publication_created: false, attachment_detached: false, errors: []
)
  super
end

Instance Attribute Details

#attachment_detachedObject (readonly)

Returns the value of attribute attachment_detached

Returns:

  • (Object)

    the current value of attachment_detached



48
49
50
# File 'app/services/article_technical/promote_attachment.rb', line 48

def attachment_detached
  @attachment_detached
end

Returns the value of attribute content_link

Returns:

  • (Object)

    the current value of content_link



48
49
50
# File 'app/services/article_technical/promote_attachment.rb', line 48

def content_link
  @content_link
end

#errorsObject (readonly)

Returns the value of attribute errors

Returns:

  • (Object)

    the current value of errors



48
49
50
# File 'app/services/article_technical/promote_attachment.rb', line 48

def errors
  @errors
end

#publicationObject (readonly)

Returns the value of attribute publication

Returns:

  • (Object)

    the current value of publication



48
49
50
# File 'app/services/article_technical/promote_attachment.rb', line 48

def publication
  @publication
end

#publication_createdObject (readonly)

Returns the value of attribute publication_created

Returns:

  • (Object)

    the current value of publication_created



48
49
50
# File 'app/services/article_technical/promote_attachment.rb', line 48

def publication_created
  @publication_created
end

#successObject (readonly)

Returns the value of attribute success

Returns:

  • (Object)

    the current value of success



48
49
50
# File 'app/services/article_technical/promote_attachment.rb', line 48

def success
  @success
end

Instance Method Details

#attachment_detached?Boolean

Returns whether the legacy attachment was detached.

Returns:

  • (Boolean)

    whether the legacy attachment was detached



78
# File 'app/services/article_technical/promote_attachment.rb', line 78

def attachment_detached? = attachment_detached == true

#publication_created?Boolean

Returns whether the operation created a Publication.

Returns:

  • (Boolean)

    whether the operation created a Publication



75
# File 'app/services/article_technical/promote_attachment.rb', line 75

def publication_created? = publication_created == true

#success?Boolean

Returns whether the operation completed successfully.

Returns:

  • (Boolean)

    whether the operation completed successfully



72
# File 'app/services/article_technical/promote_attachment.rb', line 72

def success? = success == true