Comments (1)
Not a silly question, although I'm not sure I quite understand you. Are you saying the output you currently see is Hashie::Mash
with no further indication of what it contains? Or, are you saying the manner in which the wrapper is written makes it difficult to understand what sorts of information one can get from Marvel's API?
If it is the former, I whole-heartedly recommend using pry
to explore the API. It's equally good for getting a feel for what data you can get as it is for figuring out exactly how to get that data once you know it's there.
Forgive me if this is stuff you already know and please let me know if I'm completely misunderstanding you, but hopefully the instructions below will be helpful in getting you started with exploring Marvel's API.
- Install the
marvel_api
andpry
gems if you haven't already:
$ gem install marvel_api
$ gem install pry
- Start a new
pry
session:
$ pry
- Require the gem, instantiate a client, and configure it with your API keys:
[1] pry(main)> require 'marvel_api'
=> true
[2] pry(main)> @client = Marvel::Client.new
=> #<Marvel::Client:0x007fb850d62fd0 @api_key=nil, @private_key=nil>
[3] pry(main)> @client.configure do |config|
[3] pry(main)* config.api_key = '1234'
[3] pry(main)* config.private_key = 'abcd'
[3] pry(main)* end
=> "abcd"
- Try some of the examples in the README, e.g., fetch Thanos by
id
:
[4] pry(main)> @client.character(1009652)
=> [{"id"=>1009652,
"name"=>"Thanos",
"description"=>
"The Mad Titan Thanos, a melancholy, brooding individual, consumed with the concept of death, sought out personal power and increased strength, endowing himself with cybernetic implants until he became more powerful than any of his brethren.",
"modified"=>"2014-02-19T15:41:57-0500",
"thumbnail"=>{"path"=>"http://i.annihil.us/u/prod/marvel/i/mg/6/40/5274137e3e2cd", "extension"=>"jpg"},
"resourceURI"=>"http://gateway.marvel.com/v1/public/characters/1009652",
"comics"=>
{"available"=>78,
"collectionURI"=>"http://gateway.marvel.com/v1/public/characters/1009652/comics",
"items"=>
[{"resourceURI"=>"http://gateway.marvel.com/v1/public/comics/12651", "name"=>"Alpha Flight (1983) #111"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/comics/32993",
"name"=>"Avengers & the Infinity Gauntlet (Graphic Novel)"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/comics/6943", "name"=>"Avengers Annual (1967) #7"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/comics/41354", "name"=>"Avengers Assemble (2012) #3"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/comics/8017", "name"=>"Captain Marvel (1968) #28"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/comics/8018", "name"=>"Captain Marvel (1968) #29"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/comics/8488", "name"=>"Deadpool (1997) #33"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/comics/37579", "name"=>"Deadpool Classic Vol. 5 (Trade Paperback)"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/comics/20194", "name"=>"Doctor Strange, Sorcerer Supreme (1988) #33"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/comics/13190", "name"=>"Fantastic Four (1961) #366"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/comics/13192", "name"=>"Fantastic Four (1961) #368"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/comics/13193", "name"=>"Fantastic Four (1961) #369"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/comics/13195", "name"=>"Fantastic Four (1961) #370"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/comics/1064", "name"=>"Infinity Abyss (Trade Paperback)"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/comics/20010", "name"=>"Infinity Abyss (2002) #1"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/comics/20012", "name"=>"Infinity Abyss (2002) #3"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/comics/23033", "name"=>"Infinity Crusade Vol. 1 (Trade Paperback)"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/comics/9289", "name"=>"Infinity Gauntlet (1991) #4"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/comics/10020", "name"=>"Marvel Comics Presents (1988) #108"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/comics/10021", "name"=>"Marvel Comics Presents (1988) #109"}],
"returned"=>20},
"series"=>
{"available"=>42,
"collectionURI"=>"http://gateway.marvel.com/v1/public/characters/1009652/series",
"items"=>
[{"resourceURI"=>"http://gateway.marvel.com/v1/public/series/2116", "name"=>"Alpha Flight (1983 - 1994)"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/series/10035", "name"=>"Avengers & the Infinity Gauntlet (2011)"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/series/1988", "name"=>"Avengers Annual (1967 - 1994)"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/series/15373", "name"=>"Avengers Assemble (2012 - Present)"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/series/2000", "name"=>"Captain Marvel (1968 - 1979)"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/series/2005", "name"=>"Deadpool (1997 - 2002)"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/series/13506", "name"=>"Deadpool Classic Vol. 5 (2010 - Present)"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/series/3741", "name"=>"Doctor Strange, Sorcerer Supreme (1988 - 1996)"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/series/2121", "name"=>"Fantastic Four (1961 - 1998)"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/series/124", "name"=>"Infinity Abyss (1999)"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/series/3727", "name"=>"Infinity Abyss (2002)"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/series/6449", "name"=>"Infinity Crusade Vol. 1 (2008 - Present)"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/series/2023", "name"=>"Infinity Gauntlet (1991)"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/series/2039", "name"=>"Marvel Comics Presents (1988 - 1995)"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/series/4578", "name"=>"Marvel Masterworks: Captain Marvel Vol. 3 (2008)"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/series/4577", "name"=>"Marvel Masterworks: Captain Marvel Vol. 3 (2008)"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/series/3715", "name"=>"Marvel Two-in-One (1974 - 1983)"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/series/164",
"name"=>"Marvel Universe Vol. I: Thanos: Infinity Abyss (2003)"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/series/2059", "name"=>"Paradise X (2002 - 2003)"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/series/2431", "name"=>"Paradise X Vol. 1 (2007)"}],
"returned"=>20},
"stories"=>
{"available"=>72,
"collectionURI"=>"http://gateway.marvel.com/v1/public/characters/1009652/stories",
"items"=>
[{"resourceURI"=>"http://gateway.marvel.com/v1/public/stories/695", "name"=>"Interior #695", "type"=>"interiorStory"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/stories/1413", "name"=>"Interior #1413", "type"=>"interiorStory"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/stories/1603", "name"=>"Interior #1603", "type"=>"interiorStory"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/stories/1801", "name"=>"Interior #1801", "type"=>"interiorStory"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/stories/1843", "name"=>"Interior #1843", "type"=>"interiorStory"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/stories/2254", "name"=>"Interior #2254", "type"=>"interiorStory"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/stories/2437", "name"=>"Interior #2437", "type"=>"interiorStory"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/stories/2439", "name"=>"Interior #2439", "type"=>"interiorStory"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/stories/2441", "name"=>"Interior #2441", "type"=>"interiorStory"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/stories/2443", "name"=>"Interior #2443", "type"=>"interiorStory"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/stories/2445", "name"=>"Interior #2445", "type"=>"interiorStory"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/stories/2447", "name"=>"Interior #2447", "type"=>"interiorStory"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/stories/4765", "name"=>"2 of 2 - Cosmic Starfox", "type"=>"cover"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/stories/13095", "name"=>"The Enemy Within!", "type"=>"interiorStory"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/stories/13107", "name"=>"Day of the Dark Side!", "type"=>"interiorStory"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/stories/13113",
"name"=>"With Malice Toward All!",
"type"=>"interiorStory"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/stories/13121", "name"=>"Forever Evil", "type"=>"interiorStory"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/stories/17448", "name"=>"Cover #17448", "type"=>"cover"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/stories/18267", "name"=>"When Titans Collide!", "type"=>"cover"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/stories/18270", "name"=>"Metamorphosis!", "type"=>"interiorStory"}],
"returned"=>20},
"events"=>
{"available"=>4,
"collectionURI"=>"http://gateway.marvel.com/v1/public/characters/1009652/events",
"items"=>
[{"resourceURI"=>"http://gateway.marvel.com/v1/public/events/235", "name"=>"Blood and Thunder"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/events/253", "name"=>"Infinity Gauntlet"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/events/29", "name"=>"Infinity War"},
{"resourceURI"=>"http://gateway.marvel.com/v1/public/events/294", "name"=>"The Thanos Imperative"}],
"returned"=>4},
"urls"=>
[{"type"=>"detail",
"url"=>"http://marvel.com/characters/58/thanos?utm_campaign=apiRef&utm_source=94f945fe8833c9a96e6f761b60562a45"},
{"type"=>"wiki", "url"=>"http://marvel.com/universe/Thanos?utm_campaign=apiRef&utm_source=94f945fe8833c9a96e6f761b60562a45"},
{"type"=>"comiclink",
"url"=>"http://marvel.com/comics/characters/1009652/thanos?utm_campaign=apiRef&utm_source=94f945fe8833c9a96e6f761b60562a45"}]}]
Hope it helps,
O-I
from marvel.
Related Issues (12)
- Renaming the gem seems to have made it unusable HOT 1
- Fix/update Travis build
- Key Conflict
- Rspec tests crashing HOT 1
- Removing faraday ~> 0.8.9 dependency causes crash
- Gem not loading when using Ruby 2.1.1 HOT 1
- Add tests for invalid credentials
- Specify gem version range for runtime dependencies HOT 2
- Add support for Etags HOT 2
- Expose raw response in request.rb
- Return Marvel::<Entity> objects
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from marvel.