Class: Opium::Model::Batchable::Operation
- Defined in:
- lib/opium/model/batchable/operation.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Operation
constructor
A new instance of Operation.
- #to_parse ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Operation
Returns a new instance of Operation.
5 6 7 8 9 10 11 |
# File 'lib/opium/model/batchable/operation.rb', line 5 def initialize( attributes = {} ) validate_key_present( attributes, :method ) validate_key_present( attributes, :path ) attributes.each do |key, value| send( :"#{key}=", value ) end end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
13 14 15 |
# File 'lib/opium/model/batchable/operation.rb', line 13 def body @body end |
#method ⇒ Object
Returns the value of attribute method.
13 14 15 |
# File 'lib/opium/model/batchable/operation.rb', line 13 def method @method end |
#path ⇒ Object
Returns the value of attribute path.
13 14 15 |
# File 'lib/opium/model/batchable/operation.rb', line 13 def path @path end |
Instance Method Details
#to_parse ⇒ Object
15 16 17 18 19 20 |
# File 'lib/opium/model/batchable/operation.rb', line 15 def to_parse { method: method.to_s.upcase, path: path }.tap {|result| result[:body] = body if body } end |