Giter Site home page Giter Site logo

webservice-samples's Introduction

WebService Samples

Showing how to connect and consume 3rd party RESTful API's in JSON or XML.

To make thinks easier I created a Connection Class (HKConnection). It uses a block that returns either an NSError or NSData. Also you can pass the view you'd like the progress HUD(MBProgessHUD) to be displayed on.

- (id)initWithURL:(NSURL*)URL progressHudView:(UIView*)HUDdisplayView callback:(HKConnectionBlock)block;
- (id)initWithURL:(NSURL *)URL callback:(HKConnectionBlock)block;
  1. Get locations and get the local weather 5 day forecast from WorlWeatherOnline.com. parse the JSON and display the results in a user friendly way.

  2. Fun with the Dribbble API. Here I created a simple Dribbble Engine to get shots, comments and Player information. Results are shown in a tableView with custom cells. The shot's comments are viewable right in the tableView by adding or deleting cells at the correct indexes (With animations). Shots can be enlarged/decreased using custom animations. Connecting is easy:

- (void)shotsForType:(ShotTypes)type page:(NSInteger)page;
- (void)commentsForShot:(Shots*)shot;
  • There are 3 different "ShotTypes"
    • kShotTypePopular,
    • kShotTypeDebuts,
    • kShotsTypeEveryone

And DribbleAPI class returns one of three delegate methods:

- (void)dribleAPI:(DribbleAPI*)API didFailWithError:(NSError*)error;
- (void)driblleAPI:(DribbleAPI*)API didFinishGatheringShots:(NSArray*)shots;
- (void)dribbleAPI:(DribbleAPI*)API didFinishGatheringComments:(NSArray*)comments;
  1. Rotten Tomatoes. Lists movies or DVD's based on user's input. Choice of category is given for: In theaters, Box office, Upcoming or Opening and listed in a tableView for easy viewing. You can connect to Rotten Tomatoes like this:
- (void)rottenTomatoesForMovie:(MovieListType)movieType;

There are 4 different MovieListTypes.

  • BoxOffice,
  • InTheaters,
  • Opening,
  • Upcoming

And RottenTomatoes has only one delegate method right now (This will change in the next commit):

- (void)RottenTomatoes:(RottenTomatoes*)rottenTomatoes didFinishWithInformation:(NSDictionary*)RottenTomatoesData;

Thats it for now. It's still very much a work in progress...Any contributions and/or suggestions are always welcome.

If you plan on using any of this code for yourself please change the API Keys! I've temporarily left mine in for demonstration purposes.

webservice-samples's People

Contributors

hubertk avatar

Watchers

James Cloos 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.