Ruby app to take a Swagger API and generate NSURLRequests.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
classes
.gitignore
Gemfile
Gemfile.lock
LICENSE
README.md
grabber.rb
routes-like.rb

README.md

You've got the routes like Swagger.

Ruby app to take a Swagger API and generate NSURLRequests.

# usage
ruby routes-like.rb [swagger url] [authentication token]

Currently generates header files like so:

// Generated by Routes Like Swagger - 31/12/14

@interface ARRouter (PartnerShow)

/// Get an partner show's image (install shot). 
/// @return URLRequest for /api/v1/partner_show/{partner_show_id}/image/{id}(/{image_version}).{format}

- (NSURLRequest *)getPartnerShowWithID:(NSString *)partnerShowID imageWithID:(NSString *)slug;

/// Get an partner show's image (install shot). 
/// @param filename Filename to download the image as.
/// @return URLRequest for /api/v1/partner_show/{partner_show_id}/image/{id}(/{image_version}).{format}

- (NSURLRequest *)getPartnerShowWithID:(NSString *)partnerShowID imageWithID:(NSString *)slug filename:(NSString *)filename;

/// Get a partner show's default (cover) image. 
/// @return URLRequest for /api/v1/partner_show/{partner_show_id}/default_image(/{image_version}).{format}

- (NSURLRequest *)getPartnerShowDefaultImageWithID:(NSString *)partnerShowID;

/// Add an image to a partner show. 
/// @return URLRequest for /api/v1/partner_show/{partner_show_id}/image.{format}

- (NSURLRequest *)createPartnerShowImageWithID:(NSString *)partnerShowID;

/// Add an image to a partner show. 
/// @param image_file Image attachment.
/// @param remote_image_url Remote URL for the image to upload (string).
/// @param image_crop Crop hash with x, y, width and height coordinates.
/// @return URLRequest for /api/v1/partner_show/{partner_show_id}/image.{format}

- (NSURLRequest *)createPartnerShowImageWithID:(NSString *)partnerShowID imageFile:(NSString *)imageFile remoteImageUrl:(NSString *)remoteImageUrl imageCrop:(id )imageCrop;

/// Crop a partner show's image. 
/// @return URLRequest for /api/v1/partner_show/{partner_show_id}/image/{id}/crop.{format}

- (NSURLRequest *)updatePartnerShowWithID:(NSString *)partnerShowID imageCropWithID:(NSString *)slug;

/// Crop a partner show's image. 
/// @param x X coordinate of the crop.
/// @param y Y coordinate of the crop.
/// @param width Width of the region to crop.
/// @param height Height of the region to crop.
/// @return URLRequest for /api/v1/partner_show/{partner_show_id}/image/{id}/crop.{format}

- (NSURLRequest *)updatePartnerShowWithID:(NSString *)partnerShowID imageCropWithID:(NSString *)slug x:(NSInteger)x y:(NSInteger)y width:(NSInteger)width height:(NSInteger)height;

/// Update a partner show's image. 
/// @return URLRequest for /api/v1/partner_show/{partner_show_id}/image/{id}.{format}

- (NSURLRequest *)updatePartnerShowWithID:(NSString *)partnerShowID imageWithID:(NSString *)slug;

/// Remove an image from a partner show. 
/// @return URLRequest for /api/v1/partner_show/{partner_show_id}/image/{id}.{format}

- (NSURLRequest *)removePartnerShowWithID:(NSString *)partnerShowID imageWithID:(NSString *)slug;

/// Remove an artwork from a partner show's image. 
/// @return URLRequest for /api/v1/partner_show/{partner_show_id}/image/{id}/artwork/{artwork_id}.{format}

- (NSURLRequest *)removePartnerShowWithID:(NSString *)partnerShowID imageWithID:(NSString *)slug artworkWithID:(NSString *)artworkID;

/// Remove an artist from a partner show's image. 
/// @return URLRequest for /api/v1/partner_show/{partner_show_id}/image/{id}/artist/{artist_id}.{format}

- (NSURLRequest *)removePartnerShowWithID:(NSString *)partnerShowID imageWithID:(NSString *)slug artistWithID:(NSString *)artistID;

/// Retrieve partner show's images. 
/// @return URLRequest for /api/v1/partner_show/{partner_show_id}/images.{format}

- (NSURLRequest *)getPartnerShowImagesWithID:(NSString *)partnerShowID;

/// Retrieve partner show's images. 
/// @param page Page number to retrieve, starting at 1.
/// @param offset Offset from which to retrieve.
/// @param size Number of items to retrieve for this page or from the current offset.
/// @param cursor Cursor for pagination.
/// @param default Only include non-covers when set to false.
/// @param sort Sort order.
/// @return URLRequest for /api/v1/partner_show/{partner_show_id}/images.{format}

- (NSURLRequest *)getPartnerShowImagesWithID:(NSString *)partnerShowID page:(NSInteger)page offset:(NSInteger)offset size:(NSString *)size cursor:(NSString *)cursor default:(BOOL)default sort:(NSString *)sort;

/// Reposition partner show images. 
/// @param image_ids Array of partner show image ids.
/// @return URLRequest for /api/v1/partner_show/{partner_show_id}/images/reposition.{format}

- (NSURLRequest *)createPartnerShowImagesRepositionWithID:(NSString *)partnerShowIDimageIds:(NSArray *)imageIds;
@end

It neatly handles optional parameters by offering multiple versions of the same NSURLRequest, one with only required, and one with all the options. So if you rarely have to deal with some obscure option it can disappear away.