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.



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

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



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

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

Instance Attribute Details

#clsidObject (readonly)

Returns the value of attribute clsid



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

def clsid
  @clsid
end

#dispatchObject (readonly)

Returns the value of attribute dispatch



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

def dispatch
  @dispatch
end

#lastargsObject (readonly)

Returns the value of attribute lastargs



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

def lastargs
  @lastargs
end

#progidObject (readonly)

Returns the value of attribute progid



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

def progid
  @progid
end

Instance Method Details

#abortObject

VOID abort Abort HTTP request



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

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

#getAllResponseHeadersObject

BSTR getAllResponseHeaders Get all HTTP response headers



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

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

#getResponseHeader(arg0) ⇒ Object

BSTR getResponseHeader Get HTTP response header

BSTR arg0 --- bstrHeader [IN]


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

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



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

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]


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

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



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

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

#responseBodyObject

VARIANT responseBody Get response body



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

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

#responseStreamObject

VARIANT responseStream Get response body



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

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

#responseTextObject

BSTR responseText Get response body



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

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

#responseXMLObject

DISPATCH responseXML Get response body



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

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

#send(arg0 = nil) ⇒ Object

VOID send Send HTTP request

VARIANT arg0 --- varBody [IN]


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

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]


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

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



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

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

#statusTextObject

BSTR statusText Get HTTP status text



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

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