Module: Movieman::RottenTomatoes

Extended by:
RottenTomatoes
Included in:
RottenTomatoes
Defined in:
lib/movieman/rotten_tomatoes.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



8
9
10
# File 'lib/movieman/rotten_tomatoes.rb', line 8

def api_key
  @api_key
end

#fObject

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