Class: MicrosoftKiotaSerializationJson::JsonParseNodeFactory

Inherits:
Object
  • Object
show all
Includes:
MicrosoftKiotaAbstractions::ParseNodeFactory
Defined in:
lib/microsoft_kiota_serialization_json/json_parse_node_factory.rb

Instance Method Summary collapse

Instance Method Details

#get_parse_node(content_type, content) ⇒ Object

Raises:

  • (StandardError)


12
13
14
15
16
17
18
19
20
21
# File 'lib/microsoft_kiota_serialization_json/json_parse_node_factory.rb', line 12

def get_parse_node(content_type, content)
  if !content_type
    raise StandardError, 'content type cannot be undefined or empty'
  elsif get_valid_content_type != content_type
    raise StandardError, `expected a #{get_valid_content_type} content type`
  end
  raise StandardError, 'content cannot be undefined or empty' unless content

  JsonParseNode.new(JSON.parse(content))
end

#get_valid_content_typeObject



8
9
10
# File 'lib/microsoft_kiota_serialization_json/json_parse_node_factory.rb', line 8

def get_valid_content_type
  'application/json'
end