@@ -9,30 +9,39 @@ def initialize(provider, **args)
99 attr_reader :provider , :args
1010
1111 def xml_content ( xml )
12- provider_xml ( xml , provider )
12+ xml << provider_xml ( provider )
1313 end
1414
15- def provider_xml ( xml , provider )
16- xml . content_provider ( name : provider . name ) {
15+ def provider_xml ( provider )
16+ Ox ::Element . new ( "content_provider" ) . tap do |xml |
17+ xml [ :name ] = provider . name
18+
1719 grouped_topics ( provider ) . each do |( year , month ) , topics |
18- xml . topic_year ( year : year ) {
19- xml . topic_month ( month : month ) {
20+ xml << Ox ::Element . new ( "topic_year" ) . tap do |year_element |
21+ year_element [ :year ] = year . to_s
22+ year_element << Ox ::Element . new ( "topic_month" ) . tap do |month_element |
23+ month_element [ :month ] = month
2024 topics . each do |topic |
21- xml . title ( name : topic . title ) {
22- xml . topic_id topic . id
23- xml . topic_files ( files : "Files" ) {
25+ month_element << Ox ::Element . new ( "title" ) . tap do |title_element |
26+ title_element [ :name ] = topic . title
27+ title_element << Ox ::Element . new ( "topic_id" ) . tap { |id | id << topic . id . to_s }
28+ title_element << Ox ::Element . new ( "topic_files" ) . tap do |files |
29+ files [ :files ] = "Files"
2430 topic . documents . each_with_index do |document , index |
2531 next if document . content_type == "video/mp4"
26- xml . send ( "file_name_#{ index + 1 } " , document . filename , file_size : document . byte_size )
32+ files << Ox ::Element . new ( "file_name_#{ index + 1 } " ) . tap do |file_name |
33+ file_name << document . filename . to_s
34+ file_name [ :file_size ] = document . byte_size
35+ end
2736 end
28- }
29- xml . topic_tags topic . current_tags_list . join ( ", " )
30- }
37+ end
38+ title_element << Ox :: Element . new ( " topic_tags" ) . tap { | tags | tags << topic . current_tags_list . join ( ", " ) }
39+ end
3140 end
32- }
33- }
41+ end
42+ end
3443 end
35- }
44+ end
3645 end
3746
3847 def grouped_topics ( prov )
0 commit comments