Class: Opium::Model::Batchable::Operation

Inherits:
Object
  • Object
show all
Defined in:
lib/opium/model/batchable/operation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#bodyObject

Returns the value of attribute body.



13
14
15
# File 'lib/opium/model/batchable/operation.rb', line 13

def body
  @body
end

#methodObject

Returns the value of attribute method.



13
14
15
# File 'lib/opium/model/batchable/operation.rb', line 13

def method
  @method
end

#pathObject

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_parseObject



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