Class: PackwizardParser::ListParser

Inherits:
Object
  • Object
show all
Defined in:
lib/packwizard_parser/list_parser.rb

Overview

Parser for extracting PackWizard list data from JSON.

Instance Method Summary collapse

Instance Method Details

#parse(data, category_parser:, item_parser:) ⇒ List

Extract the lists name and description. Extract the categories and their items

Parameters:

  • data (Hash)

    The fully parsed JSON response.

  • category_parser (CategoryParser)

    Parser for extracting the categories

  • item_parser (ItemParser)

    Parser for extracting the items

Returns:

  • (List)

    The parsed list



13
14
15
16
17
18
19
# File 'lib/packwizard_parser/list_parser.rb', line 13

def parse(data, category_parser:, item_parser:)
  List.new(
    name: extract_name(data),
    description: extract_description(data),
    categories: category_parser.parse_all(data, item_parser: item_parser)
  )
end