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, 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

.exetel_urlObject



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

def exetel_url
  'https://smsgw.exetel.com.au/sendsms/api_sms_mvn_delete.php?'
end

.request_fieldsObject



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

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

.response_fieldsObject



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

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
  )
  
  response_to_hash(ExetelSms::Client.request(url))
end