class Savon::Header

Attributes

global_header[R]
gyoku_options[R]
local_header[R]
wsse_auth[R]
wsse_timestamp[R]

Public Class Methods

new(globals, locals) click to toggle source
# File lib/savon/header.rb, line 7
def initialize(globals, locals)
  @gyoku_options  = { :key_converter => globals[:convert_request_keys_to] }

  @wsse_auth      = globals[:wsse_auth]
  @wsse_timestamp = globals[:wsse_timestamp]

  @global_header  = globals[:soap_header]
  @local_header   = locals[:soap_header]

  @header = build
end

Public Instance Methods

empty?() click to toggle source
# File lib/savon/header.rb, line 22
def empty?
  @header.empty?
end
to_s() click to toggle source
# File lib/savon/header.rb, line 26
def to_s
  @header
end

Private Instance Methods

akami() click to toggle source
# File lib/savon/header.rb, line 62
def akami
  wsse = Akami.wsse
  wsse.credentials(*wsse_auth) if wsse_auth
  wsse.timestamp = wsse_timestamp if wsse_timestamp
  wsse
end
build() click to toggle source
# File lib/savon/header.rb, line 32
def build
  build_header + build_wsse_header
end
build_header() click to toggle source
# File lib/savon/header.rb, line 36
def build_header
  header =
    if global_header.kind_of?(Hash) && local_header.kind_of?(Hash)
      global_header.merge(local_header)
    elsif local_header
      local_header
    else
      global_header
    end

  convert_to_xml(header)
end
build_wsse_header() click to toggle source
# File lib/savon/header.rb, line 49
def build_wsse_header
  wsse_header = akami
  wsse_header.respond_to?(:to_xml) ? wsse_header.to_xml : ""
end
convert_to_xml(hash_or_string) click to toggle source
# File lib/savon/header.rb, line 54
def convert_to_xml(hash_or_string)
  if hash_or_string.kind_of? Hash
    Gyoku.xml(hash_or_string, gyoku_options)
  else
    hash_or_string.to_s
  end
end