Class: Avmtrf1::Red::Client

Inherits:
Object
  • Object
show all
Includes:
Helper
Defined in:
lib/avmtrf1/red/client.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Helper

#check_request_result, #http_client, #post, #post_xml, #xml_content, #xml_path

Constructor Details

#initialize(server, parametros) ⇒ Client

Returns a new instance of Client.



24
25
26
27
28
29
30
# File 'lib/avmtrf1/red/client.rb', line 24

def initialize(server, parametros)
  @server = server
  @login = parametros.fetch('login')
  @ip = parametros.fetch('ip')
  @sistema = parametros.fetch('sistema')
  @nome_maquina = parametros.fetch('nomeMaquina')
end

Instance Attribute Details

#ipObject (readonly)

Returns the value of attribute ip.



22
23
24
# File 'lib/avmtrf1/red/client.rb', line 22

def ip
  @ip
end

#loginObject (readonly)

Returns the value of attribute login.



22
23
24
# File 'lib/avmtrf1/red/client.rb', line 22

def 
  @login
end

#nome_maquinaObject (readonly)

Returns the value of attribute nome_maquina.



22
23
24
# File 'lib/avmtrf1/red/client.rb', line 22

def nome_maquina
  @nome_maquina
end

#serverObject (readonly)

Returns the value of attribute server.



22
23
24
# File 'lib/avmtrf1/red/client.rb', line 22

def server
  @server
end

#sistemaObject (readonly)

Returns the value of attribute sistema.



22
23
24
# File 'lib/avmtrf1/red/client.rb', line 22

def sistema
  @sistema
end

Class Method Details

.by_ini_profile(ini_profile) ⇒ Object



14
15
16
17
18
19
# File 'lib/avmtrf1/red/client.rb', line 14

def by_ini_profile(ini_profile)
  ::Avmtrf1::Red::Client.new(
    ::Avmtrf1::Red::Server.by_ini_profile(ini_profile),
    ini_profile.to_h('parametros.')
  )
end

Instance Method Details

#authorization_urlObject



32
33
34
35
# File 'lib/avmtrf1/red/client.rb', line 32

def authorization_url
  xml = post_xml('/REDCentral/autorizacaoinclusao', xml_content('authorization'))
  xml.at_xpath('/root/retornoSolicitacaoInclusao/@url')
end