Class: Jumbotron::Adapters::Operation
- Inherits:
-
Object
- Object
- Jumbotron::Adapters::Operation
- Defined in:
- app/adapters/jumbotron/adapters/operation.rb
Instance Attribute Summary collapse
-
#adapter ⇒ Object
readonly
Returns the value of attribute adapter.
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
-
#transformer ⇒ Object
readonly
Returns the value of attribute transformer.
Instance Method Summary collapse
- #acquire(**query) ⇒ Object
-
#initialize(adapter:, resource:, transformer:) ⇒ Operation
constructor
A new instance of Operation.
- #transform(typed_payload, observed_at:) ⇒ Object
Constructor Details
#initialize(adapter:, resource:, transformer:) ⇒ Operation
Returns a new instance of Operation.
8 9 10 11 12 |
# File 'app/adapters/jumbotron/adapters/operation.rb', line 8 def initialize(adapter:, resource:, transformer:) @adapter = adapter @resource = resource @transformer = transformer end |
Instance Attribute Details
#adapter ⇒ Object (readonly)
Returns the value of attribute adapter.
6 7 8 |
# File 'app/adapters/jumbotron/adapters/operation.rb', line 6 def adapter @adapter end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
6 7 8 |
# File 'app/adapters/jumbotron/adapters/operation.rb', line 6 def resource @resource end |
#transformer ⇒ Object (readonly)
Returns the value of attribute transformer.
6 7 8 |
# File 'app/adapters/jumbotron/adapters/operation.rb', line 6 def transformer @transformer end |
Instance Method Details
#acquire(**query) ⇒ Object
14 15 16 |
# File 'app/adapters/jumbotron/adapters/operation.rb', line 14 def acquire(**query) resource.acquire(adapter: adapter, **query) end |
#transform(typed_payload, observed_at:) ⇒ Object
18 19 20 |
# File 'app/adapters/jumbotron/adapters/operation.rb', line 18 def transform(typed_payload, observed_at:) transformer.call(typed_payload, observed_at: observed_at) end |