Class: SMSBox::Client
- Inherits:
-
Object
- Object
- SMSBox::Client
- Defined in:
- lib/sms_box/client.rb
Instance Attribute Summary collapse
-
#password ⇒ Object
Returns the value of attribute password.
-
#url ⇒ Object
Returns the value of attribute url.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
Instance Attribute Details
#password ⇒ Object
Returns the value of attribute password.
10 11 12 |
# File 'lib/sms_box/client.rb', line 10 def password @password end |
#url ⇒ Object
Returns the value of attribute url.
9 10 11 |
# File 'lib/sms_box/client.rb', line 9 def url @url end |
#username ⇒ Object
Returns the value of attribute username.
10 11 12 |
# File 'lib/sms_box/client.rb', line 10 def username @username end |
Instance Method Details
#request(request) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/sms_box/client.rb', line 20 def request(request) unless request.is_a? XMLRequest raise "Invalid request" end request.username = username request.password = password xml = RestClient.post url, request.to_xml, :content_type => "text/xml" response = XMLResponse.from_xml(xml) response.request = request response end |
#request!(request) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/sms_box/client.rb', line 12 def request!(request) response = request(request) if response.error? raise ResponseException.new(response.error, response) end response end |