Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Return the result code and message.

  • Loading branch information...
commit ae77249f85f0ecf22348b14a86858f3c03eb1302 1 parent f3b2cf0
@alloy alloy authored
Showing with 17 additions and 1 deletion.
  1. +1 −0  TODO
  2. +8 −0 lib/mollie/sms.rb
  3. +8 −1 spec/sms_spec.rb
View
1  TODO
@@ -1 +1,2 @@
* do we need the charged amount after each sms?
+* use HTTPS?
View
8 lib/mollie/sms.rb
@@ -62,6 +62,14 @@ def params
@params ||= Hash.from_xml(@http_response.read_body)['response']['item']
end
+ def result_code
+ params['resultcode'].to_i
+ end
+
+ def message
+ params['resultmessage']
+ end
+
def success?
@http_response.is_a?(Net::HTTPSuccess) && params['success'] == 'true'
end
View
9 spec/sms_spec.rb
@@ -153,8 +153,15 @@ class ResponseStub
it "returns whether or not it was a success" do
@response.should.be.success
- @response.stubs(:params).returns('resultcode' => '20', 'success' => 'false')
+ @response.stubs(:params).returns('success' => 'false')
@response.should.not.be.success
end
+ it "returns the result code" do
+ @response.result_code.should == 10
+ end
+
+ it "returns the message corresponding to the result code" do
+ @response.message.should == "Message successfully sent."
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.