Class: Savon::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/savon/message.rb

Instance Method Summary collapse

Constructor Details

#initialize(message_tag, namespace_identifier, types, used_namespaces, message, element_form_default, key_converter, unwrap) ⇒ Message

Returns a new instance of Message.



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/savon/message.rb', line 8

def initialize(message_tag, namespace_identifier, types, used_namespaces, message, element_form_default, key_converter, unwrap)
  @message_tag = message_tag
  @namespace_identifier = namespace_identifier
  @types = types
  @used_namespaces = used_namespaces

  @message = message
  @element_form_default = element_form_default
  @key_converter = key_converter
  @unwrap = unwrap
end

Instance Method Details

#to_sObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/savon/message.rb', line 20

def to_s
  return @message.to_s unless @message.kind_of? Hash

  if @element_form_default == :qualified
    @message = QualifiedMessage.new(@types, @used_namespaces, @key_converter).to_hash(@message, [@message_tag.to_s])
  end

  gyoku_options = {
    :element_form_default => @element_form_default,
    :namespace            => @namespace_identifier,
    :key_converter        => @key_converter,
    :unwrap               => @unwrap
  }

  Gyoku.xml(@message, gyoku_options)
end