tomato_power 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -25,6 +25,8 @@ Create a `TomatoPower::Client`.
25
25
 
26
26
  ## Examples
27
27
 
28
+ Check out the [Wiki](https://github.com/seankay/tomato_power/wiki) for more details.
29
+
28
30
  Search for a movie by title or IMDB id.
29
31
 
30
32
  >> movies = client.search_by_title("The Dark Knight")
@@ -57,6 +59,15 @@ Get posters of a movie:
57
59
 
58
60
  >> posters = movie.posters.thumbnail
59
61
  => "http://content6.flixster.com/movie/11/16/51/11165160_mob.jpg"
62
+
63
+ Get reviews of a movie:
64
+
65
+ >> reviews = movie.reviews
66
+ >> reviews[0].freshness
67
+ => "fresh"
68
+ >> reviews[0].quote
69
+ => "Christopher Nolan is much, much smarter than your average filmmaker."
70
+
60
71
  ## Contributing
61
72
 
62
73
  1. Fork it
@@ -2,19 +2,18 @@ require 'active_support/core_ext/hash'
2
2
  require 'open-uri'
3
3
 
4
4
  module TomatoPower
5
- # The main API class to interface with the Rotten Tomatoes API
5
+ # API class to interface with Client
6
6
  #
7
- # Handles all API calls
8
7
  class API
9
8
 
10
9
  def initialize api_key
11
10
  @api_key = api_key
12
11
  end
13
12
 
14
- #Defines methods that are in TOMATO_METHODS (tomato_methods.rb)
13
+ #Defines methods that are in TOMATO_METHODS
15
14
  #
16
- #@param method Method to be created.
17
- #@param options [Hash] optional options being passed to the function call.
15
+ #@param method [Symbol] method to be created.
16
+ #@param options [Hash] options for function call.
18
17
  #@note TOMATO_METHODS is a hash containing all of the Rotten Tomatoes API calls.
19
18
  def method_missing method, options={}
20
19
  if TOMATO_METHODS.key?(method)
@@ -28,7 +27,7 @@ module TomatoPower
28
27
  end
29
28
 
30
29
  # Whether or not this class responds to a function.
31
- # Obligatory when dynamically creating functions with :define_method
30
+ #
32
31
  # @param method method in question.
33
32
  # @return [true, false]
34
33
  def respond_to? method
@@ -15,7 +15,7 @@ module TomatoPower
15
15
  #
16
16
  #@param endpoint [String] API url.
17
17
  #@param api_key [String] Client API key
18
- #@param options [Hash] optins for the API call
18
+ #@param options [Hash] options for the API call
19
19
  #@return (see #parse)
20
20
  def self.fetch endpoint, api_key, options={}
21
21
  tomato = get api_url(endpoint, api_key, options)
@@ -28,7 +28,7 @@ module TomatoPower
28
28
  #
29
29
  # @param movie_title [String] The movie title to search for
30
30
  # @param options [Hash] An optional hash for passing options to the API.
31
- # @note See {http://developer.rottentomatoes.com/ Rotten Tomatoes API} possible options.
31
+ # @note See {http://developer.rottentomatoes.com/ Rotten Tomatoes API} for possible options.
32
32
  def search_by_title(movie_title, options={})
33
33
  options[:q] = movie_title
34
34
  @api.movies_search(options)
@@ -39,7 +39,7 @@ module TomatoPower
39
39
  # @param movie_id [String] movie's id
40
40
  def search_by_id(movie_id)
41
41
  options = {}
42
- options[:type] = 'imdb' #current only supports 'imdb' type
42
+ options[:type] = 'imdb'
43
43
  options[:id] = movie_id
44
44
  @api.movie_alias(options)
45
45
  end
@@ -1,5 +1,3 @@
1
- require 'yaml'
2
-
3
1
  # Contains helper functions
4
2
  module Helpers
5
3
  # Determines whether or not a string is a valid url
@@ -4,7 +4,7 @@ module TomatoPower
4
4
  #Parses a json object into a Tomato Power object.
5
5
  #
6
6
  #@param json [JSON] json object from API call response
7
- #@return payload [Array] array of parsed Tomato Power objects
7
+ #@return payload [Array] array of parsed TomatoPower objects
8
8
  def self.parse json
9
9
  payload =[]
10
10
  if json["movies"]
@@ -4,7 +4,7 @@ module TomatoPower
4
4
 
5
5
  attr_reader :id, :info, :title, :ratings, :mpaa_rating,
6
6
  :runtime,:release_dates, :synopsis, :alternate_ids, :links,
7
- :studio, :abridged_directors
7
+ :studio, :directors
8
8
 
9
9
  def initialize movie={}
10
10
  @api = TomatoPower::api
@@ -21,7 +21,7 @@ module TomatoPower
21
21
  @abridged_cast = movie["abridged_cast"]
22
22
  @alternate_ids = movie["alternate_ids"]
23
23
  @links = movie["links"]
24
- @abridged_directors = movie["abridged_directors"]
24
+ @directors = movie["abridged_directors"]
25
25
  @studio = movie["studio"]
26
26
  end
27
27
 
@@ -37,14 +37,14 @@ module TomatoPower
37
37
  # Poster for a movie
38
38
  # @return poster links
39
39
  def posters
40
- posters ||= TomatoPower::Parser::parse_posters @posters
40
+ @poster_links ||= TomatoPower::Parser::parse_posters @posters
41
41
  end
42
42
 
43
43
  # cast from a movie
44
44
  #
45
45
  # @note this returns the abridged cast.
46
46
  def cast
47
- actors ||= TomatoPower::Parser::parse_cast @abridged_cast
47
+ @actors ||= TomatoPower::Parser::parse_cast @abridged_cast
48
48
  end
49
49
 
50
50
  def method_missing method, options={}
@@ -60,7 +60,7 @@ module TomatoPower
60
60
  end
61
61
 
62
62
  def respond_to? method
63
- if MOVIE_METHOD_ALIAS.keys.include? method
63
+ if MOVIE_METHOD_ALIAS.key? method
64
64
  true
65
65
  else
66
66
  super
@@ -1,3 +1,3 @@
1
1
  module TomatoPower
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
data/tomato_power.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
10
10
  gem.email = ["f.sean.kay@gmail.com\n"]
11
11
  gem.description = %q{RottenTomatoes API wrapper}
12
12
  gem.summary = %q{Easily access Rotten Tomatoes API methods}
13
- gem.homepage = ""
13
+ gem.homepage = "https://github.com/seankay/tomato_power"
14
14
 
15
15
  gem.add_dependency "active_support"
16
16
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tomato_power
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -194,7 +194,7 @@ files:
194
194
  - spec/unit_specs/movie/review_spec.rb
195
195
  - spec/unit_specs/tomato_power_spec.rb
196
196
  - tomato_power.gemspec
197
- homepage: ''
197
+ homepage: https://github.com/seankay/tomato_power
198
198
  licenses: []
199
199
  post_install_message:
200
200
  rdoc_options: []