badfruit 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest CHANGED
@@ -2,6 +2,7 @@ LICENSE
2
2
  Manifest
3
3
  README.md
4
4
  Rakefile
5
+ badfruit.gemspec
5
6
  lib/badfruit.rb
6
7
  lib/badfruit/Actors/actor.rb
7
8
  lib/badfruit/Lists/lists.rb
data/README.md CHANGED
@@ -15,12 +15,12 @@ Usage
15
15
 
16
16
  So there are two main parts of the api, movies and lists. Each of these parts return movie objects, but they are in different contexts. For example. (bf is a BadFruit client instance).
17
17
 
18
- >bf.lists.newDVDReleases
18
+ >bf.lists.new_dvd_releases
19
19
 
20
20
  Will return you an array of movie objects that represent that latest dvd releases. From this array you can execute actions on the individual movies themselves like...
21
21
 
22
- >movies = bf.lists.newDVDReleases
23
- movies[0].fullCast
22
+ >movies = bf.lists.new_dvd_releases
23
+ movies[0].full_cast
24
24
  movies[0].reviews
25
25
 
26
26
  Very similar to the actual movie section of the api which I've included an example below...
@@ -28,11 +28,11 @@ Very similar to the actual movie section of the api which I've included an examp
28
28
  >require 'badfruit'
29
29
  bf = BadFruit.new("YOUR_API_KEY_HERE")
30
30
  movies = bf.movies.search_by_name("Hackers")
31
- cast = movies[0].fullCast
31
+ cast = movies[0].full_cast
32
32
  reviews = movies[0].reviews
33
33
 
34
34
  This should get you started, I should also mention that there are probably more tweaks needed to the list part of the api, but it should work for most people. Feel free to contact me or open an issue if need be.
35
35
 
36
36
  Version
37
37
  --------
38
- The current version of the gem is 0.0.4, I could probably bump it to a 1.0 but..umm, well...who cares.
38
+ The current version of the gem is 0.0.5, I could probably bump it to a 1.0 but..umm, well...who cares.
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('badfruit', '0.0.4') do |p|
5
+ Echoe.new('badfruit', '0.0.5') do |p|
6
6
  p.description = "Interface with the Rotten Tomatoes API"
7
7
  p.url = "http://www.github.com/brianmichel/badfruit"
8
8
  p.author = "Brian Michel"
data/badfruit.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{badfruit}
5
- s.version = "0.0.4"
5
+ s.version = "0.0.5"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Brian Michel"]
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.description = %q{Interface with the Rotten Tomatoes API}
11
11
  s.email = %q{brian.michel@gmail.com}
12
12
  s.extra_rdoc_files = ["LICENSE", "README.md", "lib/badfruit.rb", "lib/badfruit/Actors/actor.rb", "lib/badfruit/Lists/lists.rb", "lib/badfruit/Movies/movie.rb", "lib/badfruit/Movies/movies.rb", "lib/badfruit/Posters/posters.rb", "lib/badfruit/Reviews/review.rb", "lib/badfruit/Scores/scores.rb", "lib/badfruit/base.rb"]
13
- s.files = ["LICENSE", "Manifest", "README.md", "Rakefile", "lib/badfruit.rb", "lib/badfruit/Actors/actor.rb", "lib/badfruit/Lists/lists.rb", "lib/badfruit/Movies/movie.rb", "lib/badfruit/Movies/movies.rb", "lib/badfruit/Posters/posters.rb", "lib/badfruit/Reviews/review.rb", "lib/badfruit/Scores/scores.rb", "lib/badfruit/base.rb", "badfruit.gemspec"]
13
+ s.files = ["LICENSE", "Manifest", "README.md", "Rakefile", "badfruit.gemspec", "lib/badfruit.rb", "lib/badfruit/Actors/actor.rb", "lib/badfruit/Lists/lists.rb", "lib/badfruit/Movies/movie.rb", "lib/badfruit/Movies/movies.rb", "lib/badfruit/Posters/posters.rb", "lib/badfruit/Reviews/review.rb", "lib/badfruit/Scores/scores.rb", "lib/badfruit/base.rb"]
14
14
  s.homepage = %q{http://www.github.com/brianmichel/badfruit}
15
15
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Badfruit", "--main", "README.md"]
16
16
  s.require_paths = ["lib"]
@@ -4,20 +4,20 @@ module BadFruit
4
4
  @badfruit = badfruit
5
5
  end
6
6
 
7
- def openingMovies
8
- return @badfruit.parseMoviesArray(JSON.parse(@badfruit.get_lists_action("opening")))
7
+ def opening_movies
8
+ return @badfruit.parse_movies_array(JSON.parse(@badfruit.get_lists_action("opening")))
9
9
  end
10
10
 
11
- def upcomingMovies
12
- return @badfruit.parseMoviesArray(JSON.parse(@badfruit.get_lists_action("upcoming")))
11
+ def upcoming_movies
12
+ return @badfruit.parse_movies_array(JSON.parse(@badfruit.get_lists_action("upcoming")))
13
13
  end
14
14
 
15
- def inTheaters
16
- return @badfruit.parseMoviesArray(JSON.parse(@badfruit.get_lists_action("in_theaters")))
15
+ def in_theaters
16
+ return @badfruit.parse_movies_array(JSON.parse(@badfruit.get_lists_action("in_theaters")))
17
17
  end
18
18
 
19
- def newDVDReleases
20
- return @badfruit.parseMoviesArray(JSON.parse(@badfruit.get_lists_action("new_releases")))
19
+ def new_dvd_releases
20
+ return @badfruit.parse_movies_array(JSON.parse(@badfruit.get_lists_action("new_releases")))
21
21
  end
22
22
  end
23
23
  end
@@ -6,21 +6,17 @@ module BadFruit
6
6
  @id = movieHash["id"]
7
7
  @name = movieHash["title"]
8
8
  @cast = movieHash["abridged_cast"]
9
- @scores = Scores.new(movieHash["ratings"])
10
- @posters = Posters.new(movieHash["posters"])
9
+ @scores = Scores.new(movieHash["ratings"]) #single score object containing two scores
10
+ @posters = Posters.new(movieHash["posters"]) #single posters object containing four poster urls
11
11
  @badfruit = badfruit
12
12
  end
13
-
14
- def averageScores
15
- puts "average!"
16
- end
17
-
18
- # for the three following methods, pass in your BadFruit client instance to retreive the info
19
- # this will be fixed when all results are parsed into movie assets for the user
20
- def fullCast
21
- return @badfruit.parseActorsArray(JSON.parse(@badfruit.get_movie_info(@id, "cast")))
13
+
14
+ #returns an array of Actor objects
15
+ def full_cast
16
+ return @badfruit.parse_actors_array(JSON.parse(@badfruit.get_movie_info(@id, "cast")))
22
17
  end
23
-
18
+
19
+ #returns an array of Review objects
24
20
  def reviews
25
21
  data = JSON.parse(@badfruit.get_movie_info(@id, "reviews"))
26
22
  reviews = Array.new
@@ -6,11 +6,12 @@ module BadFruit
6
6
  @badfruit = badfruit
7
7
  end
8
8
 
9
+ #returns an array of movie objects from the given search result.
9
10
  def search_by_name(name, page_limit=1, page=1)
10
11
  if page_limit > 50
11
12
  page_limit = MAX_PAGE_LIMIT #current limitation of the rotten tomatos API
12
13
  end
13
- return @badfruit.parseMoviesArray(JSON.parse(@badfruit.search_movies(name, page_limit, page)))
14
+ return @badfruit.parse_movies_array(JSON.parse(@badfruit.search_movies(name, page_limit, page)))
14
15
  end
15
16
  end
16
17
  end
@@ -6,6 +6,6 @@ class Scores
6
6
  end
7
7
 
8
8
  def average
9
- return ((@critics_score + @audience_score) / 2)
9
+ return ((@critics_score + @audience_score) / 2) #ultimate math skillz.
10
10
  end
11
11
  end
data/lib/badfruit/base.rb CHANGED
@@ -66,7 +66,7 @@ module BadFruit
66
66
  end
67
67
 
68
68
  #Utility Methods For Parsing
69
- def parseMoviesArray(hash)
69
+ def parse_movies_array(hash)
70
70
  moviesArray = Array.new
71
71
  hash["movies"].each do |movie|
72
72
  moviesArray.push(Movie.new(movie, self))
@@ -74,7 +74,7 @@ module BadFruit
74
74
  return moviesArray
75
75
  end
76
76
 
77
- def parseActorsArray(hash)
77
+ def parse_actors_array(hash)
78
78
  actorsArray = Array.new
79
79
  hash["cast"].each do |actor|
80
80
  actorsArray.push(Actor.new(actor))
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: badfruit
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.4
5
+ version: 0.0.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Brian Michel
@@ -57,6 +57,7 @@ files:
57
57
  - Manifest
58
58
  - README.md
59
59
  - Rakefile
60
+ - badfruit.gemspec
60
61
  - lib/badfruit.rb
61
62
  - lib/badfruit/Actors/actor.rb
62
63
  - lib/badfruit/Lists/lists.rb
@@ -66,7 +67,6 @@ files:
66
67
  - lib/badfruit/Reviews/review.rb
67
68
  - lib/badfruit/Scores/scores.rb
68
69
  - lib/badfruit/base.rb
69
- - badfruit.gemspec
70
70
  homepage: http://www.github.com/brianmichel/badfruit
71
71
  licenses: []
72
72