Class: Textmagic::REST::Unsubscribers

Inherits:
ListResource show all
Defined in:
lib/textmagic-ruby/rest/unsubscribers.rb

Instance Method Summary collapse

Methods inherited from ListResource

#initialize, #inspect

Methods included from Utils

#key_map, #resource, #to_camel_case, #to_underscore_case

Constructor Details

This class inherits a constructor from Textmagic::REST::ListResource

Instance Method Details

#create(params = {}) ⇒ Object

Unsubscribe phone from your communication by phone number. Returns Unsubscriber object contains id and link to new Unsubscriber.

The following params keys are supported:

phone

Phone number you want to unsubscribe. Required.

Example:

@unsubscriber = client.unsubscribers.create {:phone => '999920102'}


30
31
32
# File 'lib/textmagic-ruby/rest/unsubscribers.rb', line 30

def create(params={})
  super params
end

#delete(uid) ⇒ Object

Deleting is not supported.



58
59
60
# File 'lib/textmagic-ruby/rest/unsubscribers.rb', line 58

def delete(uid)
  raise '`delete` method is not available for this type of resource.'
end

#get(uid) ⇒ Object

Get unsubscriber by ID. Returns Unsubscriber object.

uid

Unsubscriber ID. Required.

Example:

@unsubscriber = client.unsubscribers.get 987


14
15
16
# File 'lib/textmagic-ruby/rest/unsubscribers.rb', line 14

def get(uid)
  super uid
end

#list(params = {}) ⇒ Object

Get all user unsubscribers. Returns PaginateResource object, contains array of Unsubscriber objects.

The following params keys are supported:

page

Fetch specified results page. Defaults 1

limit

How many results on page. Defaults 10

Example:

@unsubscribers = client.unsubscribers.list


48
49
50
51
52
53
# File 'lib/textmagic-ruby/rest/unsubscribers.rb', line 48

def list(params={})
  [:search, 'search'].each do |search|
    params.delete search
  end
  super params
end

#update(uid, params = {}) ⇒ Object

Updating is not supported.



65
66
67
# File 'lib/textmagic-ruby/rest/unsubscribers.rb', line 65

def update(uid, params={})
  raise '`update` method is not available for this type of resource.'
end