Class: SmsResponse

Inherits:
BasicResponse show all
Defined in:
lib/sms_service/sms_response.rb

Overview

Representing a response from the SmsService.

Instance Attribute Summary

Attributes inherited from BasicResponse

#error_code, #error_message

Instance Method Summary collapse

Methods inherited from BasicResponse

#inizialize, #raise_on_error, #to_s

Constructor Details

#initialize(response_xml, raise_exception_on_error = true) ⇒ SmsResponse

Constructor.

Parameters

response_xml

Xml as returned by a sms_status-method call.

raise_exception_on_error

Xml as returned by a sms_status-method call.



10
11
12
13
14
15
16
17
# File 'lib/sms_service/sms_response.rb', line 10

def initialize(response_xml, raise_exception_on_error = true)
  doc = response_xml.document

  @error_code      = doc.xpath("//status").text
  @error_message   = doc.xpath("//description").text

  raise_on_error(response_xml) if raise_exception_on_error
end