Class: VoiceCom::Response
- Inherits:
-
Object
- Object
- VoiceCom::Response
- Defined in:
- lib/voice_com/response.rb
Instance Attribute Summary collapse
-
#answer ⇒ Object
Returns the value of attribute answer.
-
#answer_hash ⇒ Object
readonly
Returns the value of attribute answer_hash.
-
#dlr ⇒ Object
Returns the value of attribute dlr.
-
#from ⇒ Object
Returns the value of attribute from.
-
#sid ⇒ Object
Returns the value of attribute sid.
-
#smsID ⇒ Object
Returns the value of attribute smsID.
-
#to ⇒ Object
Returns the value of attribute to.
-
#ts ⇒ Object
Returns the value of attribute ts.
-
#voicecom_id ⇒ Object
Returns the value of attribute voicecom_id.
Instance Method Summary collapse
- #get_answer ⇒ Object
-
#initialize(args = {}) {|_self| ... } ⇒ Response
constructor
A new instance of Response.
- #parse_answer ⇒ Object
- #sms_id ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(args = {}) {|_self| ... } ⇒ Response
Returns a new instance of Response.
7 8 9 10 11 12 13 14 15 |
# File 'lib/voice_com/response.rb', line 7 def initialize(args = {}) args.each do |k,v| k = k.strip.gsub("\s", "") instance_variable_set("@#{k.strip}", v) end yield self if block_given? validate! parse_answer end |
Instance Attribute Details
#answer ⇒ Object
Returns the value of attribute answer.
4 5 6 |
# File 'lib/voice_com/response.rb', line 4 def answer @answer end |
#answer_hash ⇒ Object (readonly)
Returns the value of attribute answer_hash.
5 6 7 |
# File 'lib/voice_com/response.rb', line 5 def answer_hash @answer_hash end |
#dlr ⇒ Object
Returns the value of attribute dlr.
4 5 6 |
# File 'lib/voice_com/response.rb', line 4 def dlr @dlr end |
#from ⇒ Object
Returns the value of attribute from.
4 5 6 |
# File 'lib/voice_com/response.rb', line 4 def from @from end |
#sid ⇒ Object
Returns the value of attribute sid.
4 5 6 |
# File 'lib/voice_com/response.rb', line 4 def sid @sid end |
#smsID ⇒ Object
Returns the value of attribute smsID.
4 5 6 |
# File 'lib/voice_com/response.rb', line 4 def smsID @smsID end |
#to ⇒ Object
Returns the value of attribute to.
4 5 6 |
# File 'lib/voice_com/response.rb', line 4 def to @to end |
#ts ⇒ Object
Returns the value of attribute ts.
4 5 6 |
# File 'lib/voice_com/response.rb', line 4 def ts @ts end |
#voicecom_id ⇒ Object
Returns the value of attribute voicecom_id.
4 5 6 |
# File 'lib/voice_com/response.rb', line 4 def voicecom_id @voicecom_id end |
Instance Method Details
#get_answer ⇒ Object
25 26 27 |
# File 'lib/voice_com/response.rb', line 25 def get_answer Hash[@answer.split("+").map{|x| x.split(":")}] end |
#parse_answer ⇒ Object
21 22 23 |
# File 'lib/voice_com/response.rb', line 21 def parse_answer @answer_hash = get_answer end |
#sms_id ⇒ Object
17 18 19 |
# File 'lib/voice_com/response.rb', line 17 def sms_id @dlr end |
#success? ⇒ Boolean
30 31 32 |
# File 'lib/voice_com/response.rb', line 30 def success? dlr.to_i == 1 end |