Code Monkey home page Code Monkey logo

embedly-ios's Introduction

embedly-ios

Version Platform

Usage

The Embedly iOS library gives you access to all of Embedly's APIs, but there are two different ways to interact with the APIs:

  • Embed, Extract, and legacy APIs are available through the call{EmbedlyApi,Embed,Extract,...} methods, which initiate an HTTP call which invokes the corresponding delegate method (embedly{Success,Failure}) upon completion.

  • The Display API is different. The build{DisplayUrl,CroppedImageUrl,...} methods simply return an NSString containing the URL for the manipulated image via the Embedly Display API. You can use this URL wherever you would use any other image address (e.g. AFNetworking+UIImage).

The call{EmbedlyApi,Embed,...} methods use delegation to return the result of the API call, so your code will need to implement the EmbedlyDelegate protocol. The API response is returned in 'response', which can be accessed as an NSDictionary.

To make it simpler to cache API calls within your app, the call{EmbedlyApi,Embed,...} functions return a string containing the full Embedly API call. You can use this as a key to store API responses (e.g. in an NSDictionary). This return value is also useful in debugging an API call.

To make batch API calls (multiple URLs at the same time), you can use the callEmbedlyApi:withUrls:params: method, which takes an NSArray of NSStrings. In this case, the API response returned in 'response' can be accessed as an NSArray of NSDictionarys.

Example

A complete example app is available in the Example directory of this repo. Here are some quick examples:

Embedly *e = [[Embedly alloc] initWithKey:@"mykey" delegate:self];
NSString *callUrl = [e callEmbed:@"techcrunch.com/embedly" params:@{@"chars": @"120"} optimizeImages:640];

// within embedlySuccess:withResponse:endpoint:operation:
self.urlTitle.text = [response objectForKey:@"title"];
self.urlProvider.text = [response objectForKey:@"provider_name"];
self.urlDescription.text = [response objectForKey:@"description"];
Embedly *e = [[Embedly alloc] initWithKey:@"mykey" delegate:self];
NSString *resizedImageUrl = [e buildResizedImageUrl:@"http://embed.ly/static/images/office/DSC_0157.JPG" width:250];
NSString *croppedImageUrl = [e buildCroppedImageUrl:@"http://embed.ly/static/images/office/DSC_0123.JPG" width:100 height:100];
NSString *filledImageUrl = [e buildDisplayUrl:@"/1/display/fill" withUrl:@"http://embed.ly/static/images/office/DSC_0161.JPG" params:@{@"width": @"500", @"height": @"500", @"color": @"1bd9f5"}];

Requirements

All of Embedly's products are free to use up to a limit, you just need to sign up for an API key at:

https://app.embed.ly/signup

Make sure to include your API key when you initialize the Embedly object.

If your app is doing well and you need more usage, you can learn more about our plans at:

http://embed.ly/api

Installation

embedly-ios is available through CocoaPods, to install it simply add the following line to your Podfile:

pod "embedly-ios"

To run the example project; clone the repo, and run pod install from the Example directory first. You will need to add your Embedly API key to the initWithKey:delegate: method (replace "mykey" with your API key).

Author

@embedly

License

embedly-ios is available under the MIT license. See the LICENSE file for more info.

embedly-ios's People

Contributors

anrope avatar lprhodes avatar tboetig avatar tomboetig avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.