Class: Wikirate4ruby::Entities::Source

Inherits:
Card
  • Object
show all
Defined in:
lib/wikirate4ruby/entities/source.rb

Constant Summary collapse

ATTRIBUTES =
i[title file link description report_type metrics companies
answers year].freeze

Constants inherited from Card

Card::CARD_ATTRIBUTES

Instance Method Summary collapse

Methods inherited from Card

#as_json, #raw_json, #to_json, #to_s

Constructor Details

#initialize(source) ⇒ Source

Returns a new instance of Source.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/wikirate4ruby/entities/source.rb', line 10

def initialize(source)
  super source
  raise parsing_error name = "IncompatibleCardType", message = "The input Card is not a Source but a #{@type}" if @type != 'Source'

  @title = get_content 'title'
  @file = get_content 'file'
  @link = get_content 'link'
  @description = get_content 'description'
  @report_type = get_content 'report_type'
  @metrics = get_content 'metric'
  @companies = get_content 'company'
  @answers = get_content 'answer'
  @year = get_content 'year'

end