Class: Faq::Update::Result

Inherits:
Data
  • Object
show all
Defined in:
app/services/faq/update.rb

Overview

Immutable result of an FAQ update operation.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(success: nil, faq: nil, changed_fields: [], added_tags: [], removed_tags: [], added_page_paths: [], removed_page_paths: [], refreshed_posts: [], cache_purged: false, warnings: [], error: nil) ⇒ Result

Mirrors the result members one-for-one; grouping these into a loose Hash
would hide the service contract.

rubocop:disable Metrics/ParameterLists

Parameters:

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

    whether the update succeeded

  • faq (ArticleFaq, nil) (defaults to: nil)

    FAQ targeted by the operation

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

    public labels for changed fields

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

    canonical tags added to the FAQ

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

    canonical tags removed from the FAQ

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

    landing-page placements added

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

    landing-page placements removed

  • refreshed_posts (Array<Hash>) (defaults to: [])

    embedded-post refresh outcomes

  • cache_purged (Boolean) (defaults to: false)

    whether the FAQ edge cache was purged

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

    non-fatal synchronization warnings

  • error (String, nil) (defaults to: nil)

    failure message



58
59
60
61
62
# File 'app/services/faq/update.rb', line 58

def initialize(success: nil, faq: nil, changed_fields: [], added_tags: [], removed_tags: [],
               added_page_paths: [], removed_page_paths: [], refreshed_posts: [], cache_purged: false,
               warnings: [], error: nil)
  super
end

Instance Attribute Details

#added_page_pathsObject (readonly)

Returns the value of attribute added_page_paths

Returns:

  • (Object)

    the current value of added_page_paths



30
31
32
# File 'app/services/faq/update.rb', line 30

def added_page_paths
  @added_page_paths
end

#added_tagsObject (readonly)

Returns the value of attribute added_tags

Returns:

  • (Object)

    the current value of added_tags



30
31
32
# File 'app/services/faq/update.rb', line 30

def added_tags
  @added_tags
end

#cache_purgedObject (readonly)

Returns the value of attribute cache_purged

Returns:

  • (Object)

    the current value of cache_purged



30
31
32
# File 'app/services/faq/update.rb', line 30

def cache_purged
  @cache_purged
end

#changed_fieldsObject (readonly)

Returns the value of attribute changed_fields

Returns:

  • (Object)

    the current value of changed_fields



30
31
32
# File 'app/services/faq/update.rb', line 30

def changed_fields
  @changed_fields
end

#errorObject (readonly)

Returns the value of attribute error

Returns:

  • (Object)

    the current value of error



30
31
32
# File 'app/services/faq/update.rb', line 30

def error
  @error
end

#faqObject (readonly)

Returns the value of attribute faq

Returns:

  • (Object)

    the current value of faq



30
31
32
# File 'app/services/faq/update.rb', line 30

def faq
  @faq
end

#refreshed_postsObject (readonly)

Returns the value of attribute refreshed_posts

Returns:

  • (Object)

    the current value of refreshed_posts



30
31
32
# File 'app/services/faq/update.rb', line 30

def refreshed_posts
  @refreshed_posts
end

#removed_page_pathsObject (readonly)

Returns the value of attribute removed_page_paths

Returns:

  • (Object)

    the current value of removed_page_paths



30
31
32
# File 'app/services/faq/update.rb', line 30

def removed_page_paths
  @removed_page_paths
end

#removed_tagsObject (readonly)

Returns the value of attribute removed_tags

Returns:

  • (Object)

    the current value of removed_tags



30
31
32
# File 'app/services/faq/update.rb', line 30

def removed_tags
  @removed_tags
end

#successObject (readonly)

Returns the value of attribute success

Returns:

  • (Object)

    the current value of success



30
31
32
# File 'app/services/faq/update.rb', line 30

def success
  @success
end

#warningsObject (readonly)

Returns the value of attribute warnings

Returns:

  • (Object)

    the current value of warnings



30
31
32
# File 'app/services/faq/update.rb', line 30

def warnings
  @warnings
end

Instance Method Details

#success?Boolean

Check whether the update completed successfully.

Returns:

  • (Boolean)

    true when the operation succeeded



68
# File 'app/services/faq/update.rb', line 68

def success? = success == true