Ruby client for MovieQuotes API
Docs here
- Fetch well known quotes from more than 500 movies.
- Search through movie quotes by
actors
,characters
,movies
,genres
,years
and even pieces of quotes. - Intuitive API interface navigation.
- URL generation process fully tested when applying filters for each request.
- API integration tests recorded and fully tested using VCR gem: fast tests (first HTTP request is real and it's response is stored for future runs), deterministic (tests will continue to pass, even if you are offline, or API goes down for maintenance) and accurate (responses will contain the same headers and body you get from a real request).
Install the gem by running:
gem install movie_quotes
or put it in your Gemfile and run bundle install
:
gem "movie_quotes", "~> 0.1.3"
To start using the gem, you should get an API Key (free).
Once completed this quick form the API Key will be sent to you by Juan Roldan (juanroldan1989@gmail.com
)
Setup the API Key within an initializer:
# movie_quotes_initializer.rb
MovieQuotes.configure do |config|
config.api_key = "abcd1234"
end
Then create a new filter instance like so:
filter = MovieQuotes.new
and then call api methods, for instance, to fetch well known movie quotes from actors
like Al Pacino
:
filter.by_actor("al pacino")
or charachters
like morpheus
:
filter.by_character("morpheus")
or movies
like Die Hard
and actors
like Bruce Willis
:
filter.by_movie("die hard").by_actor("bruce willis")
Once applied all the filters you need, make the API call to get the quotes:
filter.results
To see a full list of examples please check the wiki page.
The response format is JSON by default. Results are provided as an array of objects with the following structure:
filter = MovieQuotes.new
filter.by_movie("die hard").by_actor("bruce willis")
filter.results
=> [
{
"content": "Yippie-ki-yay, motherfucker!",
"rating": 5,
"year": 1988,
"categories": [
"Thriller",
"Crime",
"Action"
],
"image_large_url": "https://i.ytimg.com/vi/YfpDSNNgYhI/hqdefault.jpg",
"image_thumb_url": "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcRlniyMNhCV4h8UF9zn6Lka4s-OTU_j7Br43Kp5OR7eGljOAIpDXKystfQ",
"movie": {
"title": "Die Hard",
"slug": "die-hard"
},
"character": {
"name": "John Mc Clane",
"slug": "john-mc-clane"
},
"actor": {
"name": "Bruce Willis",
"slug": "bruce-willis"
}
}
]
Questions or problems? Please post them on the issue tracker. You can contribute changes by forking the project and submitting a pull request. You can ensure the tests are passing by running bundle
and rake
.
Developers around the world using MovieQuotes API with their projects:
pic | @mention | area |
---|---|---|
@djibba22 | building some workflows for personal use with the Workflow app on iOS | |
@snowfrogdev | developing a non-commercial app about movies | |
@jargoglesara | developing a Google Assistant action to interact with the API | |
@GregJacobs82 | developing a sort of "quiz" where a player is supposed to guess who said something and I tought that quotes from movies would be much easier for everyone than other random quotes | |
@eDubrovsky | practicing API's and gem documentation's in Rails (newbie lvl), and I was searching on rubygems.org when I found yours. Looks straight forward to use :) | |
@pyremell | I am IT student and I developing a project for a course. I would love to have an API key for your Movie Quotes app, so I could make small searches, based in the movie name, to retrieve some famous quotes from that movie. | |
@shmlkv | School project, it will display movie info and showtimes in cinemas asweel as quotes from actors | |
@KaiRichardson | A JavaScript/React project built as part of the requirements for completion of the Javascript/React course at Code Louisville: https://github.com/brevans25/Vide-Video | |
@alexandershin | Random Quote machine (FreeCodeCamp course project) | |
@alex-perez | The API will be use for a practicing application. An intern will come in my compagny in next week. He will build a simple app using this api | |
@shadowM8 | I want to generate random quotes to show on a daily basis for my school project | |
@AsafDavidov | Movie Trivia Game for the School I am studying at. | |
@suhanw | I'm integrating your API with and React.js and Redux framework. | |
@denisbobovnik | learning about APIs and making requests with Ruby : ) |
Copyright © 2020 Juan Roldan. See LICENSE.txt for further details.