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) ⇒ Message

Returns a new instance of Message.



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

def initialize(message_tag, namespace_identifier, types, used_namespaces, message, element_form_default, key_converter)
  @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
end

Instance Method Details

#to_sObject



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

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
  }

  Gyoku.xml(@message, gyoku_options)
end