Class: Cancel

Inherits:
Applications show all
Defined in:
lib/coolsms/cancel.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Applications

#fields, #set_fields

Constructor Details

#initialize(options = {}) ⇒ Cancel

Returns a new instance of Cancel.



9
10
11
# File 'lib/coolsms/cancel.rb', line 9

def initialize(options = {})
  self.set_fields( options )
end

Instance Attribute Details

#gidObject

Group Id



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

def gid
  @gid
end

#midObject

Message Id



4
5
6
# File 'lib/coolsms/cancel.rb', line 4

def mid
  @mid
end

Instance Method Details

#cancelObject



13
14
15
16
17
18
19
20
21
22
# File 'lib/coolsms/cancel.rb', line 13

def cancel
  fields = self.fields( :mid, :gid )
  res = Request.new.post( "cancel", fields )

  if res.code == "200"
    { ret: true }
  else
    { ret: res.code == "200", message: JSON.parse(res.body) }
  end
end