Giter VIP home page Giter VIP logo

uatu's Introduction

Build Status

Uatu

Uatu is a Wrapper for the Marvel API. See the API for more details. It relies on OpenStruct to build ruby objects with the API response.

Uatu is also a member of The Watchers, that nice extraterrestrial race who monitor life of other species.

Installation

To get the latest stable:

gem 'uatu-marvel'

To get the latest code:

gem 'uatu-marvel', git: https://github.com/eltercero/uatu

And then execute:

$ bundle

Usage

require 'uatu'

# You can also have them in your env => ENV["MARVEL_PUBLIC_KEY"] - ENV["MARVEL_PRIVATE_KEY"]
Uatu.configure do |config|
  config.public_key = 'your_api_key'
  config.private_key = 'your_private_api_key'
end

watcher = Uatu::Base.new

# Examples
#####################################################
# Searching by characters return an Array of results
character = watcher.characters(name: 'Daredevil').first
character.name
=> 'Daredevil'
character.description
=> "Abandoned by his mother, Matt Murdock was raised by his father, boxer \"Battling Jack\" Murdock, in Hell's Kitchen. Realizing that rules were needed to prevent people from behaving badly, young Matt decided to study law; however, when he saved a man from an oncoming truck, it spilled a radioactive cargo that rendered Matt blind while enhancing his remaining senses. Under the harsh tutelage of blind martial arts master Stick, Matt mastered his heightened senses and became a formidable fighter."

random_hero = watcher.characters(limit: 1, offset: rand(1000)).first.name
=> "Dreaming Celestial"
random_heroes_team = watcher.characters(limit: 20, offset: rand(1000)).map(&:name)
=> ["Rumiko Fujikawa", "Runaways", "Russian", "S.H.I.E.L.D.", "Sabra", "Sabretooth", "Sabretooth (Age of Apocalypse)", "Sabretooth (House of M)", "Sabretooth (Ultimate)", "Sage", "Salem's Seven (Ultimate)", "Sally Floyd", "Salo", "Sandman", "Santa Claus", "Saracen (Muzzafar Lambert)", "Sasquatch (Walter Langkowski)", "Satana", "Sauron", "Scalphunter"]

# Parameters are in ruby style. This means no camel case like firstName
irish_fella = watcher.creators(first_name: 'Garth', last_name: 'Ennis').first
irish_fella.comics.available
=> 103

#You can also search by id
character = watcher.character(1009262)
character.thumbnail
=> "http://i.annihil.us/u/prod/marvel/i/mg/d/50/50febb79985ee.jpg"

#There is also a handy method for checking out the last url you requested
watcher.last_request_url
=> "http://gateway.marvel.com/v1/public/characters/1009262?apikey=xxx&hash=xxx&ts=2014-02-08T18%3A52%3A25%2B01%3A00"

#For combined calls (like, comics in a character => GET /v1/public/characters/{characterId}/comics), you make them like this
asgardian_god_comics = watcher.character_comics(1009664)
asgardian_god_comics.first.title
"Thor: God of Thunder (2012) #2" # Which is, by the way, an amazing comic.

Contributing

Please, be my guest!

  1. Fork it ( http://github.com/eltercero/uatu/fork )
  2. Create your feature branch (git checkout -b nuff-said)
  3. Commit your changes (git commit -am 'Excelsior!')
  4. Push to the branch (git push origin nuff-said)
  5. Create new Pull Request

License

Released under the MIT License.

uatu's People

Contributors

eltercero avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.