Class: ConcurrentPipeline::Changeset::CreateDelta
- Inherits:
-
Struct
- Object
- Struct
- ConcurrentPipeline::Changeset::CreateDelta
- Defined in:
- lib/concurrent_pipeline/changeset.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes
29 30 31 |
# File 'lib/concurrent_pipeline/changeset.rb', line 29 def attributes @attributes end |
#type ⇒ Object
Returns the value of attribute type
29 30 31 |
# File 'lib/concurrent_pipeline/changeset.rb', line 29 def type @type end |
Class Method Details
.from_json(json) ⇒ Object
35 36 37 38 39 40 |
# File 'lib/concurrent_pipeline/changeset.rb', line 35 def self.from_json(json) new( type: json.fetch(:type), attributes: json.fetch(:attributes) ) end |
Instance Method Details
#apply(store) ⇒ Object
30 31 32 33 |
# File 'lib/concurrent_pipeline/changeset.rb', line 30 def apply(store) store.create(type: type, attributes: attributes) Result.new(true) end |
#as_json ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/concurrent_pipeline/changeset.rb', line 42 def as_json(...) { action: :create, type: type, attributes: attributes } end |