themoviedb 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
data/lib/themoviedb.rb CHANGED
@@ -10,5 +10,5 @@ end
10
10
  end
11
11
 
12
12
  module Tmdb
13
- VERSION = "0.0.9"
13
+ VERSION = "0.0.10"
14
14
  end
@@ -0,0 +1,37 @@
1
+ module Tmdb
2
+ class Episode < Resource
3
+ has_resource 'episode', :plural => 'episodes'
4
+
5
+ #Get the primary information about a TV episode by combination of a season and episode number.
6
+ def self.detail(id, season, episode, conditions={})
7
+ search = Tmdb::Search.new("/tv/#{self.endpoint_id + id.to_s}/season/#{self.endpoint_id + season.to_s}/#{self.endpoints[:singular]}/#{self.endpoint_id + episode.to_s}")
8
+ search.filter(conditions)
9
+ search.fetch_response
10
+ end
11
+
12
+ #Get the TV episode cast credits by combination of season and episode number.
13
+ def self.cast(id, season, episode, conditions={})
14
+ search = Tmdb::Search.new("/tv/#{self.endpoint_id + id.to_s}/season/#{self.endpoint_id + season.to_s}/#{self.endpoints[:singular]}/#{self.endpoint_id + episode.to_s}/credits")
15
+ search.fetch_response['cast']
16
+ end
17
+
18
+ #Get the TV episode crew credits by combination of season and episode number.
19
+ def self.crew(id, season, episode, conditions={})
20
+ search = Tmdb::Search.new("/tv/#{self.endpoint_id + id.to_s}/season/#{self.endpoint_id + season.to_s}/#{self.endpoints[:singular]}/#{self.endpoint_id + episode.to_s}/credits")
21
+ search.fetch_response['crew']
22
+ end
23
+
24
+ #Get the external ids for a TV episode by comabination of a season and episode number.
25
+ def self.external_ids(id, season, episode, conditions={})
26
+ search = Tmdb::Search.new("/tv/#{self.endpoint_id + id.to_s}/season/#{self.endpoint_id + season.to_s}/#{self.endpoints[:singular]}/#{self.endpoint_id + episode.to_s}/external_ids")
27
+ search.fetch_response
28
+ end
29
+
30
+ #Get the images (episode stills) for a TV episode by combination of a season and episode number.
31
+ def self.images(id, season, episode, conditions={})
32
+ search = Tmdb::Search.new("/tv/#{self.endpoint_id + id.to_s}/season/#{self.endpoint_id + season.to_s}/#{self.endpoints[:singular]}/#{self.endpoint_id + episode.to_s}/images")
33
+ search.fetch_response
34
+ end
35
+
36
+ end
37
+ end
@@ -0,0 +1,37 @@
1
+ module Tmdb
2
+ class Season < Resource
3
+ has_resource 'season', :plural => 'seasons'
4
+
5
+ #Get the primary information about a TV season by its season number.
6
+ def self.detail(id, season, conditions={})
7
+ search = Tmdb::Search.new("/tv/#{self.endpoint_id + id.to_s}/#{self.endpoints[:singular]}/#{self.endpoint_id + season.to_s}")
8
+ search.filter(conditions)
9
+ search.fetch_response
10
+ end
11
+
12
+ #Get the cast credits for a TV season by season number.
13
+ def self.cast(id, season, conditions={})
14
+ search = Tmdb::Search.new("/tv/#{self.endpoint_id + id.to_s}/#{self.endpoints[:singular]}/#{self.endpoint_id + season.to_s}/credits")
15
+ search.fetch_response['cast']
16
+ end
17
+
18
+ #Get the crew credits for a TV season by season number.
19
+ def self.crew(id, season, conditions={})
20
+ search = Tmdb::Search.new("/tv/#{self.endpoint_id + id.to_s}/#{self.endpoints[:singular]}/#{self.endpoint_id + season.to_s}/credits")
21
+ search.fetch_response['crew']
22
+ end
23
+
24
+ #Get the external ids that we have stored for a TV season by season number.
25
+ def self.external_ids(id, season, conditions={})
26
+ search = Tmdb::Search.new("/tv/#{self.endpoint_id + id.to_s}/#{self.endpoints[:singular]}/#{self.endpoint_id + season.to_s}/external_ids")
27
+ search.fetch_response
28
+ end
29
+
30
+ #Get the images (posters) that we have stored for a TV season by season number.
31
+ def self.images(id, season, conditions={})
32
+ search = Tmdb::Search.new("/tv/#{self.endpoint_id + id.to_s}/#{self.endpoints[:singular]}/#{self.endpoint_id + season.to_s}/images")
33
+ search.fetch_response
34
+ end
35
+
36
+ end
37
+ end
@@ -0,0 +1,74 @@
1
+ module Tmdb
2
+ class TV < Resource
3
+ has_resource 'tv', :plural => 'tv'
4
+
5
+ #http://docs.themoviedb.apiary.io/#tv
6
+ @@fields = [
7
+ :backdrop_path,
8
+ :created_by,
9
+ :episode_run_time,
10
+ :genres,
11
+ :first_air_date,
12
+ :genres,
13
+ :homepage,
14
+ :id,
15
+ :in_production,
16
+ :languages,
17
+ :last_air_date,
18
+ :name,
19
+ :network,
20
+ :number_of_episodes,
21
+ :number_of_seasons,
22
+ :original_name,
23
+ :origin_country,
24
+ :overview,
25
+ :popularity,
26
+ :poster_path,
27
+ :seasons,
28
+ :status,
29
+ :vote_average,
30
+ :vote_count
31
+ ]
32
+
33
+ @@fields.each do |field|
34
+ attr_accessor field
35
+ end
36
+
37
+ #Get the list of popular TV shows. This list refreshes every day.
38
+ def self.popular
39
+ search = Tmdb::Search.new("/tv/popular")
40
+ search.fetch
41
+ end
42
+
43
+ #Get the list of top rated TV shows. By default, this list will only include TV shows that have 2 or more votes. This list refreshes every day.
44
+ def self.top_rated
45
+ search = Tmdb::Search.new("/tv/top_rated")
46
+ search.fetch
47
+ end
48
+
49
+ #Get the cast information about a TV series.
50
+ def self.cast(id, conditions={})
51
+ search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/credits")
52
+ search.fetch_response['cast']
53
+ end
54
+
55
+ #Get the crew information about a TV series.
56
+ def self.crew(id, conditions={})
57
+ search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/credits")
58
+ search.fetch_response['crew']
59
+ end
60
+
61
+ #Get the external ids that we have stored for a TV series.
62
+ def self.external_ids(id, conditions={})
63
+ search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/external_ids")
64
+ search.fetch_response
65
+ end
66
+
67
+ #Get the images (posters and backdrops) for a TV series.
68
+ def self.images(id, conditions={})
69
+ search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/images")
70
+ search.fetch_response
71
+ end
72
+
73
+ end
74
+ end
data/themoviedb.gemspec CHANGED
@@ -24,6 +24,9 @@ Gem::Specification.new do |s|
24
24
  "lib/themoviedb/people.rb",
25
25
  "lib/themoviedb/resource.rb",
26
26
  "lib/themoviedb/search.rb",
27
+ "lib/themoviedb/season.rb",
28
+ "lib/themoviedb/episode.rb",
29
+ "lib/themoviedb/tv.rb",
27
30
  "spec/movie_spec.rb"
28
31
  ]
29
32
  s.test_files = [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: themoviedb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-14 00:00:00.000000000 Z
12
+ date: 2013-11-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
@@ -45,6 +45,9 @@ files:
45
45
  - lib/themoviedb/people.rb
46
46
  - lib/themoviedb/resource.rb
47
47
  - lib/themoviedb/search.rb
48
+ - lib/themoviedb/season.rb
49
+ - lib/themoviedb/episode.rb
50
+ - lib/themoviedb/tv.rb
48
51
  - spec/movie_spec.rb
49
52
  homepage: http://rubygems.org/gems/themoviedb
50
53
  licenses: []