Skip to content
Ile Eftimov edited this page Jul 11, 2014 · 2 revisions

Welcome to the Marver wiki!

API Access

Marver by default issues API calls to http://gateway.marvel.com, which is one of the default API endpoints that Marvel provides for their API. You can sign up for API keys here.

Configuration

Marver.configure do |config|
  config.public_key = 'your_public_key'
  config.private_key = 'your_private_key'
end

Usage

Search for characters:

client = Marver::Client.new
client.characters.find_by_name 'Hulk' # will return Hulk
client.characters.find_by_name_starts_with "Fantastic" # will return an Array of Marver::Character objects

Search for series:

client.series.find_by_name 'The Avengers' # will return The Avengers as a Marver::Serie object

Seach for events:

client.events.find_by_title 'Fall of the mutants' # will return 'Fall of the mutants' comic event as a Marver::Event object

Search for comics:

client.comics.find_by_title '"Doom 2099: The Complete Collection by Warren Ellis (Trade Paperback)"' # will return a Marver::Comic object

Summary objects

Every Marver::Entity has multiple lists of, so called, summary objects. For example, one Marver::Character has a list of comics in which that character appears. These comics are objects of the class Marver::Summary::Comic and are a light weight Comic. Also, these objects have the ability to morph into a full blown Marver::Comic object.

Example:

client = Marver::Client.new
event = client.events.find_by_title 'Fall of the mutants'
event.characters # will return an array of Marver::Summary::Character objects that took part in this event
some_character = event.characters.first # will return the first character of the event, as a Marver::Summary::Character

If you want to see all of the properties of this character:

full_character = some_character.full # will issue a call to the API and fetch all the info for this character

The cool thing is that this character will also have lists of Marver::Summary objects, which you can later morph into Marver::Entity objects.

Clone this wiki locally