Class: Taxii::Messages::Parameters::Poll

Inherits:
Hashie::Dash
  • Object
show all
Defined in:
lib/taxii/messages/parameters.rb

Instance Method Summary collapse

Instance Method Details

#response_type=(type) ⇒ Object



17
18
19
20
21
22
# File 'lib/taxii/messages/parameters.rb', line 17

def response_type=(type)
  unless %w{ FULL COUNT_ONLY }.include?(type)
    fail ArgumentError, "#{type} must be FULL or COUNT_ONLY"
  end
  @response_type=type
end

#to_hObject



24
25
26
27
28
29
# File 'lib/taxii/messages/parameters.rb', line 24

def to_h
  {
      '@allow_asynch':          allow_asynch,
      'taxii_11:Response_Type': response_type
  }
end

#to_xmlObject



30
31
32
33
34
35
36
37
38
# File 'lib/taxii/messages/parameters.rb', line 30

def to_xml
  content_hash = if content_binding.nil?
    self.to_h
  else
    self.to_h.merge('taxii_11:Content_Binding!': content_binding)
  end

  Gyoku.xml({'taxii_11:Poll_Parameters': content_hash}, key_converter: :none)
end