Class: OpenRosa::FormList
- Inherits:
-
Object
- Object
- OpenRosa::FormList
- Defined in:
- lib/open_rosa/form_list.rb
Overview
Generates OpenRosa Form List API XML responses Spec: https://docs.getodk.org/openrosa-form-list/
Constant Summary collapse
- XFORMS_LIST_NS =
"http://openrosa.org/xforms/xformsList"
Instance Method Summary collapse
-
#initialize(forms, options = {}) ⇒ FormList
constructor
A new instance of FormList.
- #to_xml ⇒ Object
Constructor Details
#initialize(forms, options = {}) ⇒ FormList
Returns a new instance of FormList.
11 12 13 14 15 16 17 |
# File 'lib/open_rosa/form_list.rb', line 11 def initialize(forms, = {}) @forms = forms @verbose = .fetch(:verbose, false) @form_id = [:form_id] @base_url = [:base_url] @mount_path = [:mount_path] || "/openrosa" end |
Instance Method Details
#to_xml ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/open_rosa/form_list.rb', line 19 def to_xml builder = Nokogiri::XML::Builder.new(encoding: "UTF-8") do |xml| xml.xforms(xmlns: XFORMS_LIST_NS) do filtered_forms.each do |form_class| generate_xform_entry(xml, form_class) end end end builder.to_xml end |