Class: ExetelSms::Deleter

Inherits:
Object
  • Object
show all
Extended by:
ClassMethods
Defined in:
lib/deleter.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ClassMethods

build_url, encode, exetel_url, matchurl?, new_reference_number, response_to_hash

Constructor Details

#initialize(config) ⇒ Deleter

Returns a new instance of Deleter.



8
9
10
# File 'lib/deleter.rb', line 8

def initialize(config)
  @config = config
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



7
8
9
# File 'lib/deleter.rb', line 7

def config
  @config
end

Class Method Details

.api_pathObject



32
33
34
# File 'lib/deleter.rb', line 32

def api_path
  'api_sms_mvn_delete.php'
end

.request_fieldsObject



28
29
30
# File 'lib/deleter.rb', line 28

def request_fields
  [:username, :password, :mobilenumber, :messageid]
end

.response_fieldsObject



24
25
26
# File 'lib/deleter.rb', line 24

def response_fields
  [:status, :notes]
end

Instance Method Details

#delete(from_mobile_number, message_id) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/deleter.rb', line 12

def delete(from_mobile_number, message_id)
  url = self.class.build_url(
    :username => @config.username,
    :password => @config.password,
    :mobilenumber => from_mobile_number,
    :messageid => message_id
  )
  
  self.class.response_to_hash(ExetelSms::Client.request(url))
end