Class: Sms

Inherits:
Object
  • Object
show all
Defined in:
lib/brTerminacoes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(usuario, senha) ⇒ Sms

Returns a new instance of Sms.



7
8
9
10
11
12
13
# File 'lib/brTerminacoes.rb', line 7

def initialize(usuario, senha)
  @usuario = usuario
  @senha = senha
  @uri = URI('http://webapi.comtele.com.br/api/api_fuse_connection.php')
  @params = { :fuse => 'get_id', :user => @usuario, :pwd => @senha }
  @id = conectar(@params)
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/brTerminacoes.rb', line 5

def id
  @id
end

#senhaObject (readonly)

Returns the value of attribute senha.



5
6
7
# File 'lib/brTerminacoes.rb', line 5

def senha
  @senha
end

#usuarioObject (readonly)

Returns the value of attribute usuario.



5
6
7
# File 'lib/brTerminacoes.rb', line 5

def usuario
  @usuario
end

Instance Method Details

#enviar(remetente, mensagem, numeros) ⇒ Object



20
21
22
23
# File 'lib/brTerminacoes.rb', line 20

def enviar(remetente, mensagem, numeros)
  @params = { :fuse => 'send_msg', :id => @id, :from => remetente, :msg => mensagem, :number => numeros }
  conectar(@params)
end

#relatorio(data_inicial, data_final, modo) ⇒ Object



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

def relatorio(data_inicial, data_final, modo)
 @params = { :fuse => 'get_report', :id => @id, :dt_begin => data_inicial, :dt_end => data_final, :mode => modo }
  conectar(@params)
end

#saldoObject



15
16
17
18
# File 'lib/brTerminacoes.rb', line 15

def saldo()
  @params = { :fuse => 'get_balance', :id => @id}
  conectar(@params)
end