Class: Soaspec::SoapRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/soaspec/exchange_handlers/request/soap_request.rb

Overview

Models a request made to a SOAP API

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(operation, body, request_option) ⇒ SoapRequest

Returns a new instance of SoapRequest.

Parameters:

  • operation (Symbol)

    Soap operation used

  • body (Hash)

    Hash with method of SOAP generated contained

  • request_option (Symbol)

    Method of building the request (:hash, :template)



22
23
24
25
26
# File 'lib/soaspec/exchange_handlers/request/soap_request.rb', line 22

def initialize(operation, body, request_option)
  self.body = body
  self.operation = operation
  self.request_option = request_option
end

Instance Attribute Details

#bodyHash

Hash representing what will be sent to Savon. Either the exact xml (if using a template) or a message Hash that will be converted to XML by Savon

Examples:

{ xml: "<env:Envelope xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" ...</env:Body>\n</env:Envelope> " }

Returns:

  • (Hash)

    Body of request sent



13
14
15
# File 'lib/soaspec/exchange_handlers/request/soap_request.rb', line 13

def body
  @body
end

#operationSymbol

Returns SOAP operation used.

Examples:

SOAP operation

:login

Returns:

  • (Symbol)

    SOAP operation used



7
8
9
# File 'lib/soaspec/exchange_handlers/request/soap_request.rb', line 7

def operation
  @operation
end

#request_optionSymbol

Returns Method of building the request (:hash, :template).

Returns:

  • (Symbol)

    Method of building the request (:hash, :template)



15
16
17
# File 'lib/soaspec/exchange_handlers/request/soap_request.rb', line 15

def request_option
  @request_option
end

#test_nameString

Returns Name given to test to describe it.

Returns:

  • (String)

    Name given to test to describe it



17
18
19
# File 'lib/soaspec/exchange_handlers/request/soap_request.rb', line 17

def test_name
  @test_name
end

Instance Method Details

#[](value) ⇒ Object

Returns Result of retrieving value.

Parameters:

  • value (String, Symbol)

    Message to send to object retrieving a value

Returns:

  • (Object)

    Result of retrieving value



30
31
32
# File 'lib/soaspec/exchange_handlers/request/soap_request.rb', line 30

def [](value)
  self.send(value)
end

#to_sString

Returns Show inspection of all parameters.

Returns:

  • (String)

    Show inspection of all parameters



35
36
37
# File 'lib/soaspec/exchange_handlers/request/soap_request.rb', line 35

def to_s
  inspect
end