Class: SmsNotify::SoapResponse
- Inherits:
-
Object
- Object
- SmsNotify::SoapResponse
- Defined in:
- lib/sms_notify/soap_response.rb
Instance Attribute Summary collapse
-
#soap_response ⇒ Object
Returns the value of attribute soap_response.
Instance Method Summary collapse
-
#initialize(soap_mapping_object) ⇒ SoapResponse
constructor
Retrieve the underlying soap object from the wsdl driver.
-
#soap_mapping_attributes ⇒ Object
Grab all the getter methods defined for the attributes of the underlying soap response object.
-
#to_hash ⇒ Object
Convert this objects attributes to ruby like hash.
Constructor Details
#initialize(soap_mapping_object) ⇒ SoapResponse
Retrieve the underlying soap object from the wsdl driver.
7 8 9 10 11 12 13 |
# File 'lib/sms_notify/soap_response.rb', line 7 def initialize(soap_mapping_object) @soap_response = soap_mapping_object.send( soap_mapping_object.singleton_methods.delete_if { |m| m =~ /=$/ }.first ) end |
Instance Attribute Details
#soap_response ⇒ Object
Returns the value of attribute soap_response.
3 4 5 |
# File 'lib/sms_notify/soap_response.rb', line 3 def soap_response @soap_response end |
Instance Method Details
#soap_mapping_attributes ⇒ Object
Grab all the getter methods defined for the attributes of the underlying soap response object.
29 30 31 32 33 |
# File 'lib/sms_notify/soap_response.rb', line 29 def soap_mapping_attributes self.soap_response.singleton_methods.delete_if { |m| m =~ /=$/ } end |
#to_hash ⇒ Object
Convert this objects attributes to ruby like hash.
17 18 19 20 21 22 23 24 25 |
# File 'lib/sms_notify/soap_response.rb', line 17 def to_hash response_hash = {} soap_mapping_attributes.each { |attr| response_hash.merge!( attr.underscore.to_sym => self.soap_response.send(attr) ) } response_hash end |