Class: Moceansdk::Modules::Command::McObject::AbstractMc

Inherits:
Object
  • Object
show all
Defined in:
lib/moceansdk/modules/command/mc_object/abstract_mc.rb

Instance Method Summary collapse

Constructor Details

#initialize(params = nil) ⇒ AbstractMc

Returns a new instance of AbstractMc.



7
8
9
10
# File 'lib/moceansdk/modules/command/mc_object/abstract_mc.rb', line 7

def initialize(params = nil)
  @params = {}
  @params = Moceansdk::Utils.convert_to_symbol_hash(params) unless params.nil?
end

Instance Method Details

#actionObject

Raises:

  • (NotImplementedError)


27
28
29
# File 'lib/moceansdk/modules/command/mc_object/abstract_mc.rb', line 27

def action
  raise NotImplementedError, 'AbstractMc is a abstract class'
end

#get_request_dataObject



12
13
14
15
16
17
18
19
20
21
# File 'lib/moceansdk/modules/command/mc_object/abstract_mc.rb', line 12

def get_request_data
  @params = Moceansdk::Utils.convert_to_symbol_hash(@params)
  required_key.each do |key|
    if @params[:"#{key}"].nil?
      raise Moceansdk::Exceptions::RequiredFieldException, "#{key} is mandatory field, can't leave empty (#{self})"
    end
  end
  @params[:action] = action
  @params
end

#required_keyObject

Raises:

  • (NotImplementedError)


23
24
25
# File 'lib/moceansdk/modules/command/mc_object/abstract_mc.rb', line 23

def required_key
  raise NotImplementedError, 'AbstractMc is a abstract class'
end