Class: KaveRestApi::Tts
- Inherits:
-
RequestBase
- Object
- RequestBase
- KaveRestApi::Tts
- Includes:
- Validatable
- Defined in:
- lib/kavenegar-ruby/requests/tts.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#cost ⇒ Object
readonly
Returns the value of attribute cost.
-
#date ⇒ Object
Returns the value of attribute date.
-
#localid ⇒ Object
Returns the value of attribute localid.
-
#message ⇒ Object
Returns the value of attribute message.
-
#receptor ⇒ Object
Returns the value of attribute receptor.
-
#repeat ⇒ Object
Returns the value of attribute repeat.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#sender ⇒ Object
readonly
Returns the value of attribute sender.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#statustext ⇒ Object
readonly
Returns the value of attribute statustext.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(args = {}) ⇒ Tts
constructor
A new instance of Tts.
- #valid_receptor? ⇒ Boolean
Constructor Details
#initialize(args = {}) ⇒ Tts
Returns a new instance of Tts.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# 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 |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
5 6 7 |
# File 'lib/kavenegar-ruby/requests/tts.rb', line 5 def config @config end |
#cost ⇒ Object (readonly)
Returns the value of attribute cost.
5 6 7 |
# File 'lib/kavenegar-ruby/requests/tts.rb', line 5 def cost @cost end |
#date ⇒ Object
Returns the value of attribute date.
4 5 6 |
# File 'lib/kavenegar-ruby/requests/tts.rb', line 4 def date @date end |
#localid ⇒ Object
Returns the value of attribute localid.
4 5 6 |
# File 'lib/kavenegar-ruby/requests/tts.rb', line 4 def localid @localid end |
#message ⇒ Object
Returns the value of attribute message.
4 5 6 |
# File 'lib/kavenegar-ruby/requests/tts.rb', line 4 def @message end |
#receptor ⇒ Object
Returns the value of attribute receptor.
4 5 6 |
# File 'lib/kavenegar-ruby/requests/tts.rb', line 4 def receptor @receptor end |
#repeat ⇒ Object
Returns the value of attribute repeat.
4 5 6 |
# File 'lib/kavenegar-ruby/requests/tts.rb', line 4 def repeat @repeat end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
5 6 7 |
# File 'lib/kavenegar-ruby/requests/tts.rb', line 5 def response @response end |
#sender ⇒ Object (readonly)
Returns the value of attribute sender.
5 6 7 |
# File 'lib/kavenegar-ruby/requests/tts.rb', line 5 def sender @sender end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
5 6 7 |
# File 'lib/kavenegar-ruby/requests/tts.rb', line 5 def status @status end |
#statustext ⇒ Object (readonly)
Returns the value of attribute statustext.
5 6 7 |
# File 'lib/kavenegar-ruby/requests/tts.rb', line 5 def statustext @statustext end |
Instance Method Details
#call ⇒ Object
33 34 35 36 37 38 39 40 41 |
# 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? ⇒ Boolean
29 30 31 |
# File 'lib/kavenegar-ruby/requests/tts.rb', line 29 def valid_receptor? @valid_receptor end |