Class: Moceansdk::Modules::Voice::McObject::AbstractMc

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

Direct Known Subclasses

Collect, Dial, Play, Record, Say, Sleep

Instance Method Summary collapse

Constructor Details

#initialize(params = nil) ⇒ AbstractMc

Returns a new instance of AbstractMc.



7
8
9
10
11
# File 'lib/moceansdk/modules/voice/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)


30
31
32
# File 'lib/moceansdk/modules/voice/mc_object/abstract_mc.rb', line 30

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

#get_request_dataObject



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/moceansdk/modules/voice/mc_object/abstract_mc.rb', line 13

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)


26
27
28
# File 'lib/moceansdk/modules/voice/mc_object/abstract_mc.rb', line 26

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