Class: Application
- Inherits:
-
Object
- Object
- Application
- Includes:
- AfricasTalking
- Defined in:
- lib/AfricasTalking/Application.rb
Constant Summary collapse
- HTTP_CREATED =
201- HTTP_OK =
200
Constants included from AfricasTalking
AfricasTalking::DEBUG, AfricasTalking::VERSION
Instance Method Summary collapse
- #fetchApplicationData ⇒ Object
-
#initialize(username, apikey) ⇒ Application
constructor
Set debug flag to to true to view response body.
Constructor Details
#initialize(username, apikey) ⇒ Application
Set debug flag to to true to view response body
7 8 9 10 |
# File 'lib/AfricasTalking/Application.rb', line 7 def initialize username, apikey @username = username @apikey = apikey end |
Instance Method Details
#fetchApplicationData ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/AfricasTalking/Application.rb', line 12 def fetchApplicationData url = getUserDataUrl() + '?username='+@username+'' response = sendNormalRequest(url) # if (@response_code == HTTP_OK ) result = JSON.parse(response, :quirky_mode =>true) return ApplicationDataResponse.new result["balance"] else raise AfricasTalkingException, response end end |