Skip to content

Latest commit

 

History

History
43 lines (30 loc) · 1.95 KB

Update Relationship Metric Answer.md

File metadata and controls

43 lines (30 loc) · 1.95 KB

Update Relationship Metric Answer

Wikirate platform can host answers that respond to relationship questions between companies. For instance, which companies supplied company A in 2022? Relationship answers respond to such questions (metrics with metric type Relationship Metric).

This example assumes you have configured your Wikirate REST client. Instructions on how to configure a client can be found in examples/Configurations.md

WikiRate's REST API allows you to not only to import but also update existing relationships. wikirate4ruby provides the method udpate_relationship_metric_answer to facilitate this functionality. The method takes as an input a number of parameters where all the information about the existing relationship and updated fields is defined. The parameters can be split into required and optional.

required params:

  • metric_designer: the designer of the metric
  • metric_name: the metric name/title of the metric
  • subject_company: the company name/id of the subject company
  • object_company: the company name/id of the object company
  • year: the year the relationship is referred to

or

  • answer_id: the user can define directly the id of the relationship, they want to update, instead of all the aformentioned paramaters

optional params:

  • value: the value/answer to the question
  • source: wikirate's source name of the source we found the mentioned relationship
  • discussion: any comments we might have on the answer

The example below demonstrates the import of a relationship to the Commons metric Supplied By

updated_relationship = client.update_relationship_metric_answer({ 'answer_id' => 6228782,
                                                                  'year' => 2018 })