tmdb 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bf6cdc6215319bcdae0384b5ac9fb81312ad9f15
4
- data.tar.gz: bc1f4b429e79d6b162c57feb22f1ae5c52c27277
3
+ metadata.gz: 7fd33b92a958594cfa2b0dc930570e8d16bd98b6
4
+ data.tar.gz: 564d57ec1ad3d09da1e29ec433ac09eb1bf4cf12
5
5
  SHA512:
6
- metadata.gz: 20ffea9d778a82f0bae2be6d8b5eaa934ff7c561fe7f75a4b987df3227549a07405dce1d1eb49561eafa173e4071c89e2b2bf3ecb6a05cb34b1030a7e768b354
7
- data.tar.gz: 45f37c63298a32073b577bf8fd8daeda29ba3406a7560be4c4c04e8c3689dbe0bab8a9306a0a61dfe300f96cc0b56fcef28691f8df58684db57a79b092d70282
6
+ metadata.gz: 3ee148c4d7f3b7ad9d45bdb1cbda85c37b839ee7f8d1f91bf7eef257fe2c0d6fd3225fa251981be38cb1db55b9d5f1bf5b1462e580538442bf618f3f027cf6ca
7
+ data.tar.gz: a9dc485da999d34b27e14e19f5c2c88826e163699902af40eb106ceff63cf708eaa3d602896cec3d0de1fa67710187b83337047c4d3a02d72714b59411ebbddd
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- activesupport (4.1.0)
4
+ activesupport (4.1.1)
5
5
  i18n (~> 0.6, >= 0.6.9)
6
6
  json (~> 1.7, >= 1.7.7)
7
7
  minitest (~> 5.1)
@@ -40,23 +40,22 @@ GEM
40
40
  rake
41
41
  rdoc
42
42
  json (1.8.1)
43
- jwt (0.1.11)
44
- multi_json (>= 1.5)
45
- mini_portile (0.5.3)
46
- minitest (5.3.3)
47
- multi_json (1.9.2)
43
+ jwt (1.0.0)
44
+ mini_portile (0.6.0)
45
+ minitest (5.3.4)
46
+ multi_json (1.10.1)
48
47
  multi_xml (0.5.5)
49
48
  multipart-post (2.0.0)
50
- nokogiri (1.6.1)
51
- mini_portile (~> 0.5.0)
52
- oauth2 (0.9.3)
49
+ nokogiri (1.6.2.1)
50
+ mini_portile (= 0.6.0)
51
+ oauth2 (0.9.4)
53
52
  faraday (>= 0.8, < 0.10)
54
- jwt (~> 0.1.8)
53
+ jwt (~> 1.0)
55
54
  multi_json (~> 1.3)
56
55
  multi_xml (~> 0.5)
57
56
  rack (~> 1.2)
58
57
  rack (1.5.2)
59
- rake (10.3.0)
58
+ rake (10.3.2)
60
59
  rake-notes (0.2.0)
61
60
  colored
62
61
  rake
@@ -66,15 +65,15 @@ GEM
66
65
  shoulda-context (~> 1.0, >= 1.0.1)
67
66
  shoulda-matchers (>= 1.4.1, < 3.0)
68
67
  shoulda-context (1.2.1)
69
- shoulda-matchers (2.6.0)
68
+ shoulda-matchers (2.6.1)
70
69
  activesupport (>= 3.0.0)
71
70
  simplecov (0.8.2)
72
71
  docile (~> 1.1.0)
73
72
  multi_json
74
73
  simplecov-html (~> 0.8.0)
75
74
  simplecov-html (0.8.0)
76
- thread_safe (0.3.3)
77
- tzinfo (1.1.0)
75
+ thread_safe (0.3.4)
76
+ tzinfo (1.2.0)
78
77
  thread_safe (~> 0.1)
79
78
 
80
79
  PLATFORMS
data/README.md CHANGED
@@ -14,18 +14,52 @@ Simple ruby wrapper for _The MovieDB_ based on HTTParty
14
14
 
15
15
  I wrote this gem while using ruby 2.0.0, I haven't tested compatability with other versions.
16
16
 
17
+ ## API Coverage
18
+
19
+ Current available:
20
+ * [API](#api)
21
+ * ::api_key=
22
+ * ::config
23
+ * ::genres(source)
24
+ * [Movie](#movies)
25
+ * ::title_search
26
+ * ::search
27
+ * ::id
28
+ * [TV](#tv)
29
+ * ::search
30
+ * ::id
31
+
32
+ Todo:
33
+ * Movie
34
+ * ::popular
35
+ * ::top_rated
36
+ * TV
37
+ * ::popular
38
+ * ::top_rated
39
+ * People/Person
40
+ * ::id
41
+ * ::search
42
+
17
43
  ## Examples
18
44
 
19
- ### Configuration
45
+ ### API
20
46
  ```ruby
21
47
  require 'tmdb'
22
48
 
23
- # Always run Config's api_key class method first to set the api key class variable
49
+ # Always run API's api_key class method first to set the api key class variable
24
50
  TMDB::API.api_key = "YOUR_API_KEY"
25
51
 
26
52
  # Get the configuration data
27
53
  TMDB::API.config
28
54
  # => (see http://docs.themoviedb.apiary.io/#configuration)
55
+
56
+ # Get a hash of genres (for Movies or TV)
57
+ TMDB::API.genres
58
+ # {28=>"Action", 12=>"Adventure", etc..}
59
+ # (Default is for movies)
60
+
61
+ TMDB::API.genres("tv")
62
+ # (for TV)
29
63
  ```
30
64
 
31
65
  ### Movies
@@ -49,6 +83,8 @@ movies = TMDB::Movie.title_search(query: 'the matrix')
49
83
  movies.first.title
50
84
  # => "The Matrix"
51
85
 
86
+ # Use .search for to find by various parameters (ie. release date)
87
+
52
88
  # To pull all the information for a particular movie, run an id search:
53
89
  movie = TMDB::Movie.id(550)
54
90
  # => <Hashie::Mash "adult"=>false,
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.3.0
data/lib/tmdb/api.rb CHANGED
@@ -19,9 +19,28 @@ module TMDB
19
19
  def self.config
20
20
  options = { api_key: self.api_key }
21
21
  response = TMDB::API.get("/3/configuration", query: options).parsed_response
22
- OpenStruct.new(response)
23
- # configuration['images']['base_url'] => "http://image.tmdb.org/t/p/"
22
+ Hashie::Mash.new(response)
23
+ # configuration.images.base_url => "http://image.tmdb.org/t/p/"
24
24
  end
25
25
 
26
+ # Returns a hash of genres {id => genre name, etc.}
27
+ def self.genres(source="movie")
28
+ options = { api_key: self.api_key,
29
+ language: 'en' }
30
+
31
+ case source.downcase
32
+ when "movie", "movies"
33
+ source = "movie"
34
+ when "tv"
35
+ source = "tv"
36
+ end
37
+
38
+ genres = {}
39
+ TMDB::API.get("/3/genre/#{source}/list", query: options)['genres'].each do |genre|
40
+ genres[genre['id']] = genre['name']
41
+ end
42
+
43
+ puts genres
44
+ end
26
45
  end
27
46
  end
@@ -8,7 +8,13 @@ describe TMDB::API do
8
8
  # TMDB::API::search(query, page, etc.)
9
9
  describe ".config" do
10
10
  it "should return the configuration data" do
11
- TMDB::API.config.must_be_instance_of OpenStruct
11
+ TMDB::API.config.must_be_instance_of Hashie::Mash
12
+ end
13
+ end
14
+
15
+ describe ".genres" do
16
+ it "should return an array of English Genres" do
17
+ TMDB::API.genres.values.first.must_equal "Action"
12
18
  end
13
19
  end
14
20
  end
data/tmdb.gemspec CHANGED
@@ -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.2.1 ruby lib
5
+ # stub: tmdb 0.3.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "tmdb"
9
- s.version = "0.2.1"
9
+ s.version = "0.3.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-04-23"
14
+ s.date = "2014-06-27"
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.2.1
4
+ version: 0.3.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-04-23 00:00:00.000000000 Z
11
+ date: 2014-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty