Skip to content

Example Rail application using scrapify/jsonify gem to scrap static sites and use them as models or expose them as JSON APIs

Notifications You must be signed in to change notification settings

sathish316/jsonify_rails_example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ScrApify

ScrApify is a gem which scraps static html pages and exposes them as JSON APIs

This is a sample Rails application using scrapify to expose data in static page via Models or JSON APIs

JSON API (Rails example)

Scrapify comes with a Rack application called Jsonify which can be used in rails routes to expose scraped models as JSON.

1 Add scrapify to Gemfile

gem 'scrapify'

2 Define model to scrap data in app/models

class Pizza
  include Scrapify::Base
end

3 Model can be used to scrap and read data in the controller

Pizza.all

pizza = Pizza.find('mushroom')
pizza.name
pizza.image_url

4 Add index and show url to routes

  pizza_api = Jsonify.new('/pizzas', Pizza)
  get 'pizzas' => pizza_api
  get 'pizzas/:id' => pizza_api

Jsonify scraps url and exposes index and show as JSON APIs

About

Example Rail application using scrapify/jsonify gem to scrap static sites and use them as models or expose them as JSON APIs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published