Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added backwards compatibility for events in v3 and v5 APi. #287
- Loading branch information
Martin Fenner
committed
May 9, 2015
1 parent
314ef30
commit 67e7b34
Showing
30 changed files
with
461 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
class ArticleCoverage < Source | ||
# include common methods for Article Coverage | ||
include Coverable | ||
|
||
def get_extra(result) | ||
Array(result['referrals']).map do |item| | ||
{ event: item, | ||
event_time: get_iso8601_from_time(item['published_on']), | ||
event_url: item['referral'] } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,27 @@ | ||
class ArticleCoverageCurated < Source | ||
# include common methods for Article Coverage | ||
include Coverable | ||
|
||
def get_extra(result) | ||
Array(result.fetch('referrals', nil)).map do |item| | ||
event_time = get_iso8601_from_time(item['published_on']) | ||
url = item['referral'] | ||
type = item.fetch("type", nil) | ||
type = MEDIACURATION_TYPE_TRANSLATIONS.fetch(type, nil) if type | ||
|
||
{ event: item, | ||
event_time: event_time, | ||
event_url: url, | ||
|
||
# the rest is CSL (citation style language) | ||
event_csl: { | ||
'author' => '', | ||
'title' => item.fetch('title') { '' }, | ||
'container-title' => item.fetch('publication') { '' }, | ||
'issued' => get_date_parts(event_time), | ||
'url' => url, | ||
'type' => type } | ||
} | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.