Skip to content
Browse files

Add citations count properties to SZNAltmetricArticle

  • Loading branch information...
1 parent 20b611a commit f35ce9a068298e3476da87058652b51787880323 @vtourraine vtourraine committed Apr 4, 2013
View
29 Examples/SZNAltmetricDemoOSX/SZNAltmetricDemoOSXTests/classes/SZNAltmetricArticleTests.m
@@ -13,13 +13,40 @@ @implementation SZNAltmetricArticleTests
- (void)testArticleFromRespondeDictionary
{
- SZNAltmetricArticle *article = [SZNAltmetricArticle articleWithAPIResponseObject:@{@"added_on" : @(1324491937), @"altmetric_id" : @(1), @"ads_id" : @"ADS-123", @"doi" : @"DOI-123", @"arxiv_id" : @"arXiv-123", @"last_updated" : @(1324491938), @"nlmid" : @"NLM-123", @"pmid" : @"pmid-123", @"published_on" : @(1324491939), @"score" : @(42), @"images" : @{@"small" : @"http://test.com/small.jpg", @"medium" : @"http://test.com/medium.jpg", @"large" : @"http://test.com/large.jpg"}, @"is_oa" : @(YES), @"title" : @"Article", @"details_url" : @"http://test.com/article/details", @"url" : @"http://test.com/article"}];
+ SZNAltmetricArticle *article = [SZNAltmetricArticle articleWithAPIResponseObject:@{
+ @"added_on" : @(1324491937),
+ @"altmetric_id" : @(1),
+ @"ads_id" : @"ADS-123",
+ @"cited_by_accounts_count" : @(393),
+ @"cited_by_fbwalls_count" : @(12),
+ @"cited_by_feeds_count" : @(2),
+ @"cited_by_gplus_count" : @(20),
+ @"cited_by_posts_count" : @(402),
+ @"cited_by_tweeters_count" : @(359),
+ @"doi" : @"DOI-123",
+ @"arxiv_id" : @"arXiv-123",
+ @"last_updated" : @(1324491938),
+ @"nlmid" : @"NLM-123",
+ @"pmid" : @"pmid-123",
+ @"published_on" : @(1324491939),
+ @"score" : @(42),
+ @"images" : @{@"small" : @"http://test.com/small.jpg", @"medium" : @"http://test.com/medium.jpg", @"large" : @"http://test.com/large.jpg"},
+ @"is_oa" : @(YES),
+ @"title" : @"Article",
+ @"details_url" : @"http://test.com/article/details",
+ @"url" : @"http://test.com/article"}];
STAssertNotNil(article, @"Article not created");
STAssertEqualObjects(article.addedOn, [NSDate dateWithTimeIntervalSince1970:1324491937], @"Added on not extracted");
STAssertEqualObjects(article.identifier, @"1", @"Identifier not extracted");
STAssertEqualObjects(article.ADSBibcode, @"ADS-123", @"ADS not extracted");
+ STAssertEqualObjects(article.citedByAccountsCount, @(393), @"Cited by accounts not extracted");
+ STAssertEqualObjects(article.citedByFacebookWallsCount, @(12), @"Cited by Facebook walls not extracted");
+ STAssertEqualObjects(article.citedByFeedsCount, @(2), @"Cited by feeds not extracted");
+ STAssertEqualObjects(article.citedByGooglePlusCount, @(20), @"Cited by Google+ not extracted");
+ STAssertEqualObjects(article.citedByPostsCount, @(402), @"Cited by posts not extracted");
+ STAssertEqualObjects(article.citedByTweetersCount, @(359), @"Cited by tweeters not extracted");
STAssertEqualObjects(article.DOI, @"DOI-123", @"DOI not extracted");
STAssertEqualObjects(article.arXiv, @"arXiv-123", @"arXiv identifier not extracted");
STAssertEqualObjects(article.lastUpdated, [NSDate dateWithTimeIntervalSince1970:1324491938], @"Last updated not extracted");
View
30 SZNAltmetric/SZNAltmetricArticle.h
@@ -40,6 +40,36 @@
@property (copy, nonatomic) NSString *title;
/**
+ The cited by accounts count of the article.
+ */
+@property (strong, nonatomic) NSNumber *citedByAccountsCount;
+
+/**
+ The cited by Facebook walls count of the article.
+ */
+@property (strong, nonatomic) NSNumber *citedByFacebookWallsCount;
+
+/**
+ The cited by feeds count of the article.
+ */
+@property (strong, nonatomic) NSNumber *citedByFeedsCount;
+
+/**
+ The cited by Google+ count of the article.
+ */
+@property (strong, nonatomic) NSNumber *citedByGooglePlusCount;
+
+/**
+ The cited by posts count of the article.
+ */
+@property (strong, nonatomic) NSNumber *citedByPostsCount;
+
+/**
+ The cited by tweeters count of the article.
+ */
+@property (strong, nonatomic) NSNumber *citedByTweetersCount;
+
+/**
The DOI of the article.
*/
@property (copy, nonatomic) NSString *DOI;
View
6 SZNAltmetric/SZNAltmetricArticle.m
@@ -31,6 +31,12 @@ + (SZNAltmetricArticle *)articleWithAPIResponseObject:(id)responseObject
article.addedOn = [NSDate dateWithTimeIntervalSince1970:[responseObject[@"added_on"] doubleValue]];
article.identifier = [NSString stringWithFormat:@"%@", responseObject[@"altmetric_id"]];
article.ADSBibcode = responseObject[@"ads_id"];
+ article.citedByAccountsCount = responseObject[@"cited_by_accounts_count"];
+ article.citedByFacebookWallsCount = responseObject[@"cited_by_fbwalls_count"];
+ article.citedByFeedsCount = responseObject[@"cited_by_feeds_count"];
+ article.citedByGooglePlusCount = responseObject[@"cited_by_gplus_count"];
+ article.citedByPostsCount = responseObject[@"cited_by_posts_count"];
+ article.citedByTweetersCount = responseObject[@"cited_by_tweeters_count"];
article.DOI = responseObject[@"doi"];
article.arXiv = responseObject[@"arxiv_id"];
article.lastUpdated = [NSDate dateWithTimeIntervalSince1970:[responseObject[@"last_updated"] doubleValue]];

0 comments on commit f35ce9a

Please sign in to comment.
Something went wrong with that request. Please try again.