Class: Storage::Algolia::Actions::Create
- Inherits:
-
Base
- Object
- ApplicationService
- Base
- Storage::Algolia::Actions::Create
- Defined in:
- lib/storage/algolia/actions/create.rb
Instance Attribute Summary collapse
-
#model_name ⇒ Object
readonly
Returns the value of attribute model_name.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
-
#initialize(model_name:, params:) ⇒ Create
constructor
A new instance of Create.
- #process ⇒ Object
Methods inherited from ApplicationService
Constructor Details
#initialize(model_name:, params:) ⇒ Create
Returns a new instance of Create.
11 12 13 14 |
# File 'lib/storage/algolia/actions/create.rb', line 11 def initialize(model_name:, params:) @model_name = model_name @params = params end |
Instance Attribute Details
#model_name ⇒ Object (readonly)
Returns the value of attribute model_name.
9 10 11 |
# File 'lib/storage/algolia/actions/create.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/create.rb', line 9 def params @params end |
Instance Method Details
#process ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/storage/algolia/actions/create.rb', line 16 def process raise Exception unless task.dig('objectID') normalize params.to_hash.merge( objectID: task.dig('objectID'), updatedAt: task.dig('updatedAt') ) end |