Class: SmsRu::My

Inherits:
Object
  • Object
show all
Defined in:
lib/sms_ru/my.rb

Overview

Account information: balance, daily limit, free quota, and approved sender names. Reached via SmsRu#my, e.g. ‘client.my.balance`.

Instance Method Summary collapse

Constructor Details

#initialize(request) ⇒ My

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of My.

Parameters:

  • request (Method)

    the client’s bound ‘request` method



9
10
11
# File 'lib/sms_ru/my.rb', line 9

def initialize(request)
  @request = request
end

Instance Method Details

#balanceFloat

Returns the current account balance, in rubles.

Returns:

  • (Float)

    the current account balance, in rubles

Raises:



15
# File 'lib/sms_ru/my.rb', line 15

def balance = @request.call("/my/balance")["balance"]

#free_limitSmsRu::FreeLimit

Returns the free-message allowance and today’s usage.

Returns:

Raises:



23
# File 'lib/sms_ru/my.rb', line 23

def free_limit = FreeLimit.build(@request.call("/my/free"))

#limitSmsRu::Limit

Returns the daily sending limit and today’s usage.

Returns:

  • (SmsRu::Limit)

    the daily sending limit and today’s usage

Raises:



19
# File 'lib/sms_ru/my.rb', line 19

def limit = Limit.build(@request.call("/my/limit"))

#sendersArray<String>

Returns the approved sender names on the account.

Returns:

  • (Array<String>)

    the approved sender names on the account

Raises:



27
# File 'lib/sms_ru/my.rb', line 27

def senders = @request.call("/my/senders")["senders"] || []