Class: XMLServiceAdapters::RESTAdapter

Inherits:
AbstractAdapter show all
Defined in:
lib/adapters/rest_adapter.rb

Instance Method Summary collapse

Methods inherited from AbstractAdapter

#initialize, #out_doc, #out_xml, #raw_connection, #raw_options

Constructor Details

This class inherits a constructor from XMLServiceAdapters::AbstractAdapter

Instance Method Details

#adapter_nameObject



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

def adapter_name
  'XMLSERVICE_REST'
end

#xmlservice(callme) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/adapters/rest_adapter.rb', line 10

def xmlservice(callme)
  xmlin = ""
  xmlin << @xml_head
  xmlin << "\n<myscript>\n"
  xmlin << callme.to_xml
  xmlin << "</myscript>\n"
  xmlout = ""
  post_args = { 
   :db2 => @xml_database,
   :uid => @xml_username,
   :pwd => @xml_password,
   :ipc => @xml_ipc,
   :ctl => @xml_ctl,
   :xmlin => URI::encode(xmlin),
   :xmlout => @xml_size
  }
  uri = URI(@xml_conn)
  res = Net::HTTP.post_form(uri, post_args)
  @xml_xmlout = res.body
  @xml_doc = nil
end