Class: Connfu::Provisioning::Dtmf
- Inherits:
-
Object
- Object
- Connfu::Provisioning::Dtmf
- Defined in:
- lib/connfu/provisioning/dtmf.rb
Overview
connFu Dtmf press key (belongs to a Voice channel)
Instance Attribute Summary collapse
-
#message ⇒ Object
message.
-
#tone ⇒ Object
tone.
-
#voice ⇒ Object
readonly
voice channel unique identifier.
Class Method Summary collapse
-
.unmarshal(voice, data) ⇒ Object
Creates a Dtmf object using the raw data from the provisioning API.
Instance Method Summary collapse
-
#[](value) ⇒ Object
Hash way to retrieve attributes.
-
#initialize(voice, tone, message = "") ⇒ Dtmf
constructor
A new instance of Dtmf.
- #to_hash ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(voice, tone, message = "") ⇒ Dtmf
Returns a new instance of Dtmf.
22 23 24 25 26 |
# File 'lib/connfu/provisioning/dtmf.rb', line 22 def initialize(voice, tone, = "") @voice = voice @tone = tone = end |
Instance Attribute Details
#message ⇒ Object
message
14 15 16 |
# File 'lib/connfu/provisioning/dtmf.rb', line 14 def end |
#tone ⇒ Object
tone
11 12 13 |
# File 'lib/connfu/provisioning/dtmf.rb', line 11 def tone @tone end |
#voice ⇒ Object (readonly)
voice channel unique identifier
17 18 19 |
# File 'lib/connfu/provisioning/dtmf.rb', line 17 def voice @voice end |
Class Method Details
.unmarshal(voice, data) ⇒ Object
Creates a Dtmf object using the raw data from the provisioning API
45 46 47 48 49 50 51 |
# File 'lib/connfu/provisioning/dtmf.rb', line 45 def self.unmarshal(voice, data) if data.is_a?(Array) data.map{|item| Dtmf.new(voice, item["tone"], item["message"])} else Dtmf.new(voice, data["tone"], data["message"]) end end |
Instance Method Details
#[](value) ⇒ Object
Hash way to retrieve attributes
29 30 31 |
# File 'lib/connfu/provisioning/dtmf.rb', line 29 def [](value) self.respond_to?(value.to_sym) ? self.send(value.to_sym) : nil end |
#to_hash ⇒ Object
33 34 35 |
# File 'lib/connfu/provisioning/dtmf.rb', line 33 def to_hash {"tone" => tone, "message" => } end |
#to_s ⇒ Object
37 38 39 |
# File 'lib/connfu/provisioning/dtmf.rb', line 37 def to_s "#{self.class.to_s}: #{to_hash}" end |