Module: Smslist::Client::Balance

Included in:
Smslist::Client
Defined in:
lib/smslist/client/balance.rb

Instance Method Summary collapse

Instance Method Details

#balanceFloat

Get account balance

Examples:

Get balance for user qwerty

client = Smslist.new(login: 'qwerty', password: 'secret')
client.balance

Returns:

  • (Float)

    account balance



10
11
12
13
# File 'lib/smslist/client/balance.rb', line 10

def balance
  response = parse_xml(post build_xml_body.to_xml, :balance)
  response.xpath('response/money').text.to_f
end

#remaining_smsInteger

Get remaining sms count

Examples:

Get remaining sms count for user qwerty

client = Smslist.new(login: 'qwerty', password: 'secret')
client.remaining_sms

Returns:

  • (Integer)

    remaining sms count



21
22
23
24
# File 'lib/smslist/client/balance.rb', line 21

def remaining_sms
  response = parse_xml(post build_xml_body.to_xml, :balance)
  response.xpath('response/sms').first.text.to_i
end