class KaveRestApi::Tts

Attributes

config[R]
cost[R]
date[RW]
localid[RW]
message[RW]
receptor[RW]
repeat[RW]
response[R]
sender[R]
status[R]
statustext[R]

Public Class Methods

new(args = {}) click to toggle source
Calls superclass method KaveRestApi::RequestBase::new
# File lib/kavenegar-ruby/requests/tts.rb, line 12
def initialize(args = {})
  super
  @ACTION_NAME    = [:maketts,@FORMAT].join('.').freeze
  @receptor    = args.fetch(:receptor)
  if @receptor.kind_of?(Array)
    @valid_receptor= false if @receptor.length > 200
    @receptor      = @receptor.join(',') 
  end
  @receptor    = @receptor.ctsd
  @date        = args.fetch(:date,nil)
  @message     = args.fetch(:message)
  @message     = @message.ctsd if args.fetch(:standard_digit,false)
  @repeat      = args.fetch(:repeat,nil)
  @localid     = args.fetch(:localid,nil)
  @response    = ResponseSendSimple.new
end

Public Instance Methods

call() click to toggle source
# File lib/kavenegar-ruby/requests/tts.rb, line 33
def call
    connection = Faraday.new(url: "#{@API_URL}/call/") do |faraday|
      faraday.adapter Faraday.default_adapter
      faraday.response @FORMAT.to_sym
    end
    
      response = connection.get(@ACTION_NAME, receptor: @receptor , message: @message,localid: @localid,date: @date,repeat: @repeat)
      @response.validate(response.body)
end
valid_receptor?() click to toggle source
# File lib/kavenegar-ruby/requests/tts.rb, line 29
def valid_receptor?
  @valid_receptor
end