Class: SerwerSMS::Resources::Blacklist

Inherits:
Object
  • Object
show all
Defined in:
lib/serwersms/resources/blacklist.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Blacklist

Returns a new instance of Blacklist.



4
5
6
# File 'lib/serwersms/resources/blacklist.rb', line 4

def initialize(client)
  @client = client
end

Instance Method Details

#add(phone) ⇒ Hash

Add phone to the blacklist

Parameters:

  • phone (String)

Returns:

  • (Hash)

    @option return [Boolean] :success @option return [Integer] :id



14
15
16
# File 'lib/serwersms/resources/blacklist.rb', line 14

def add(phone)
  @client.call('blacklist/add', 'phone' => phone)
end

#check(phone) ⇒ Hash

Check if phone is blacklisted

Parameters:

  • phone (String)

Returns:

  • (Hash)

    @option return [Boolean] :exists



41
42
43
# File 'lib/serwersms/resources/blacklist.rb', line 41

def check(phone)
  @client.call('blacklist/check', 'phone' => phone)
end

#delete(phone) ⇒ Hash

Delete phone from the blacklist

Parameters:

  • phone (String)

Returns:

  • (Hash)

    @option return [Boolean] :success



50
51
52
# File 'lib/serwersms/resources/blacklist.rb', line 50

def delete(phone)
  @client.call('blacklist/delete', 'phone' => phone)
end

#index(phone = nil, params = {}) ⇒ Hash

List of blacklisted phones

Parameters:

  • phone (String) (defaults to: nil)
  • params (Hash) (defaults to: {})

    @option params [Integer] :page The number of the displayed page @option params [Integer] :limit Limit items displayed on single page

Returns:

  • (Hash)

    @option return [Hash] :paging @option paging [Integer] :page The number of current page @option paging [Integer] :count The number of all pages @option return [Array] :items @option item [String] :phone @option item [String] :added Date of adding phone



31
32
33
34
# File 'lib/serwersms/resources/blacklist.rb', line 31

def index(phone = nil, params = {})
  params['phone'] = phone
  @client.call('blacklist/index', params)
end