Class: ElephantInTheRoom::TheOneApiSdk::ApiPaths::Movies
- Includes:
- Constants
- Defined in:
- lib/elephant_in_the_room/the_one_api_sdk/api_paths/movies.rb
Overview
Queries related to /movie
Constant Summary
Constants included from Constants
Constants::EXPONENTIAL_BACKOFF_TIME_DIVISOR, Constants::MOVIE_PATH, Constants::QUOTE_PATH
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#quotes_from_movie(id) ⇒ Object
Find all quotes for a given movie.
-
#quotes_from_movie_name(name) ⇒ Object
Lookup a movie by name and get all quotes from it.
Methods inherited from Base
Methods included from Pipeline::PipelineModifiers
#replace_existing_stage, #with_filters, #with_pagination, #with_path
Constructor Details
This class inherits a constructor from ElephantInTheRoom::TheOneApiSdk::ApiPaths::Base
Instance Method Details
#quotes_from_movie(id) ⇒ Object
Find all quotes for a given movie
16 17 18 19 20 |
# File 'lib/elephant_in_the_room/the_one_api_sdk/api_paths/movies.rb', line 16 def quotes_from_movie(id) with_path(@pipeline, quote_path(id)) do |pipeline| execute_pipeline(pipeline, {}) end end |
#quotes_from_movie_name(name) ⇒ Object
Lookup a movie by name and get all quotes from it
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/elephant_in_the_room/the_one_api_sdk/api_paths/movies.rb', line 24 def quotes_from_movie_name(name) movies = with_filters(@pipeline, ["name=#{name}"]) do |filtered_pipeline| with_pagination(filtered_pipeline, limit: 1) do |paginated_pipeline| execute_pipeline(paginated_pipeline, {}) end end raise "Movie named #{name} not found" if movies[:items].empty? matching_movie = movies[:items][0] quotes_from_movie(matching_movie[:_id]) end |