tmdb 0.1.0 → 0.2.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: 01440f480d5d59d3a926a014875476e7ed2a0708
4
- data.tar.gz: f33a7e8b365fae03a22f46a50243cba23654d4aa
3
+ metadata.gz: 39684d7e35b1ef553d2006a25a88a350a455a6b9
4
+ data.tar.gz: 8cf178a063e20f420379c17e719dccd89b72f884
5
5
  SHA512:
6
- metadata.gz: 2b7f57f891fa8dbf1cbf7e02f177ef5bda77dd5f3f19f44f57d257d622d04a2033adcbe2aed314d4d0e28755f6384c355041528de3055b243ab8e806a112b26f
7
- data.tar.gz: 0e9aadd45398561d9cc7122d6826c4dd50220dd65f8c95403d9444605246e6bf6e991618abe55f23469747aced74792f1299ab0493331eca7a9eb1e7aa4b25ff
6
+ metadata.gz: 00014bef4f3fdf6760fb73c07eab6589a2e4cfa6615ae437967c3f48256cde5a7dd9be3d6e31bc351a59fe87e2ed092ea2dd598e0e99ff89b8a4809f30409cca
7
+ data.tar.gz: 599c278f93ff90e34f45aa3700230ead9a8f3c39b014a1a6d5d4462b50d153280797a4fa1380991b876118ca65fd897a727950dea30adf3b1e7feb6355ab1053
data/Gemfile CHANGED
@@ -1,15 +1,19 @@
1
- source "http://rubygems.org"
1
+ source 'http://rubygems.org'
2
2
  # Add dependencies required to use your gem here.
3
3
 
4
- gem 'httparty'
4
+ gem 'httparty', '~> 0.13', '>= 0.13.1'
5
+ gem 'hashie'
5
6
 
6
7
  # Add dependencies to develop your gem here.
7
8
  # Include everything needed to run rake, tests, features, etc.
8
9
  group :development do
9
- gem "shoulda", ">= 0"
10
- gem "rdoc", "~> 3.12"
11
- gem "bundler", "~> 1.0"
12
- gem "jeweler", "~> 2.0.1"
13
- gem "simplecov", ">= 0"
14
- gem 'rake-notes' # allows usage of 'rake notes' to find all todos, etc.
10
+ gem 'shoulda', '~> 3.5', '>= 3.5.0'
11
+ gem 'rdoc', '~> 3.12'
12
+ gem 'bundler', '~> 1.0'
13
+ gem 'jeweler', '~> 2.0', '>= 2.0.1'
14
+ gem 'simplecov', '~> 0.8', '>= 0.8.2'
15
+ gem 'rake-notes', '~> 0.2', '>= 0.2.0' # allows usage of 'rake notes' to find all todos, etc.
16
+ gem 'webmock'
17
+ gem 'vcr'
18
+ gem 'turn'
15
19
  end
data/Gemfile.lock CHANGED
@@ -8,8 +8,11 @@ GEM
8
8
  thread_safe (~> 0.1)
9
9
  tzinfo (~> 1.1)
10
10
  addressable (2.3.6)
11
+ ansi (1.4.3)
11
12
  builder (3.2.2)
12
13
  colored (1.2)
14
+ crack (0.4.2)
15
+ safe_yaml (~> 1.0.0)
13
16
  descendants_tracker (0.0.4)
14
17
  thread_safe (~> 0.3, >= 0.3.1)
15
18
  docile (1.1.3)
@@ -43,7 +46,7 @@ GEM
43
46
  jwt (0.1.11)
44
47
  multi_json (>= 1.5)
45
48
  mini_portile (0.5.3)
46
- minitest (5.3.2)
49
+ minitest (5.3.3)
47
50
  multi_json (1.9.2)
48
51
  multi_xml (0.5.5)
49
52
  multipart-post (2.0.0)
@@ -56,12 +59,13 @@ GEM
56
59
  multi_xml (~> 0.5)
57
60
  rack (~> 1.2)
58
61
  rack (1.5.2)
59
- rake (10.2.2)
62
+ rake (10.3.0)
60
63
  rake-notes (0.2.0)
61
64
  colored
62
65
  rake
63
66
  rdoc (3.12.2)
64
67
  json (~> 1.4)
68
+ safe_yaml (1.0.2)
65
69
  shoulda (3.5.0)
66
70
  shoulda-context (~> 1.0, >= 1.0.1)
67
71
  shoulda-matchers (>= 1.4.1, < 3.0)
@@ -74,17 +78,27 @@ GEM
74
78
  simplecov-html (~> 0.8.0)
75
79
  simplecov-html (0.8.0)
76
80
  thread_safe (0.3.3)
81
+ turn (0.9.6)
82
+ ansi
77
83
  tzinfo (1.1.0)
78
84
  thread_safe (~> 0.1)
85
+ vcr (2.9.0)
86
+ webmock (1.17.4)
87
+ addressable (>= 2.2.7)
88
+ crack (>= 0.3.2)
79
89
 
80
90
  PLATFORMS
81
91
  ruby
82
92
 
83
93
  DEPENDENCIES
84
94
  bundler (~> 1.0)
85
- httparty
86
- jeweler (~> 2.0.1)
87
- rake-notes
95
+ hashie
96
+ httparty (~> 0.13, >= 0.13.1)
97
+ jeweler (~> 2.0, >= 2.0.1)
98
+ rake-notes (~> 0.2, >= 0.2.0)
88
99
  rdoc (~> 3.12)
89
- shoulda
90
- simplecov
100
+ shoulda (~> 3.5, >= 3.5.0)
101
+ simplecov (~> 0.8, >= 0.8.2)
102
+ turn
103
+ vcr
104
+ webmock
data/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright &copy; 2014 Cody Barr
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -1,25 +1,112 @@
1
1
  # tmdb
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/tmdb.svg)](http://badge.fury.io/rb/tmdb)
4
+
3
5
  Simple ruby wrapper for _The MovieDB_ based on HTTParty
4
6
 
5
7
  ## Installation
6
8
 
7
- _TODO_
9
+ **tmdb** is hosted at rubygems.org
10
+
11
+ `gem install tmdb`
8
12
 
9
13
  ## Compatability
10
14
 
11
15
  I wrote this gem while using ruby 2.0.0, I haven't tested compatability with other versions.
12
16
 
17
+ ## Examples
18
+
19
+ ### Configuration
20
+ ```ruby
21
+ require 'tmdb'
22
+
23
+ # Always run Config's api_key class method first to set the api key class variable
24
+ TMDB::API.api_key = "YOUR_API_KEY"
25
+
26
+ # Get the configuration data
27
+ TMDB::API.config
28
+ # => (see http://docs.themoviedb.apiary.io/#configuration)
29
+ ```
30
+
31
+ ### Movies
32
+
33
+ ```ruby
34
+ # To search for movies based on a query (returns an array of Hashie::Mash objects)
35
+ # Use any of the parameters listed here: http://docs.themoviedb.apiary.io/#get-%2F3%2Fsearch%2Fmovie
36
+ movies = TMDB::Movie.search(query: 'the matrix')
37
+ # => <Hashie::Mash "adult"=>false,
38
+ "backdrop_path"=>"/7u3pxc0K1wx32IleAkLv78MKgrw.jpg",
39
+ "id"=>603,
40
+ "original_title"=>"The Matrix",
41
+ "release_date"=>"1999-03-30",
42
+ "poster_path"=>"/gynBNzwyaHKtXqlEKKLioNkjKgN.jpg",
43
+ "popularity"=>10.3021669763687,
44
+ "title"=>"The Matrix",
45
+ "vote_average"=>7.4,
46
+ "vote_count"=>3674> ...
47
+
48
+ # Then you can pull the data from the results, ie.
49
+ movies.first.title
50
+ # => "The Matrix"
51
+
52
+ # To pull all the information for a particular movie, run an id search:
53
+ movie = TMDB::Movie.id(550)
54
+ # => <Hashie::Mash "adult"=>false,
55
+ "backdrop_path"=>"/hNFMawyNDWZKKHU4GYCBz1krsRM.jpg",
56
+ "belongs_to_collection"=>nil,
57
+ "budget"=>63000000,
58
+ "genres"=>
59
+ [{"id"=>28, "name"=>"Action"},
60
+ {"id"=>18, "name"=>"Drama"},
61
+ {"id"=>53, "name"=>"Thriller"}],
62
+ "homepage"=>"",
63
+ "id"=>550,
64
+ "imdb_id"=>"tt0137523",
65
+ "original_title"=>"Fight Club",
66
+ "overview"=>
67
+ "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."...>
68
+ ```
69
+
70
+ ### TV
71
+
72
+ ```ruby
73
+ # Similar to Movies
74
+ TMDB::TV.search(query: 'walking dead')
75
+ # => <Hashie::Mash {"backdrop_path"=>"/nGzg3mn3C6fYVE0SvXHmY2XX4P2.jpg",
76
+ "created_by"=>
77
+ [{"id"=>4027,
78
+ "name"=>"Frank Darabont",
79
+ "profile_path"=>"/fLKzpG3J88lPr8y8dCJbcFKN6iX.jpg"}],
80
+ "episode_run_time"=>[60, 45],
81
+ "first_air_date"=>"2010-10-31",
82
+ "genres"=>
83
+ [{"id"=>18, "name"=>"Drama"},
84
+ {"id"=>27, "name"=>"Horror"},
85
+ {"id"=>53, "name"=>"Thriller"}],
86
+ "homepage"=>"http://www.amctv.com/shows/the-walking-dead/",
87
+ "id"=>1402,
88
+ "in_production"=>true,
89
+ "languages"=>["en"],
90
+ "last_air_date"=>"2014-03-30",
91
+ "name"=>"The Walking Dead" ...>
92
+ ```
93
+
94
+ ### More Examples
95
+
96
+ You can look through the tests for more examples
97
+
13
98
  ## Usage
14
99
 
15
100
  _TODO_
16
101
 
102
+ _tmdb is a work in progress and isn't really usable at the moment. It's my first gem so I'm going to take some time working on it_
103
+
17
104
  ## Testing
18
105
 
19
106
  Make sure to create an 'api_key' file at 'test/api_key' in order to run the tests. I'll work offline testing into the gem later.
20
107
 
21
108
  ## Copyright
22
109
 
23
- Copyright &copy; 2014 Cody Barr. See LICENSE.txt for
110
+ Copyright &copy; 2014 Cody Barr. See LICENSE.md for
24
111
  further details.
25
112
 
data/Rakefile CHANGED
@@ -50,6 +50,5 @@ Rake::RDocTask.new do |rdoc|
50
50
  rdoc.rdoc_files.include('lib/**/*.rb')
51
51
  end
52
52
 
53
- # Other requires
54
-
55
- require 'rake/notes/rake_task'
53
+ # Other requires
54
+ require 'rake/notes/rake_task'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
data/lib/tmdb.rb CHANGED
@@ -1,4 +1,9 @@
1
1
  require 'httparty'
2
+
3
+ # TODO: still trying to decided on struct (more abstraction needed), openstruct, deepopenstruct, or Hashie::Mash...
4
+ require 'ostruct'
5
+ require 'hashie'
6
+
2
7
  Dir[File.dirname(__FILE__) + '/tmdb/*.rb'].each do |file|
3
8
  require file
4
9
  end
data/lib/tmdb/api.rb ADDED
@@ -0,0 +1,27 @@
1
+ # config.rb
2
+
3
+ module TMDB
4
+ class API
5
+ include HTTParty
6
+
7
+ @@api_key = ''
8
+
9
+ base_uri 'http://api.themoviedb.org'
10
+
11
+ def self.api_key
12
+ @@api_key
13
+ end
14
+
15
+ def self.api_key=(key)
16
+ @@api_key = key
17
+ end
18
+
19
+ def self.config
20
+ options = { api_key: self.api_key }
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/"
24
+ end
25
+
26
+ end
27
+ end
data/lib/tmdb/find.rb ADDED
@@ -0,0 +1,6 @@
1
+
2
+ module TMDB
3
+ class Find
4
+
5
+ end
6
+ end
data/lib/tmdb/movie.rb CHANGED
@@ -1 +1,25 @@
1
- # TODO: See about making this a deepopenstruct: https://github.com/aarongough/deepopenstruct
1
+ # TODO: See about making this a deepopenstruct: https://github.com/aarongough/deepopenstruct
2
+ # TODO: Review http://ruby.learncodethehardway.org/book/ex44.html first, figure out if we ant to use inheritance or composition
3
+
4
+ module TMDB
5
+ class Movie
6
+
7
+ def self.search(options = {})
8
+ # Accepted parameters:
9
+ # :page, :include_adult (true / false), :year
10
+ options.merge!(api_key: TMDB::API.api_key)
11
+ results = TMDB::API.get("/3/search/movie", query: options)['results']
12
+ movies = []
13
+ results.each do |result|
14
+ movies.push(Hashie::Mash.new(result))
15
+ end
16
+ return movies
17
+ end
18
+
19
+ def self.id(movie_id)
20
+ options = { api_key: TMDB::API.api_key }
21
+ Hashie::Mash.new(TMDB::API.get("/3/movie/#{movie_id}", query: options))
22
+ # movie.title = "Fight Club"
23
+ end
24
+ end
25
+ end
data/lib/tmdb/tv.rb ADDED
@@ -0,0 +1,21 @@
1
+ # tv.rb
2
+
3
+ module TMDB
4
+ class TV
5
+
6
+ def self.search(options = {})
7
+ options.merge!(api_key: TMDB::API.api_key)
8
+ results = TMDB::API.get("/3/search/tv", query: options)['results']
9
+ tv_shows = []
10
+ results.each do |result|
11
+ tv_shows.push(Hashie::Mash.new(result))
12
+ end
13
+ end
14
+
15
+ def self.id(tv_id)
16
+ options = { api_key: TMDB::API.api_key }
17
+ Hashie::Mash.new(TMDB::API.get("/3/tv/#{tv_id}", query: options))
18
+ end
19
+ end
20
+
21
+ end
data/test/test_helper.rb CHANGED
@@ -4,4 +4,9 @@
4
4
  require_relative '../lib/tmdb'
5
5
 
6
6
  # Dependencies
7
- require 'minitest/autorun'
7
+ require 'minitest/autorun'
8
+ require 'pp'
9
+
10
+ describe "Test Constants" do
11
+ API_KEY = File.open('test/api_key').read
12
+ end
@@ -0,0 +1,14 @@
1
+ # test_api.rb
2
+
3
+ require_relative '../test_helper'
4
+
5
+ describe TMDB::API do
6
+ TMDB::API.api_key = API_KEY
7
+
8
+ # TMDB::API::search(query, page, etc.)
9
+ describe ".config" do
10
+ it "should return the configuration data" do
11
+ TMDB::API.config.must_be_instance_of OpenStruct
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,7 @@
1
+ # test_find.rb
2
+
3
+ require_relative '../test_helper'
4
+
5
+ describe TMDB::Find do
6
+
7
+ end
@@ -0,0 +1,35 @@
1
+ require_relative '../test_helper'
2
+
3
+ # TODO: rewrite tests using Minitest best practices
4
+
5
+ describe TMDB::Movie do
6
+ # Create a 'test/api_key' file and paste in your API key to run the tests
7
+ # TODO: Work in 'gem webmock' for offline testing, review: http://code.tutsplus.com/articles/writing-an-api-wrapper-in-ruby-with-tdd--net-23875
8
+ TMDB::API.api_key = API_KEY
9
+
10
+ # TMDB::Movie::search(query, page, etc.)
11
+ describe ".search" do
12
+ it "should return correct results" do
13
+ movies = TMDB::Movie.search(query: 'the matrix')
14
+
15
+ movies.first.title.must_equal "The Matrix"
16
+ end
17
+ end
18
+
19
+ # TMDB::Movie::id(movie_id)
20
+
21
+ describe ".id" do
22
+
23
+ let (:movie) { TMDB::Movie.id(550) }
24
+
25
+ it "should return the correct movie" do
26
+ movie.title.must_equal "Fight Club"
27
+ end
28
+
29
+ it "should allow iterating over results with multiple values" do
30
+ movie.genres.first.name.must_equal "Action"
31
+ movie.genres.last.name.must_equal "Thriller"
32
+ end
33
+
34
+ end
35
+ end
@@ -0,0 +1,31 @@
1
+ # test_tv.rb
2
+
3
+ require_relative '../test_helper'
4
+
5
+ describe TMDB::TV do
6
+ TMDB::API.api_key = API_KEY
7
+
8
+ describe ".search" do
9
+ it "should return correct results" do
10
+ shows = TMDB::TV.search(query: 'walking dead')
11
+
12
+ shows.first['name'].must_equal "The Walking Dead"
13
+ end
14
+ end
15
+
16
+ describe ".id" do
17
+
18
+ let (:show) { TMDB::TV.id(1402) }
19
+
20
+ it "should return the correct movie" do
21
+ show.name.must_equal "The Walking Dead"
22
+ end
23
+
24
+ it "should allow iterating over results with multiple values" do
25
+ show.genres.first.name.must_equal "Drama"
26
+ show.genres.last.name.must_equal "Thriller"
27
+ end
28
+
29
+ end
30
+
31
+ end
data/tmdb.gemspec ADDED
@@ -0,0 +1,87 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+ # stub: tmdb 0.2.0 ruby lib
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = "tmdb"
9
+ s.version = "0.2.0"
10
+
11
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib"]
13
+ s.authors = ["Cody Barr"]
14
+ s.date = "2014-04-23"
15
+ s.description = "tmdb is a simple ruby wrapper for The Movie Database. Exposes all TMDB API operations"
16
+ s.email = "cody.barr@gmail.com"
17
+ s.extra_rdoc_files = [
18
+ "LICENSE.md",
19
+ "README.md"
20
+ ]
21
+ s.files = [
22
+ "Gemfile",
23
+ "Gemfile.lock",
24
+ "LICENSE.md",
25
+ "README.md",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "lib/tmdb.rb",
29
+ "lib/tmdb/api.rb",
30
+ "lib/tmdb/find.rb",
31
+ "lib/tmdb/movie.rb",
32
+ "lib/tmdb/tv.rb",
33
+ "test/test_helper.rb",
34
+ "test/tmdb/test_api.rb",
35
+ "test/tmdb/test_find.rb",
36
+ "test/tmdb/test_movie.rb",
37
+ "test/tmdb/test_tv.rb",
38
+ "tmdb.gemspec"
39
+ ]
40
+ s.homepage = "http://github.com/codybarr/tmdb"
41
+ s.licenses = ["MIT"]
42
+ s.rubygems_version = "2.2.2"
43
+ s.summary = "A simple ruby wrapper for _The MovieDB API_ based on HTTParty"
44
+
45
+ if s.respond_to? :specification_version then
46
+ s.specification_version = 4
47
+
48
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
49
+ s.add_runtime_dependency(%q<httparty>, [">= 0.13.1", "~> 0.13"])
50
+ s.add_runtime_dependency(%q<hashie>, [">= 0"])
51
+ s.add_development_dependency(%q<shoulda>, [">= 3.5.0", "~> 3.5"])
52
+ s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
53
+ s.add_development_dependency(%q<bundler>, ["~> 1.0"])
54
+ s.add_development_dependency(%q<jeweler>, [">= 2.0.1", "~> 2.0"])
55
+ s.add_development_dependency(%q<simplecov>, [">= 0.8.2", "~> 0.8"])
56
+ s.add_development_dependency(%q<rake-notes>, [">= 0.2.0", "~> 0.2"])
57
+ s.add_development_dependency(%q<webmock>, [">= 0"])
58
+ s.add_development_dependency(%q<vcr>, [">= 0"])
59
+ s.add_development_dependency(%q<turn>, [">= 0"])
60
+ else
61
+ s.add_dependency(%q<httparty>, [">= 0.13.1", "~> 0.13"])
62
+ s.add_dependency(%q<hashie>, [">= 0"])
63
+ s.add_dependency(%q<shoulda>, [">= 3.5.0", "~> 3.5"])
64
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
65
+ s.add_dependency(%q<bundler>, ["~> 1.0"])
66
+ s.add_dependency(%q<jeweler>, [">= 2.0.1", "~> 2.0"])
67
+ s.add_dependency(%q<simplecov>, [">= 0.8.2", "~> 0.8"])
68
+ s.add_dependency(%q<rake-notes>, [">= 0.2.0", "~> 0.2"])
69
+ s.add_dependency(%q<webmock>, [">= 0"])
70
+ s.add_dependency(%q<vcr>, [">= 0"])
71
+ s.add_dependency(%q<turn>, [">= 0"])
72
+ end
73
+ else
74
+ s.add_dependency(%q<httparty>, [">= 0.13.1", "~> 0.13"])
75
+ s.add_dependency(%q<hashie>, [">= 0"])
76
+ s.add_dependency(%q<shoulda>, [">= 3.5.0", "~> 3.5"])
77
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
78
+ s.add_dependency(%q<bundler>, ["~> 1.0"])
79
+ s.add_dependency(%q<jeweler>, [">= 2.0.1", "~> 2.0"])
80
+ s.add_dependency(%q<simplecov>, [">= 0.8.2", "~> 0.8"])
81
+ s.add_dependency(%q<rake-notes>, [">= 0.2.0", "~> 0.2"])
82
+ s.add_dependency(%q<webmock>, [">= 0"])
83
+ s.add_dependency(%q<vcr>, [">= 0"])
84
+ s.add_dependency(%q<turn>, [">= 0"])
85
+ end
86
+ end
87
+
metadata CHANGED
@@ -1,17 +1,37 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tmdb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.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-16 00:00:00.000000000 Z
11
+ date: 2014-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: 0.13.1
20
+ - - ~>
21
+ - !ruby/object:Gem::Version
22
+ version: '0.13'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 0.13.1
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: '0.13'
33
+ - !ruby/object:Gem::Dependency
34
+ name: hashie
15
35
  requirement: !ruby/object:Gem::Requirement
16
36
  requirements:
17
37
  - - '>='
@@ -30,14 +50,20 @@ dependencies:
30
50
  requirements:
31
51
  - - '>='
32
52
  - !ruby/object:Gem::Version
33
- version: '0'
53
+ version: 3.5.0
54
+ - - ~>
55
+ - !ruby/object:Gem::Version
56
+ version: '3.5'
34
57
  type: :development
35
58
  prerelease: false
36
59
  version_requirements: !ruby/object:Gem::Requirement
37
60
  requirements:
38
61
  - - '>='
39
62
  - !ruby/object:Gem::Version
40
- version: '0'
63
+ version: 3.5.0
64
+ - - ~>
65
+ - !ruby/object:Gem::Version
66
+ version: '3.5'
41
67
  - !ruby/object:Gem::Dependency
42
68
  name: rdoc
43
69
  requirement: !ruby/object:Gem::Requirement
@@ -70,18 +96,64 @@ dependencies:
70
96
  name: jeweler
71
97
  requirement: !ruby/object:Gem::Requirement
72
98
  requirements:
73
- - - ~>
99
+ - - '>='
74
100
  - !ruby/object:Gem::Version
75
101
  version: 2.0.1
102
+ - - ~>
103
+ - !ruby/object:Gem::Version
104
+ version: '2.0'
76
105
  type: :development
77
106
  prerelease: false
78
107
  version_requirements: !ruby/object:Gem::Requirement
79
108
  requirements:
80
- - - ~>
109
+ - - '>='
81
110
  - !ruby/object:Gem::Version
82
111
  version: 2.0.1
112
+ - - ~>
113
+ - !ruby/object:Gem::Version
114
+ version: '2.0'
83
115
  - !ruby/object:Gem::Dependency
84
116
  name: simplecov
117
+ requirement: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - '>='
120
+ - !ruby/object:Gem::Version
121
+ version: 0.8.2
122
+ - - ~>
123
+ - !ruby/object:Gem::Version
124
+ version: '0.8'
125
+ type: :development
126
+ prerelease: false
127
+ version_requirements: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '>='
130
+ - !ruby/object:Gem::Version
131
+ version: 0.8.2
132
+ - - ~>
133
+ - !ruby/object:Gem::Version
134
+ version: '0.8'
135
+ - !ruby/object:Gem::Dependency
136
+ name: rake-notes
137
+ requirement: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - '>='
140
+ - !ruby/object:Gem::Version
141
+ version: 0.2.0
142
+ - - ~>
143
+ - !ruby/object:Gem::Version
144
+ version: '0.2'
145
+ type: :development
146
+ prerelease: false
147
+ version_requirements: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - '>='
150
+ - !ruby/object:Gem::Version
151
+ version: 0.2.0
152
+ - - ~>
153
+ - !ruby/object:Gem::Version
154
+ version: '0.2'
155
+ - !ruby/object:Gem::Dependency
156
+ name: webmock
85
157
  requirement: !ruby/object:Gem::Requirement
86
158
  requirements:
87
159
  - - '>='
@@ -95,7 +167,21 @@ dependencies:
95
167
  - !ruby/object:Gem::Version
96
168
  version: '0'
97
169
  - !ruby/object:Gem::Dependency
98
- name: rake-notes
170
+ name: vcr
171
+ requirement: !ruby/object:Gem::Requirement
172
+ requirements:
173
+ - - '>='
174
+ - !ruby/object:Gem::Version
175
+ version: '0'
176
+ type: :development
177
+ prerelease: false
178
+ version_requirements: !ruby/object:Gem::Requirement
179
+ requirements:
180
+ - - '>='
181
+ - !ruby/object:Gem::Version
182
+ version: '0'
183
+ - !ruby/object:Gem::Dependency
184
+ name: turn
99
185
  requirement: !ruby/object:Gem::Requirement
100
186
  requirements:
101
187
  - - '>='
@@ -114,20 +200,26 @@ email: cody.barr@gmail.com
114
200
  executables: []
115
201
  extensions: []
116
202
  extra_rdoc_files:
117
- - LICENSE.txt
203
+ - LICENSE.md
118
204
  - README.md
119
205
  files:
120
206
  - Gemfile
121
207
  - Gemfile.lock
122
- - LICENSE.txt
208
+ - LICENSE.md
123
209
  - README.md
124
210
  - Rakefile
125
211
  - VERSION
126
212
  - lib/tmdb.rb
213
+ - lib/tmdb/api.rb
214
+ - lib/tmdb/find.rb
127
215
  - lib/tmdb/movie.rb
128
- - lib/tmdb/search.rb
216
+ - lib/tmdb/tv.rb
129
217
  - test/test_helper.rb
130
- - test/tmdb/test_search.rb
218
+ - test/tmdb/test_api.rb
219
+ - test/tmdb/test_find.rb
220
+ - test/tmdb/test_movie.rb
221
+ - test/tmdb/test_tv.rb
222
+ - tmdb.gemspec
131
223
  homepage: http://github.com/codybarr/tmdb
132
224
  licenses:
133
225
  - MIT
data/LICENSE.txt DELETED
@@ -1,20 +0,0 @@
1
- Copyright (c) 2014 Cody Barr
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/lib/tmdb/search.rb DELETED
@@ -1,36 +0,0 @@
1
-
2
- module TMDB
3
- class Search
4
- include HTTParty
5
-
6
- attr_accessor :api_key
7
-
8
- base_uri 'http://api.themoviedb.org'
9
-
10
- def initialize(api_key='')
11
- @api_key = api_key
12
- end
13
-
14
- def configuration
15
- options = {api_key: self.api_key}
16
- self.class.get("/3/configuration", query: options).parsed_response
17
- # configuration['images']['base_url'] => "http://image.tmdb.org/t/p/"
18
- end
19
-
20
- def movie_search(options = {})
21
- # Accepted parameters:
22
- # :page, :include_adult, :year
23
- options.merge!(api_key: self.api_key)
24
- self.class.get("/3/search/movie", query: options)['results']
25
- end
26
-
27
- def movie(movie_id)
28
- options = {api_key: self.api_key}
29
- self.class.get("/3/movie/#{movie_id}", query: options)
30
- # movie['title'] = "Fight Club"
31
- end
32
-
33
- # TODO: tv_search(query, page), tv(id)
34
-
35
- end
36
- end
@@ -1,27 +0,0 @@
1
- require_relative '../test_helper'
2
-
3
- #TODO: rewrite tests using Minitest best practices ()
4
-
5
- describe "TMDB::Search" do
6
- # Create a 'test/api_key' file and paste in your API key to run the tests
7
- # TODO: Work in 'gem webmock' for offline testing, review: http://code.tutsplus.com/articles/writing-an-api-wrapper-in-ruby-with-tdd--net-23875
8
- API_KEY = File.open('test/api_key').read
9
-
10
- let(:search) { TMDB::Search.new(API_KEY) }
11
-
12
- # TMDB::Search#movie_search(query, page)
13
-
14
- it "tmdb.movie_search('matrix') should return a page of matrix results" do
15
- puts search
16
- movies = search.movie_search(query: 'matrix')
17
- movies.first['title'].must_equal "The Matrix"
18
- end
19
-
20
- # TMDB::Search#movie(movie_id)
21
-
22
- it "tmdb.movie('550') should return the movie Fight Club" do
23
- movie = search.movie('550')
24
- movie['title'].must_equal "Fight Club"
25
- end
26
-
27
- end