GithubHelp home page GithubHelp logo

cat_api's Introduction

CatAPI

I'm not sure how this happened, but there was not yet a Ruby wrapper for the awesome Cat API. Well, problem solved. I'm putting this together for use in a class, so there are no specs and it only hits a single endpoint, but it's something.

Installation

Add this line to your application's Gemfile:

gem 'cat_api'

And then execute:

$ bundle

Or install it yourself as:

$ gem install cat_api

Usage

Right now, all it does is get cat images.

client = CatAPI.new
client.get_images

This will return something like:

=> [#<CatAPI::Image:0x007f863c43b308
  @id="2hf",
  @source_url="http://thecatapi.com/?id=2hf",
  @url="http://30.media.tumblr.com/tumblr_m1o1n5Ajhx1rqyi1go1_1280.png">]

You can get multiple cat images and change other options by passing in parameters from the Cat API docs as a hash. For example, to return 5 cat images at a time:

client.get_images(results_per_page: 5)

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

cat_api's People

Contributors

chrisvfritz avatar naoyashiga avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

naoyashiga

cat_api's Issues

Mime-Types Version Compatibility - Rails

When we tried to specify 0.1.0 of the Cat API, we got an error, which was the result of a conflict:

Bundler could not find compatible versions for gem "mime-types":
  In snapshot (Gemfile.lock):
    mime-types (= 3.1)

  In Gemfile:
    rails (= 4.2.5) was resolved to 4.2.5, which depends on
      actionmailer (= 4.2.5) was resolved to 4.2.5, which depends on
        mail (>= 2.5.4, ~> 2.5) was resolved to 2.6.4, which depends on
          mime-types (< 4, >= 1.16)

    cat_api (= 0.1.0) was resolved to 0.1.0, which depends on
      rest-client (~> 1.7.2) was resolved to 1.7.2, which depends on
        mime-types (< 3.0, >= 1.16)

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.