Class: Microsoft_XMLHTTP_1

Inherits:
Object
  • Object
show all
Includes:
WIN32OLE::VARIANT
Defined in:
sample/xml.rb

Overview

XML HTTP Request class.

Constant Summary

Constants included from WIN32OLE::VARIANT

WIN32OLE::VARIANT::VT_ARRAY, WIN32OLE::VARIANT::VT_BOOL, WIN32OLE::VARIANT::VT_BSTR, WIN32OLE::VARIANT::VT_BYREF, WIN32OLE::VARIANT::VT_CY, WIN32OLE::VARIANT::VT_DATE, WIN32OLE::VARIANT::VT_DISPATCH, WIN32OLE::VARIANT::VT_EMPTY, WIN32OLE::VARIANT::VT_ERROR, WIN32OLE::VARIANT::VT_I1, WIN32OLE::VARIANT::VT_I2, WIN32OLE::VARIANT::VT_I4, WIN32OLE::VARIANT::VT_I8, WIN32OLE::VARIANT::VT_INT, WIN32OLE::VARIANT::VT_NULL, WIN32OLE::VARIANT::VT_PTR, WIN32OLE::VARIANT::VT_R4, WIN32OLE::VARIANT::VT_R8, WIN32OLE::VARIANT::VT_UI1, WIN32OLE::VARIANT::VT_UI2, WIN32OLE::VARIANT::VT_UI4, WIN32OLE::VARIANT::VT_UI8, WIN32OLE::VARIANT::VT_UINT, WIN32OLE::VARIANT::VT_UNKNOWN, WIN32OLE::VARIANT::VT_USERDEFINED, WIN32OLE::VARIANT::VT_VARIANT

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(obj = nil) ⇒ Microsoft_XMLHTTP_1

Returns a new instance of Microsoft_XMLHTTP_1



6992
6993
6994
6995
6996
6997
6998
6999
7000
# File 'sample/xml.rb', line 6992

def initialize(obj = nil)
  @clsid = "{ED8C108E-4349-11D2-91A4-00C04F7969E8}"
  @progid = "Microsoft.XMLHTTP.1"
  if obj.nil?
    @dispatch = WIN32OLE.new(@progid)
  else
    @dispatch = obj
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(cmd, *arg) ⇒ Object



7002
7003
7004
# File 'sample/xml.rb', line 7002

def method_missing(cmd, *arg)
  @dispatch.method_missing(cmd, *arg)
end

Instance Attribute Details

#clsidObject (readonly)

Returns the value of attribute clsid



6989
6990
6991
# File 'sample/xml.rb', line 6989

def clsid
  @clsid
end

#dispatchObject (readonly)

Returns the value of attribute dispatch



6988
6989
6990
# File 'sample/xml.rb', line 6988

def dispatch
  @dispatch
end

#lastargsObject (readonly)

Returns the value of attribute lastargs



6987
6988
6989
# File 'sample/xml.rb', line 6987

def lastargs
  @lastargs
end

#progidObject (readonly)

Returns the value of attribute progid



6990
6991
6992
# File 'sample/xml.rb', line 6990

def progid
  @progid
end

Instance Method Details

#abortObject

VOID abort Abort HTTP request



7121
7122
7123
7124
7125
# File 'sample/xml.rb', line 7121

def abort()
  ret = @dispatch._invoke(6, [], [])
  @lastargs = WIN32OLE::ARGV
  ret
end

#getAllResponseHeadersObject

BSTR getAllResponseHeaders Get all HTTP response headers



7104
7105
7106
7107
7108
# File 'sample/xml.rb', line 7104

def getAllResponseHeaders()
  ret = @dispatch._invoke(4, [], [])
  @lastargs = WIN32OLE::ARGV
  ret
end

#getResponseHeader(arg0) ⇒ Object

BSTR getResponseHeader Get HTTP response header

BSTR arg0 --- bstrHeader [IN]


7096
7097
7098
7099
7100
# File 'sample/xml.rb', line 7096

def getResponseHeader(arg0)
  ret = @dispatch._invoke(3, [arg0], [VT_BSTR])
  @lastargs = WIN32OLE::ARGV
  ret
end

#onreadystatechange=(arg0) ⇒ Object

VOID onreadystatechange Register a complete event handler



7064
7065
7066
7067
7068
# File 'sample/xml.rb', line 7064

def onreadystatechange=(arg0)
  ret = @dispatch._setproperty(14, [arg0], [VT_VARIANT])
  @lastargs = WIN32OLE::ARGV
  ret
end

#open(arg0, arg1, arg2 = nil, arg3 = nil, arg4 = nil) ⇒ Object

VOID open Open HTTP connection

BSTR arg0 --- bstrMethod [IN]
BSTR arg1 --- bstrUrl [IN]
VARIANT arg2 --- varAsync [IN]
VARIANT arg3 --- bstrUser [IN]
VARIANT arg4 --- bstrPassword [IN]


7077
7078
7079
7080
7081
# File 'sample/xml.rb', line 7077

def open(arg0, arg1, arg2=nil, arg3=nil, arg4=nil)
  ret = @dispatch._invoke(1, [arg0, arg1, arg2, arg3, arg4], [VT_BSTR, VT_BSTR, VT_VARIANT, VT_VARIANT, VT_VARIANT])
  @lastargs = WIN32OLE::ARGV
  ret
end

#readyStateObject

I4 readyState Get ready state



7056
7057
7058
7059
7060
# File 'sample/xml.rb', line 7056

def readyState()
  ret = @dispatch._getproperty(13, [], [])
  @lastargs = WIN32OLE::ARGV
  ret
end

#responseBodyObject

VARIANT responseBody Get response body



7040
7041
7042
7043
7044
# File 'sample/xml.rb', line 7040

def responseBody()
  ret = @dispatch._getproperty(11, [], [])
  @lastargs = WIN32OLE::ARGV
  ret
end

#responseStreamObject

VARIANT responseStream Get response body



7048
7049
7050
7051
7052
# File 'sample/xml.rb', line 7048

def responseStream()
  ret = @dispatch._getproperty(12, [], [])
  @lastargs = WIN32OLE::ARGV
  ret
end

#responseTextObject

BSTR responseText Get response body



7032
7033
7034
7035
7036
# File 'sample/xml.rb', line 7032

def responseText()
  ret = @dispatch._getproperty(10, [], [])
  @lastargs = WIN32OLE::ARGV
  ret
end

#responseXMLObject

DISPATCH responseXML Get response body



7024
7025
7026
7027
7028
# File 'sample/xml.rb', line 7024

def responseXML()
  ret = @dispatch._getproperty(9, [], [])
  @lastargs = WIN32OLE::ARGV
  ret
end

#send(arg0 = nil) ⇒ Object

VOID send Send HTTP request

VARIANT arg0 --- varBody [IN]


7113
7114
7115
7116
7117
# File 'sample/xml.rb', line 7113

def send(arg0=nil)
  ret = @dispatch._invoke(5, [arg0], [VT_VARIANT])
  @lastargs = WIN32OLE::ARGV
  ret
end

#setRequestHeader(arg0, arg1) ⇒ Object

VOID setRequestHeader Add HTTP request header

BSTR arg0 --- bstrHeader [IN]
BSTR arg1 --- bstrValue [IN]


7087
7088
7089
7090
7091
# File 'sample/xml.rb', line 7087

def setRequestHeader(arg0, arg1)
  ret = @dispatch._invoke(2, [arg0, arg1], [VT_BSTR, VT_BSTR])
  @lastargs = WIN32OLE::ARGV
  ret
end

#statusObject

I4 status Get HTTP status code



7008
7009
7010
7011
7012
# File 'sample/xml.rb', line 7008

def status()
  ret = @dispatch._getproperty(7, [], [])
  @lastargs = WIN32OLE::ARGV
  ret
end

#statusTextObject

BSTR statusText Get HTTP status text



7016
7017
7018
7019
7020
# File 'sample/xml.rb', line 7016

def statusText()
  ret = @dispatch._getproperty(8, [], [])
  @lastargs = WIN32OLE::ARGV
  ret
end