SZNAltmetric 2.1.1

SZNAltmetric 2.1.1

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Apr 2016

Maintained by Vincent Tourraine.



 
Depends on:
AFNetworking~> 2.0
ISO8601DateFormatter~> 0.6
 

  • By
  • shazino

Objective-C client for the Altmetric API.

SZNAltmetric is an Altmetric API client for iOS and Mac OS X. It’s built on top of AFNetworking to deal with network operations, and based on NSURLSession.

Getting Started

The easiest way to get started is to use CocoaPods to manage your dependencies. Follow the instructions on the CocoaPods site to install the gem, and specify SZNAltmetric as a dependency in your Podfile:

pod 'SZNAltmetric', '~> 2.1'

Example Usage

We wanted to make it as simple as possible to fetch details about an article from the API, so here is how it looks like:

SZNAltmetricManager *manager = [SZNAltmetricManager sharedManager];

[manager
 fetchArticleWithDOI:@"###DOI###"
 success:^(SZNAltmetricArticle *article) {
     // We have the article,
     // we can log the Altmetric score
     NSLog(@"%@", [article.score stringValue]);
 }
 failure:nil];

As you can see, we have just requested an article based on its DOI. What you get is a SZNAltmetricArticle object, containing all the identifiers, the Altmetric score, and even the URLs to the “donuts” images.

Having a client API key is optional, and it’s easy to configure if you need it:

SZNAltmetricManager *manager = [SZNAltmetricManager sharedManager];
manager.APIKey = @"###key###";

With just a bit of user interface, here’s how it looks like on iOS and OS X:

iOS demo app

OS X demo app

You can also search articles with different types of identifiers (Altmetric ID, PubMed ID, arXiv ID, and ADS Bibcode), or with a timeframe:

SZNAltmetricManager *manager = [SZNAltmetricManager sharedManager];

[manager
 fetchArticlesCitationsWithTimeframe:@"1d"
 success:^(NSArray *articles, NSUInteger total, NSUInteger page) {
     // We have an array of articles.
     NSLog(@"%@", articles);
 }
 failure:nil];

References

Requirements

SZNAltmetric requires Xcode 6.3 with either the iOS 7.0 or OS X 10.9, as well as AFNetworking and ISO 8601 parser unparser. Both SZNAltmetric and AFNetworking use ARC.

If you need to support older OS versions:

Credits

SZNAltmetric is developed by Shazino.

License

SZNAltmetric is available under the MIT license. See the LICENSE file for more info.