Class: ONVIF::Message
- Inherits:
-
Object
- Object
- ONVIF::Message
- Defined in:
- lib/ruby_onvif_client/message.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
writeonly
Sets the attribute body.
Instance Method Summary collapse
- #header ⇒ Object
-
#initialize(options = {}) ⇒ Message
constructor
A new instance of Message.
- #to_s ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Message
Returns a new instance of Message.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/ruby_onvif_client/message.rb', line 9 def initialize = {} @options = { username: 'admin', password: 'admin', namespaces: {} }.merge() @namespaces = { :'xmlns:soap' => "http://www.w3.org/2003/05/soap-envelope", :'xmlns:wsdl' => "http://www.onvif.org/ver10/device/wsdl" }.merge(@options[:namespaces]) end |
Instance Attribute Details
#body=(value) ⇒ Object (writeonly)
Sets the attribute body
7 8 9 |
# File 'lib/ruby_onvif_client/message.rb', line 7 def body=(value) @body = value end |
Instance Method Details
#header ⇒ Object
22 23 24 25 26 27 |
# File 'lib/ruby_onvif_client/message.rb', line 22 def header wsse = Akami.wsse wsse.credentials(@options[:username], @options[:password]) wsse.created_at = Time.now wsse.to_xml end |
#to_s ⇒ Object
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/ruby_onvif_client/message.rb', line 29 def to_s Builder::XmlMarkup.new(indent: 4).soap(:Envelope, @namespaces) do |xml| xml.soap(:Header) do xml << header end xml.soap(:Body) do @body.call(xml) if @body.class == Proc end end end |