badfruit 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('badfruit', '1.1.1') do |p|
5
+ Echoe.new('badfruit', '1.1.2') 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
@@ -1,24 +1,22 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  Gem::Specification.new do |s|
4
- s.name = %q{badfruit}
5
- s.version = "1.1.1"
4
+ s.name = "badfruit"
5
+ s.version = "1.1.2"
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"]
9
- s.cert_chain = ["/Users/brianmichel/gem-public_cert.pem"]
10
- s.date = %q{2011-08-05}
11
- s.description = %q{Interface with the Rotten Tomatoes API}
12
- s.email = %q{brian.michel@gmail.com}
9
+ s.date = "2012-04-21"
10
+ s.description = "Interface with the Rotten Tomatoes API"
11
+ s.email = "brian.michel@gmail.com"
13
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"]
14
13
  s.files = ["LICENSE", "Manifest", "README.md", "Rakefile", "features/client_creation.feature", "features/client_query.feature", "features/client_reviews.feature", "features/step_definitions/step_definitions.rb", "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"]
15
- s.homepage = %q{http://www.github.com/brianmichel/badfruit}
14
+ s.homepage = "http://www.github.com/brianmichel/badfruit"
16
15
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Badfruit", "--main", "README.md"]
17
16
  s.require_paths = ["lib"]
18
- s.rubyforge_project = %q{badfruit}
19
- s.rubygems_version = %q{1.7.2}
20
- s.signing_key = %q{/Users/brianmichel/gem-private_key.pem}
21
- s.summary = %q{Interface with the Rotten Tomatoes API}
17
+ s.rubyforge_project = "badfruit"
18
+ s.rubygems_version = "1.8.22"
19
+ s.summary = "Interface with the Rotten Tomatoes API"
22
20
 
23
21
  if s.respond_to? :specification_version then
24
22
  s.specification_version = 3
@@ -23,5 +23,9 @@ module BadFruit
23
23
  def current_dvd_releases
24
24
  return @badfruit.parse_movies_array(JSON.parse(@badfruit.get_lists_action("current_releases")))
25
25
  end
26
+
27
+ def upcoming_dvd_releases
28
+ return @badfruit.parse_movies_array(JSON.parse(@badfruit.get_lists_action("upcoming_dvds")))
29
+ end
26
30
  end
27
31
  end
@@ -1,7 +1,7 @@
1
1
  module BadFruit
2
2
  class Movie
3
3
  attr_accessor :id, :name, :year, :genres, :mpaa_rating, :runtime, :release_dates,
4
- :synopsis, :cast, :directors, :scores, :posters
4
+ :synopsis, :cast, :directors, :scores, :posters, :links
5
5
 
6
6
  def initialize(movieHash, badfruit)
7
7
  @id = movieHash["id"]
@@ -12,11 +12,13 @@ module BadFruit
12
12
  @runtime = movieHash["runtime"]
13
13
  @release_dates = movieHash["release_dates"]
14
14
  @synopsis = movieHash["synopsis"]
15
- @cast = movieHash["abridged_cast"]
15
+ @cast = movieHash["abridged_cast"]
16
16
  @directors = movieHash["abridged_directors"]
17
+ @links = movieHash["links"]
17
18
  @scores = Scores.new(movieHash["ratings"]) #single score object containing two scores
18
19
  @posters = Posters.new(movieHash["posters"]) #single posters object containing four poster urls
19
20
  @badfruit = badfruit
21
+ @moviehash = movieHash
20
22
  end
21
23
 
22
24
  #returns an array of Actor objects
@@ -35,7 +37,7 @@ module BadFruit
35
37
  end
36
38
 
37
39
  def info
38
- return JSON.parse(@badfruit.get_movie_info(@id, "details"))
40
+ @moviehash
39
41
  end
40
42
  end
41
43
  end
@@ -17,10 +17,18 @@ module BadFruit
17
17
  # search by id
18
18
  def search_by_id(movie_id)
19
19
  movie = @badfruit.get_movie_info(movie_id, "main")
20
- raise 'Movie not found' if movie.blank?
20
+ raise 'Movie not found' if movie.nil? || movie.empty?
21
21
  @badfruit.parse_movie_array(JSON.parse(movie))
22
22
  end
23
23
 
24
+ # search by alias (currently only IMDB is supported)
25
+ def search_by_alias(alias_id,type='imdb')
26
+ movie = @badfruit.get_movie_alias_info(alias_id, type)
27
+ json = JSON.parse(movie)
28
+ raise 'Movie not found' if !json['error'].nil?
29
+ @badfruit.parse_movie_array(json)
30
+ end
31
+
24
32
  # similar movie
25
33
  def similar_movies(movie_id)
26
34
  return @badfruit.parse_movies_array(JSON.parse(@badfruit.similar_movies(movie_id)))
data/lib/badfruit/base.rb CHANGED
@@ -2,8 +2,9 @@ module BadFruit
2
2
  class Base
3
3
  attr_accessor :api_key
4
4
  API_VERSION = "v1.0"
5
- MOVIE_DETAIL_BASE_URL = "http://api.rottentomatoes.com/api/public/#{API_VERSION}/movies"
6
- LISTS_DETAIL_BASE_URL = "http://api.rottentomatoes.com/api/public/#{API_VERSION}/lists"
5
+ API_BASE_URL = "http://api.rottentomatoes.com/api/public/#{API_VERSION}"
6
+ MOVIE_DETAIL_BASE_URL = "#{API_BASE_URL}/movies"
7
+ LISTS_DETAIL_BASE_URL = "#{API_BASE_URL}/lists"
7
8
 
8
9
  def movies(); @movie || BadFruit::Movies.new(self); end
9
10
  def lists(); @list || BadFruit::Lists.new(self); end
@@ -43,6 +44,11 @@ module BadFruit
43
44
  return get(url)
44
45
  end
45
46
 
47
+ def get_movie_alias_info(alias_id, type)
48
+ url = "#{API_BASE_URL}/movie_alias.json?id=#{CGI::escape(alias_id)}&type=#{CGI::escape(type)}&apikey=#{@api_key}"
49
+ return get(url)
50
+ end
51
+
46
52
  def get_lists_action(action)
47
53
  url = nil
48
54
  case action
@@ -56,6 +62,8 @@ module BadFruit
56
62
  url = "#{LISTS_DETAIL_BASE_URL}/movies/in_theaters.json?apikey=#{@api_key}"
57
63
  when "current_releases"
58
64
  url = "#{LISTS_DETAIL_BASE_URL}/dvds/current_releases.json?apikey=#{@api_key}"
65
+ when "upcoming_dvds"
66
+ url = "#{LISTS_DETAIL_BASE_URL}/dvds/upcoming.json?apikey=#{@api_key}"
59
67
  else
60
68
  puts "Not a valid action"
61
69
  return
metadata CHANGED
@@ -1,78 +1,69 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: badfruit
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.2
4
5
  prerelease:
5
- version: 1.1.1
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Brian Michel
9
9
  autorequire:
10
10
  bindir: bin
11
- cert_chain:
12
- - |
13
- -----BEGIN CERTIFICATE-----
14
- MIIDOjCCAiKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBDMRUwEwYDVQQDDAxicmlh
15
- bi5taWNoZWwxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkW
16
- A2NvbTAeFw0xMTA0MTcyMDI0NThaFw0xMjA0MTYyMDI0NThaMEMxFTATBgNVBAMM
17
- DGJyaWFuLm1pY2hlbDEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPy
18
- LGQBGRYDY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA5cchExCg
19
- Hd69HKgtJ0S+D/bM2HAVo4NXS05bSfTjmUKjsA2z74zJ0zMqVRD/hnqjpdqZzVUS
20
- J1h9qaA/W/mUvctKYsLWRjpNQfQIijSnORqSL2+TZJsYbeWGqjsSoIJ4D6ItRaQM
21
- 8sSgADNFB65SIVkr+tfMRB2aR7BkqH3mhhGOxPPZzgqqYiRsRtxQXPTMToBx4qWl
22
- OKNIjJstMdgAZnkgb0OOchorUSzxnd5i79CDQsIm2uGT3BKVrny8fCfgHnAfoqC9
23
- mlmD7p0msgT0I7VPLWqfFNVY0GK2D1r1u8xCFh0hHVG9Q4KTCkZbRAeH3ROrvb7E
24
- qtxlRMiOCP9U8QIDAQABozkwNzAJBgNVHRMEAjAAMB0GA1UdDgQWBBSWGHbMmXV5
25
- N9FI14B6O0/b+VxVSzALBgNVHQ8EBAMCBLAwDQYJKoZIhvcNAQEFBQADggEBAD00
26
- RNOEOntX+gPkfj7YrDp3ySRavY+ePbsnHc422W2/Z/BOIWvRMFgL4DkgrgUdrUcv
27
- W30HR5XxmOxW0yhVWIJz/xLw2SyXVzMmWnSPXcZ7KzVzYHgGPIt8CZPzR39AGBxr
28
- yRRlxiqH7BgFzH9VkyXUAbx8O86YpTXZ1yXe6UijkuJTbrQ31jRo9QjSWa0sFnQn
29
- DFj3tzlB8+UnHvCV/X9s61B77aCONi8rEDZ0mBTbbWNXj9e1HDo8QIsPj0cs2u/L
30
- sooatL31MCdYuKj7Uno8Xt6BCYzn5gEuo98AyedB+XpImFvrNeTUltSVwlCVwFaE
31
- BcUuq0IKVG0Sd9yo6rY=
32
- -----END CERTIFICATE-----
33
-
34
- date: 2011-08-05 00:00:00 Z
35
- dependencies:
36
- - !ruby/object:Gem::Dependency
11
+ cert_chain: []
12
+ date: 2012-04-21 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
37
15
  name: json
38
- prerelease: false
39
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
40
17
  none: false
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
45
22
  type: :runtime
46
- version_requirements: *id001
47
- - !ruby/object:Gem::Dependency
48
- name: httparty
49
23
  prerelease: false
50
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
51
25
  none: false
52
- requirements:
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- version: "0"
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: httparty
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
56
38
  type: :runtime
57
- version_requirements: *id002
58
- - !ruby/object:Gem::Dependency
59
- name: cucumber
60
39
  prerelease: false
61
- requirement: &id003 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
62
41
  none: false
63
- requirements:
64
- - - ">="
65
- - !ruby/object:Gem::Version
66
- version: "0"
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: cucumber
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
67
54
  type: :development
68
- version_requirements: *id003
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
69
62
  description: Interface with the Rotten Tomatoes API
70
63
  email: brian.michel@gmail.com
71
64
  executables: []
72
-
73
65
  extensions: []
74
-
75
- extra_rdoc_files:
66
+ extra_rdoc_files:
76
67
  - LICENSE
77
68
  - README.md
78
69
  - lib/badfruit.rb
@@ -84,7 +75,7 @@ extra_rdoc_files:
84
75
  - lib/badfruit/Reviews/review.rb
85
76
  - lib/badfruit/Scores/scores.rb
86
77
  - lib/badfruit/base.rb
87
- files:
78
+ files:
88
79
  - LICENSE
89
80
  - Manifest
90
81
  - README.md
@@ -105,35 +96,32 @@ files:
105
96
  - badfruit.gemspec
106
97
  homepage: http://www.github.com/brianmichel/badfruit
107
98
  licenses: []
108
-
109
99
  post_install_message:
110
- rdoc_options:
100
+ rdoc_options:
111
101
  - --line-numbers
112
102
  - --inline-source
113
103
  - --title
114
104
  - Badfruit
115
105
  - --main
116
106
  - README.md
117
- require_paths:
107
+ require_paths:
118
108
  - lib
119
- required_ruby_version: !ruby/object:Gem::Requirement
109
+ required_ruby_version: !ruby/object:Gem::Requirement
120
110
  none: false
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: "0"
125
- required_rubygems_version: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - ! '>='
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
115
+ required_rubygems_version: !ruby/object:Gem::Requirement
126
116
  none: false
127
- requirements:
128
- - - ">="
129
- - !ruby/object:Gem::Version
130
- version: "1.2"
117
+ requirements:
118
+ - - ! '>='
119
+ - !ruby/object:Gem::Version
120
+ version: '1.2'
131
121
  requirements: []
132
-
133
122
  rubyforge_project: badfruit
134
- rubygems_version: 1.7.2
123
+ rubygems_version: 1.8.22
135
124
  signing_key:
136
125
  specification_version: 3
137
126
  summary: Interface with the Rotten Tomatoes API
138
127
  test_files: []
139
-
data.tar.gz.sig DELETED
@@ -1 +0,0 @@
1
- l-��}2�U�������c��\er#�8�u��#�7MK���n  �����L���w�v��d�#h��;���q�~E��<�&���j"�T`�X�a�D# =j5��d]e ��;X�^T?G�Fӣ��2h��ͭ��Z̽�L�C���&`�ZF�v*���P��D"�G ��/}@*W~�Id3�'���9�F��:ٔgS:>� r8�f�u���9���E#��(����T�@|��Nh��~���"�
metadata.gz.sig DELETED
Binary file