Class: Dtn::Messages::News::Base

Inherits:
MessageWithSimpleParser show all
Defined in:
lib/dtn/messages/news/base.rb

Overview

Base

Direct Known Subclasses

Config, Headline, Story, StoryCount

Class Method Summary collapse

Methods inherited from MessageWithSimpleParser

parse, #termination?

Methods inherited from Dtn::Message

#callback_name, callback_name, parse

Class Method Details

.fieldsObject



9
10
11
# File 'lib/dtn/messages/news/base.rb', line 9

def fields
  @fields ||= { request_id: :to_i }
end

.parse_dynamic_fields(instance:, values:, request:) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/dtn/messages/news/base.rb', line 13

def parse_dynamic_fields(instance:, values:, request:)
  attributes = case request.combined_options[:format_type]
               when "t" then text_fields
               when "x" then xml_fields
               else raise "Wrong format type"
               end

  apply_values instance: instance, attributes: attributes, values: values
end