Class: LolSoap::Request
- Inherits:
-
Object
- Object
- LolSoap::Request
- Defined in:
- lib/lolsoap/request.rb
Overview
Represents a HTTP request containing a SOAP Envelope
Instance Attribute Summary collapse
-
#envelope ⇒ Object
readonly
Returns the value of attribute envelope.
-
#xml_options ⇒ Object
Returns the value of attribute xml_options.
Instance Method Summary collapse
- #body(&block) ⇒ Object
-
#charset ⇒ Object
The charset of the request.
-
#content ⇒ Object
The content to be sent in the HTTP request.
-
#content_type ⇒ Object
The full content type of the request, assembled from the #mime and #charset.
- #header(&block) ⇒ Object
-
#headers ⇒ Object
Headers that must be set when making the request.
-
#initialize(envelope) ⇒ Request
constructor
A new instance of Request.
-
#input_type ⇒ Object
The type of the element sent in the request body.
-
#mime ⇒ Object
The MIME type of the request.
-
#output_type ⇒ Object
The type of the element that will be received in the response body.
-
#soap_namespace ⇒ Object
Namespace used for SOAP envelope tags.
-
#soap_version ⇒ Object
The SOAP version in use.
-
#url ⇒ Object
URL to be POSTed to.
Constructor Details
#initialize(envelope) ⇒ Request
Returns a new instance of Request.
7 8 9 10 |
# File 'lib/lolsoap/request.rb', line 7 def initialize(envelope) @envelope = envelope = end |
Instance Attribute Details
#envelope ⇒ Object (readonly)
Returns the value of attribute envelope.
4 5 6 |
# File 'lib/lolsoap/request.rb', line 4 def envelope @envelope end |
#xml_options ⇒ Object
Returns the value of attribute xml_options.
5 6 7 |
# File 'lib/lolsoap/request.rb', line 5 def end |
Instance Method Details
#body(&block) ⇒ Object
13 14 15 |
# File 'lib/lolsoap/request.rb', line 13 def body(&block) envelope.body(&block) end |
#charset ⇒ Object
The charset of the request. This is always UTF-8, but it could be overridden in a subclass.
59 60 61 |
# File 'lib/lolsoap/request.rb', line 59 def charset 'UTF-8' end |
#content ⇒ Object
The content to be sent in the HTTP request
79 80 81 |
# File 'lib/lolsoap/request.rb', line 79 def content @content ||= envelope.to_xml() end |
#content_type ⇒ Object
The full content type of the request, assembled from the #mime and #charset.
65 66 67 |
# File 'lib/lolsoap/request.rb', line 65 def content_type "#{mime};charset=#{charset}" end |
#header(&block) ⇒ Object
18 19 20 |
# File 'lib/lolsoap/request.rb', line 18 def header(&block) envelope.header(&block) end |
#headers ⇒ Object
Headers that must be set when making the request
70 71 72 73 74 75 76 |
# File 'lib/lolsoap/request.rb', line 70 def headers { 'Content-Type' => content_type, 'Content-Length' => content.bytesize.to_s, 'SOAPAction' => envelope.action } end |
#input_type ⇒ Object
The type of the element sent in the request body
38 39 40 |
# File 'lib/lolsoap/request.rb', line 38 def input_type envelope.input_body_content_type end |
#mime ⇒ Object
The MIME type of the request. This is always application/soap+xml, but it could be overridden in a subclass.
49 50 51 52 53 54 55 |
# File 'lib/lolsoap/request.rb', line 49 def mime if soap_version == '1.1' 'text/xml' else 'application/soap+xml' end end |
#output_type ⇒ Object
The type of the element that will be received in the response body
43 44 45 |
# File 'lib/lolsoap/request.rb', line 43 def output_type envelope.output_body_content_type end |
#soap_namespace ⇒ Object
Namespace used for SOAP envelope tags
23 24 25 |
# File 'lib/lolsoap/request.rb', line 23 def soap_namespace envelope.soap_namespace end |
#soap_version ⇒ Object
The SOAP version in use
28 29 30 |
# File 'lib/lolsoap/request.rb', line 28 def soap_version envelope.soap_version end |
#url ⇒ Object
URL to be POSTed to
33 34 35 |
# File 'lib/lolsoap/request.rb', line 33 def url envelope.endpoint end |