Class: Wikirate4ruby::Entities::Relationship

Inherits:
Answer
  • Object
show all
Defined in:
lib/wikirate4ruby/entities/relationship.rb

Constant Summary collapse

ATTRIBUTES =
%i[metric_id inverse_metric_id subject_company subject_company_id object_company object_company_id].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(relationship) ⇒ Relationship

Returns a new instance of Relationship.



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/wikirate4ruby/entities/relationship.rb', line 9

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

  @metric_id = get_content 'metric_id'
  @inverse_metric_id = get_content 'inverse_metric_id'
  @subject_company = get_name 'subject_company'
  @subject_company_id = get_content 'subject_company_id'
  @object_company = get_name 'object_company'
  @object_company_id = get_content 'object_company_id'

end