Module: Movieman::RottenTomatoes
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#f ⇒ Object
Returns the value of attribute f.
Class Method Summary collapse
- .cast(id) ⇒ Object
- .config(&block) ⇒ Object
- .movie(id) ⇒ Object
- .search(q, page_limit = 0, page = 0) ⇒ Object
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
8 9 10 |
# File 'lib/movieman/rotten_tomatoes.rb', line 8 def api_key @api_key end |
#f ⇒ Object
Returns the value of attribute f.
8 9 10 |
# File 'lib/movieman/rotten_tomatoes.rb', line 8 def f @f end |
Class Method Details
.cast(id) ⇒ Object
24 25 26 |
# File 'lib/movieman/rotten_tomatoes.rb', line 24 def self.cast id f.get "/api/public/v1.0/movies/#{id}/cast.json?apikey=#{api_key}" end |
.config(&block) ⇒ Object
10 |
# File 'lib/movieman/rotten_tomatoes.rb', line 10 def self.config(&block) instance_eval(&block); end |
.movie(id) ⇒ Object
20 21 22 |
# File 'lib/movieman/rotten_tomatoes.rb', line 20 def self.movie id f.get "/api/public/v1.0/movies/#{id}.json?apikey=#{api_key}" end |
.search(q, page_limit = 0, page = 0) ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/movieman/rotten_tomatoes.rb', line 28 def self.search q, page_limit=0, page=0 f.get do |r| r.url "/api/public/v1.0/movies.json" r.params['q'] = q r.params['api_key'] = api_key r.params['page_limit'] = page_limit unless page_limit == 0 r.params['page'] = page unless page == 0 end end |