tmdb 0.6.1 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 33a3ea3c89d4672a8b68dace28b3fd35574805ed
4
- data.tar.gz: 1464f6a5e8be1356c840eb7b0073825dbd3f1f78
3
+ metadata.gz: e059376ef609358541f2867b0f407939aeb8500f
4
+ data.tar.gz: ef5ac016fdc89a8378578de5dcd8d69201c6ad14
5
5
  SHA512:
6
- metadata.gz: fe7cb0b39a2ad80b196adaf67793d8a588d36f8216b5a5de497d9efce49d73ddf158599c8c9dbaa9dafce28554d47a39a3e07e5486cafc53220b31db32eb1f54
7
- data.tar.gz: a5599e765409434da179c29a262588c5cd94f89ff1e590b586719e0240e847aa55475a67cd600bc2258de5d04f070afb318adc18586c3af86f89299dc5275470
6
+ metadata.gz: 8b432a3a7d92d34a7236481ec7b5fb42991d9d5344705ec10c3d072849460862b852f5eb9d2ebe8ed04bf9871aafb8dc1599e268fe7d8ab87692e868aba01c06
7
+ data.tar.gz: 778adb0a856dcf4b3224d6a7d89eb585ff2e0e747d5c5ada42015900449893d3024005f64c08c6761bc7ef72f58b298840ba916f3e94706ad767778a8ea70c47
data/README.md CHANGED
@@ -25,6 +25,7 @@ Current available:
25
25
  * ::search
26
26
  * ::advanced_search
27
27
  * ::id
28
+ * ::imdb_id
28
29
  * ::popular
29
30
  * #poster(size)
30
31
  * #backdrop(size)
@@ -73,16 +74,16 @@ TMDB::API.genres("tv")
73
74
  ```ruby
74
75
  # To search for movies by title (returns an array of TMDB:Movie objects)
75
76
  movies = TMDB::Movie.search('the matrix')
76
- # => <TMDB::Movie "adult"=>false,
77
- "backdrop_path"=>"/7u3pxc0K1wx32IleAkLv78MKgrw.jpg",
78
- "id"=>603,
79
- "original_title"=>"The Matrix",
80
- "release_date"=>"1999-03-30",
81
- "poster_path"=>"/gynBNzwyaHKtXqlEKKLioNkjKgN.jpg",
82
- "popularity"=>10.3021669763687,
83
- "title"=>"The Matrix",
84
- "vote_average"=>7.4,
85
- "vote_count"=>3674> ...
77
+ # => <TMDB::Movie adult=false
78
+ backdrop_path="/yQeEMjnBOIAtFqIuEphyesH0a6y.jpg"
79
+ id=603
80
+ original_title="The Matrix"
81
+ popularity=5.06402605254135
82
+ poster_path="/gynBNzwyaHKtXqlEKKLioNkjKgN.jpg"
83
+ release_date="1999-03-30"
84
+ title="The Matrix"
85
+ vote_average=7.5
86
+ vote_count=3773>
86
87
 
87
88
  # Then you can pull the data from the results, ie.
88
89
  movies.first.title
@@ -103,29 +104,35 @@ movies = TMDB::Movie.advanced_search('release_date.gte' => '2014-01-01',
103
104
 
104
105
  ```ruby
105
106
  # To pull all the information for a particular movie, run an id search:
106
- movie = TMDB::Movie.id(550)
107
- # => <Hashie::Mash "adult"=>false,
108
- "backdrop_path"=>"/hNFMawyNDWZKKHU4GYCBz1krsRM.jpg",
109
- "belongs_to_collection"=>nil,
110
- "budget"=>63000000,
111
- "genres"=>
112
- [{"id"=>28, "name"=>"Action"},
113
- {"id"=>18, "name"=>"Drama"},
114
- {"id"=>53, "name"=>"Thriller"}],
115
- "homepage"=>"",
116
- "id"=>550,
117
- "imdb_id"=>"tt0137523",
118
- "original_title"=>"Fight Club",
119
- "overview"=>
120
- "A ticking-time-bomb insomniac and a slippery soap salesman channel primal male aggression into a shocking new form of therapy. Their concept catches on, with underground \"fight clubs\" forming in every town, until an eccentric gets in the way and ignites an out-of-control spiral toward oblivion."...>
107
+ movie = TMDB::Movie.id(603)
108
+ # => <TMDB::Movie adult=false
109
+ backdrop_path="/yQeEMjnBOIAtFqIuEphyesH0a6y.jpg"
110
+ ...
111
+ budget=63000000
112
+ genres=>
113
+ [{ id=28 name="Action",
114
+ id=12 name="Adventure",
115
+ id=878 name="Science Fiction",
116
+ id=53 name="Thriller" {}]
117
+ homepage="http://www.warnerbros.com/movies/home-entertainment/the-matrix/37313ac7-9229-474d-a423-44b7a6bc1a54.html"
118
+ ...
119
+ id=603
120
+ imdb_id="tt0133093"
121
121
  ```
122
122
 
123
+ ##### ::imdb_id
124
+
125
+ ```ruby
126
+ # To search by IMDB ID use Movie::imdb_id:
127
+ movie = TMDB::Movie.imdb_id('tt0133093')
128
+ # => <TMDB::Movie yada yada>
129
+
123
130
  ##### ::popular
124
131
 
125
132
  ```ruby
126
133
  # Use .popular to final recent popular movies (according to The Movie Database)
127
134
  movies = TMDB::Movie.popular
128
- # => Array of <Hashie::Mash> movies
135
+ # => Array of <TMDB:Movie>s
129
136
  ```
130
137
 
131
138
  #### Instance Methods
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.1
1
+ 0.7.0
@@ -49,15 +49,21 @@ module TMDB
49
49
  results = TMDB::API.get("/3/discover/movie", query: options)['results']
50
50
  movies = []
51
51
  results.each do |result|
52
- movies.push(Hashie::Mash.new(result))
52
+ movies.push(TMDB::Movie.new(result))
53
53
  end
54
54
  return movies
55
55
  end
56
56
 
57
57
  def self.id(movie_id)
58
58
  options = { api_key: TMDB::API.api_key }
59
- TMDB::Movie.new(TMDB::API.get("/3/movie/#{movie_id}", query: options))
60
- # movie.title = "Fight Club"
59
+ return TMDB::Movie.new(TMDB::API.get("/3/movie/#{movie_id}", query: options))
60
+ end
61
+
62
+ def self.imdb_id(imdb_id)
63
+ options = { api_key: TMDB::API.api_key,
64
+ external_source: 'imdb_id'}
65
+ result = TMDB::API.get("/3/find/#{imdb_id}", query: options)['movie_results'].first
66
+ return TMDB::Movie.new(result)
61
67
  end
62
68
 
63
69
  def self.popular
@@ -36,17 +36,25 @@ describe TMDB::Movie do
36
36
  # TMDB::Movie::id(movie_id)
37
37
  describe "::id" do
38
38
 
39
- let (:movie) { TMDB::Movie.id(550) }
39
+ let (:movie) { TMDB::Movie.id(603) }
40
40
 
41
41
  it "should return the correct movie" do
42
- movie.title.must_equal "Fight Club"
42
+ movie.title.must_equal "The Matrix"
43
43
  end
44
44
 
45
45
  it "should allow iterating over results with multiple values" do
46
46
  movie.genres.first.name.must_equal "Action"
47
47
  movie.genres.last.name.must_equal "Thriller"
48
48
  end
49
+ end
50
+
51
+ #TMDB::Movie::imdb_id(imdb_id)
52
+ describe "::imdb_id" do
53
+ let (:movie) { TMDB::Movie.imdb_id('tt0133093') }
49
54
 
55
+ it "should return the correct movie" do
56
+ movie.title.must_equal "The Matrix"
57
+ end
50
58
  end
51
59
 
52
60
  # TMDB::Movie::popular
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: tmdb 0.6.1 ruby lib
5
+ # stub: tmdb 0.7.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "tmdb"
9
- s.version = "0.6.1"
9
+ s.version = "0.7.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Cody Barr"]
14
- s.date = "2014-07-26"
14
+ s.date = "2014-08-05"
15
15
  s.description = "tmdb is a simple ruby wrapper for The Movie Database. Exposes all TMDB API operations"
16
16
  s.email = "cody.barr@gmail.com"
17
17
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tmdb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cody Barr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-26 00:00:00.000000000 Z
11
+ date: 2014-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty