Class: SmsGetValidatedNumbersResponse
- Inherits:
-
BasicResponse
- Object
- BasicResponse
- SmsGetValidatedNumbersResponse
- Defined in:
- lib/sms_service/sms_get_validated_numbers_response.rb
Overview
Representing a response from the SmsService
.
Instance Attribute Summary collapse
-
#validated_numbers ⇒ Object
Returns the value of attribute validated_numbers.
Attributes inherited from BasicResponse
Instance Method Summary collapse
-
#initialize(response_xml, raise_exception_on_error = true) ⇒ SmsGetValidatedNumbersResponse
constructor
Constructor.
Methods inherited from BasicResponse
#inizialize, #raise_on_error, #to_s
Constructor Details
#initialize(response_xml, raise_exception_on_error = true) ⇒ SmsGetValidatedNumbersResponse
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.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/sms_service/sms_get_validated_numbers_response.rb', line 12 def initialize(response_xml, raise_exception_on_error = true) doc = response_xml.document @error_code = doc.xpath("//statusCode").to_s @error_message = doc.xpath("//statusMessage").to_s @validated_numbers = [] validated_numbers_xml = doc.xpath("//validatedNumbers") if validated_numbers_xml.is_a?(Handsoap::XmlQueryFront::NodeSelection) then validated_numbers_xml.each do |validated_number_xml| validated_number = ValidatedNumber.build_from_xml(validated_number_xml) validated_numbers << validated_number end else raise "Unexpected response format." end raise_on_error(response_xml) if raise_exception_on_error end |
Instance Attribute Details
#validated_numbers ⇒ Object
Returns the value of attribute validated_numbers.
6 7 8 |
# File 'lib/sms_service/sms_get_validated_numbers_response.rb', line 6 def validated_numbers @validated_numbers end |