class Opium::Model::Batchable::Operation
Attributes
body[RW]
method[RW]
path[RW]
Public Class Methods
new( attributes = {} )
click to toggle source
# 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
Public Instance Methods
to_parse()
click to toggle source
# 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
Private Instance Methods
validate_key_present( attributes, key )
click to toggle source
# File lib/opium/model/batchable/operation.rb, line 24 def validate_key_present( attributes, key ) as_symbol, as_string = key.to_sym, key.to_s fail ArgumentError, "missing an operation #{ key } parameter" unless attributes.key?( as_symbol ) || attributes.key?( as_string ) end