A fully restful API to get contents of a url
- clone project
- rake create db
- install bundles
- run rspec
- dive in
- Postgresql for db
- Ruby 2.3.1
- Rails 5
create
: post "/contents", params: {content: {page__url: "http://some_url"}}show
: get "/contents/:id"index
(list): get "/contents"destroy
: delete "/contents/:id"
An optional "paginate" param can be supplied to the index
(list) endpoint, and if set to true, will activate the pagination feature on this API.
When activated, the "per__page"(number of resources per page) is gotten from configurations, while a "page_count" param can also be set in request, to request a specific page
Example request: get "/contents?paginate=true&page_count=4"
Note: "page_count" defaults to 0 => the first page
Also, when pagination is activated, the API response will have a boolean "next_page" attribute, to show if there are more resources after the requested page.
When the provided url is in-accessible for any reason, the create
endpoint API response has a "unable to successfully parse page url" failure message.