Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

marvel_crawler

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

marvel_crawler

  • 0.1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

MarvelCrawler

Lightweight interface to communicate with the Marvel Comics API. It supports configurable pagination for all API.

Installation

Add this line to your application's Gemfile:

gem 'marvel_crawler'

And then execute:

$ bundle

Or install it yourself as:

$ gem install marvel_crawler

Configuration

You need to register on Marvel Developer Portal to get your public key and a private key. It requires to do the request on Marvel API.

@crawler = MarvelCrawler.client

@crawler.configure do |config|
  config.api_key = 'YOUR_API_KEY'
  config.private_key = 'YOUR_PRIVATE_KEY'
  config.record_per_page = 2 # Optional. By default its 5. You will get this much records per page.
end

OR

@crawler = MarvelCrawler.client

@crawler.api_key = 'YOUR_API_KEY'
@crawler.private_key = 'YOUR_PRIVATE_KEY'
@crawler.record_per_page = 2 # Optional. By default its 5. You will get this much records per page.

Usage

Below are the examples of supported resources. All the methods returns an object of MarvelCrawler::ApiResponse

Characters

@crawler.get_characters(page_num: 2) # Default page number is 1
@crawler.get_characters(name: 'A.I.M.', page_num: 2)
@crawler.get_characters(nameStartsWith: 'A', orderBy: 'modified')
@crawler.get_character(id: 1009144)

Comics

@crawler.get_comics(page_num: 2) # Default page number is 1
@crawler.get_comics(title: 'UNIVERSE X SPECIAL: CAP 1 (2001)')
@crawler.get_comics(format: 'magazine')

Creators

@crawler.get_creators(page_num: 2) # Default page number is 1

Events

@crawler.get_events(page_num: 2) # Default page number is 1

Series

@crawler.get_series(page_num: 2) # Default page number is 1

Stories

@crawler.get_stories(page_num: 2) # Default page number is 1

Response

All the methods returns an object of MarvelCrawler::ApiResponse The object contains following attributes:

response.code       => Http code returned from api
response.status     => Status returned from api
response.results    => Contains all the data for the resource
response.etag       => etag returned from api
response.offset     => offset returned from api
response.limit      => limit returned from api which we have used
response.total      => Total number of result available for this resource
response.count      => Total number of result set returned by this call
response.message    => Success OR Error message

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/ketandoshi/marvel_crawler. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the MarvelCrawler project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

FAQs

Package last updated on 17 Apr 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc