Class: Storage::Algolia::Actions::Update
- Inherits:
-
Base
- Object
- ApplicationService
- Base
- Storage::Algolia::Actions::Update
- Defined in:
- lib/storage/algolia/actions/update.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#model_name ⇒ Object
readonly
Returns the value of attribute model_name.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#retries ⇒ Object
readonly
Returns the value of attribute retries.
Instance Method Summary collapse
-
#initialize(model_name:, params:, id:) ⇒ Update
constructor
A new instance of Update.
- #process ⇒ Object
Methods inherited from ApplicationService
Constructor Details
#initialize(model_name:, params:, id:) ⇒ Update
Returns a new instance of Update.
11 12 13 14 15 16 |
# File 'lib/storage/algolia/actions/update.rb', line 11 def initialize(model_name:, params:, id:) @model_name = model_name @params = params @id = id @retries = 0 end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
9 10 11 |
# File 'lib/storage/algolia/actions/update.rb', line 9 def id @id end |
#model_name ⇒ Object (readonly)
Returns the value of attribute model_name.
9 10 11 |
# File 'lib/storage/algolia/actions/update.rb', line 9 def model_name @model_name end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
9 10 11 |
# File 'lib/storage/algolia/actions/update.rb', line 9 def params @params end |
#retries ⇒ Object (readonly)
Returns the value of attribute retries.
9 10 11 |
# File 'lib/storage/algolia/actions/update.rb', line 9 def retries @retries end |
Instance Method Details
#process ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/storage/algolia/actions/update.rb', line 18 def process raise Exception unless task.dig('objectID') normalize original_object.to_hash.merge( { objectID: task.dig('objectID'), updatedAt: task.dig('updatedAt') }, params ) end |