tmdb_rexx 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 525dcc11a067ee90bdd1133e08430ef5e3655f30
4
+ data.tar.gz: abab56dab01d98a7aeec76e83d1a7022acedeb47
5
+ SHA512:
6
+ metadata.gz: 4095c3299d8f9c2ab8a1244495ad2ce0ac4512b2ca843a6fed1dccaaafae2dec988a7b5d2865bf41e7c3c8568c70168477310cd59196b9b36f7cc70922dff35b
7
+ data.tar.gz: 1805a3f11404303dcf32a8d48c9456d016f409aced82373b8e9d52d16573ffe7394700d36894de9cc4a04f3de4f824bf256a6b68e0e4398b7d572884c2f796cf
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,12 @@
1
+ language: ruby
2
+ before_install:
3
+ - gem update bundler
4
+ rvm:
5
+ - ruby-head
6
+ - 2.2.0
7
+ - 2.1.0
8
+ - 2.0.0
9
+ - jruby-head
10
+ addons:
11
+ code_climate:
12
+ repo_token: 0e852ef62c6a1a460825a3b6963870f323526253921c0a162a8642bb72ecca82
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in movie_rexx.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Jason Truluck
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
13
+ all 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
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,64 @@
1
+ # TmdbRexx
2
+
3
+ [![Build Status](https://travis-ci.org/FilmRexx/tmdb_rexx.svg?branch=master)](https://travis-ci.org/FilmRexx/tmdb_rexx)
4
+ [![Code Climate](https://codeclimate.com/github/FilmRexx/tmdb_rexx/badges/gpa.svg)](https://codeclimate.com/github/FilmRexx/tmdb_rexx)
5
+ [![Test Coverage](https://codeclimate.com/github/FilmRexx/tmdb_rexx/badges/coverage.svg)](https://codeclimate.com/github/FilmRexx/tmdb_rexx/coverage)
6
+
7
+ This is TmdbRexx a simple wrapper around the TMDB API v3 written in ruby.
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'tmdb_rexx'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install tmdb_rexx
24
+
25
+ ## Documentation
26
+
27
+ http://rdoc.info/github/FilmRexx/tmdb_rexx/master/index
28
+
29
+ ## Configuration
30
+
31
+ Configuration allows for specifying TMDB api information
32
+
33
+ `api_key` - *required* The api key generated by the [TMDB api](https://www.themoviedb.org/documentation/api)
34
+
35
+ `base_url` - The base url used for querying against the TMDB api. Defaults to `https://api.themoviedb.org`
36
+
37
+ `version` - The API version to use. Defaults to `3`
38
+
39
+ `include_adult` - If you would like to include adult films and tv [Boolean]. Defaults to `false`
40
+
41
+ `language` - The language you would like to have information returned in. Defaults to `en`
42
+
43
+ Within an initializer `config/initializer/tmdb_rexx.rb`
44
+
45
+ ```ruby
46
+ TmdbRexx.configure do |c|
47
+ c.api_key = "some_api_key" # Required for functionality
48
+ c.include_adult = true # this includes adult films and tv
49
+ c.language = "fr" # this changes the language to French where supported
50
+ end
51
+ ```
52
+ ## Development
53
+
54
+ After checking out the repo, run `bundle install` to install dependencies. Then, run `rake` for a baseline test run.
55
+
56
+ ## Contributing
57
+
58
+ *Make sure to write test!*
59
+
60
+ 1. Fork it ( https://github.com/[my-github-username]/tmdb_rexx/fork )
61
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
62
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
63
+ 4. Push to the branch (`git push origin my-new-feature`)
64
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ begin
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task :default => :spec
9
+ rescue LoadError
10
+ # no rspec available
11
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "movie_rexx"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,24 @@
1
+ module TmdbRexx
2
+ class Client
3
+ module Certification
4
+ RESOURCE = "certification".freeze
5
+
6
+ # Get the list of supported certifications for movies. These can be used
7
+ # in conjunction with the certification_country and certification.lte
8
+ # parameters when using discover.
9
+ #
10
+ # @see
11
+ # http://docs.themoviedb.apiary.io/#reference/movies/certificationmovielist
12
+ #
13
+ # @param [String] type the resource type you want certifications for
14
+ #
15
+ # @return [Hashie::Mash] response
16
+ #
17
+ # @example Get the movie certifications api response
18
+ # client.certifications("movies")
19
+ def certifications(type = "movie", options = {})
20
+ get([RESOURCE, type, "list"].join("/"), options).certifications
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,32 @@
1
+ module TmdbRexx
2
+ class Client
3
+ module Changes
4
+ RESOURCE = "changes".freeze
5
+ POSSIBLE_TYPES = ["movie", "person", "tv"].freeze
6
+
7
+ # Get a list of movie ids that have been edited. By default we
8
+ # show the last 24 hours and only 100 items per page. The
9
+ # maximum number of days that can be returned in a single
10
+ # request is 14. You can then use the movie changes API to get
11
+ # the actual data that has been changed.
12
+ #
13
+ # Please note: the change log system to support this was
14
+ # changed on October 5, 2012 and will only show movies that
15
+ # have been edited since.
16
+ #
17
+ # @see http://docs.themoviedb.apiary.io/#reference/changes
18
+ #
19
+ # @param [String] type the type of resource to get changes
20
+ # for. Available options include `movie`, `person`, and `tv`
21
+ #
22
+ # @return [Hashie::Mash] changes response
23
+ #
24
+ # @example Get the movie changes api response
25
+ # TmdbRexx::Client.changes("movie")
26
+ def changes(type = "movie", options = {})
27
+ raise InvalidTypeError unless POSSIBLE_TYPES.include?(type)
28
+ get([type, RESOURCE].join("/"), options)
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,40 @@
1
+ module TmdbRexx
2
+ class Client
3
+ module Collection
4
+ RESOURCE = "collection".freeze
5
+
6
+ # Get the basic collection information for a specific
7
+ # collection id. You can get the ID needed for this method by
8
+ # making a /movie/{id} request and paying attention to the
9
+ # belongs_to_collection hash.Movie parts are not sorted in any
10
+ # particular order. If you would like to sort them yourself you
11
+ # can use the provided release_date.
12
+ #
13
+ # @see http://docs.themoviedb.apiary.io/#reference/collections
14
+ #
15
+ # @param [String] collection_id the id of the collection
16
+ #
17
+ # @return [Hashie::Mash] collections response
18
+ #
19
+ # @example Get the collections api response
20
+ # TmdbRexx::Client.collection("collection-id")
21
+ def collection(collection_id, options = {})
22
+ get([RESOURCE, collection_id].join("/"), options)
23
+ end
24
+
25
+ # Get all of the images for a particular collection by collection id.
26
+ #
27
+ # @see http://docs.themoviedb.apiary.io/#reference/collectionidimages
28
+ #
29
+ # @param [String] collection_id the id of the collection
30
+ #
31
+ # @return [Hashie::Mash] collections response
32
+ #
33
+ # @example Get the images in the collections api response
34
+ # TmdbRexx::Client.collection_images("collection-id")
35
+ def collection_images(collection_id, options = {})
36
+ get([RESOURCE, collection_id, "images"].join("/"), options)
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,37 @@
1
+ module TmdbRexx
2
+ class Client
3
+ module Company
4
+ RESOURCE = "company".freeze
5
+
6
+
7
+ # This method is used to retrieve all of the basic information about a company.
8
+ #
9
+ # @see http://docs.themoviedb.apiary.io/#reference/companyid
10
+ #
11
+ # @param [String] company_id the id of the company
12
+ #
13
+ # @return [Hashie::Mash] companyies response
14
+ #
15
+ # @example Get the companys api response
16
+ # TmdbRexx::Client.company("company-id")
17
+ def company(company_id, options = {})
18
+ get([RESOURCE, company_id].join("/"), options)
19
+ end
20
+
21
+
22
+ # Get the list of movies associated with a particular company.
23
+ #
24
+ # @see http://docs.themoviedb.apiary.io/#reference/companyidmovies
25
+ #
26
+ # @param [String] company_id the id of the company
27
+ #
28
+ # @return [Hashie::Mash] companies response
29
+ #
30
+ # @example Get the movies for the company api response
31
+ # TmdbRexx::Client.company_movies("company-id")
32
+ def company_movies(company_id, options = {})
33
+ get([RESOURCE, company_id, "movies"].join("/"), options)
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,28 @@
1
+ module TmdbRexx
2
+ class Client
3
+ module Credit
4
+ RESOURCE = "credit".freeze
5
+
6
+ # Get the detailed information about a particular credit record. This is
7
+ # currently only supported with the new credit model found in TV. These
8
+ # ids can be found from any TV credit response as well as the tv_credits
9
+ # and combined_credits methods for people.The episodes object returns a
10
+ # list of episodes and are generally going to be guest stars. The season
11
+ # array will return a list of season numbers. Season credits are credits
12
+ # that were marked with the "add to every season" option in the editing
13
+ # interface and are assumed to be "season regulars".#
14
+ #
15
+ # @see http://docs.themoviedb.apiary.io/#reference/credits
16
+ #
17
+ # @param [String] credit_id the id for the credits
18
+ #
19
+ # @return [Hashie::Mash] credits response
20
+ #
21
+ # @example Get the credits api response
22
+ # TmdbRexx::Client.credits("movie")
23
+ def credits(credit_id, options = {})
24
+ get([RESOURCE, credit_id].join("/"), options)
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,23 @@
1
+ module TmdbRexx
2
+ class Client
3
+ module Discover
4
+ RESOURCE = "discover".freeze
5
+
6
+ # Discover movies and tv shows by different types of data like average
7
+ # rating, number of votes, genres and certifications. You can get a valid
8
+ # list of certifications from the /certifications method.
9
+ #
10
+ # @see http://docs.themoviedb.apiary.io/#reference/discover
11
+ #
12
+ # @param [String] type the type to discover for for the discover
13
+ #
14
+ # @return [Hashie::Mash] discover response
15
+ #
16
+ # @example Get the discover api response
17
+ # TmdbRexx::Client.discover("movie", { primary_release_year: 2015 })
18
+ def discover(type = "movie", options = {})
19
+ get([RESOURCE, type].join("/"), options)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,36 @@
1
+ module TmdbRexx
2
+ class Client
3
+ module Find
4
+ RESOURCE = "find".freeze
5
+ EXTERNAL_SOURCES = ["imdb_id", "freebase_mid", "freebase_id",
6
+ "tvrage_id", "tvdb_id"].freeze
7
+
8
+ # The find method makes it easy to search for objects in our database by
9
+ # an external id. For instance, an IMDB ID. This will search all objects
10
+ # (movies, TV shows and people) and return the results in a single
11
+ # response.The supported external sources for each object are as
12
+ # follows:
13
+ #
14
+ # * Movies: imdb_id
15
+ # * People: imdb_id, freebase_mid, freebase_id, tvrage_id
16
+ # * TV Series: imdb_id, freebase_mid, freebase_id, tvdb_id, tvrage_id
17
+ # * TV Seasons: freebase_mid, freebase_id, tvdb_id, tvrage_id
18
+ # * TV Episodes: imdb_id, freebase_mid, freebase_id, tvdb_id, tvrage_id
19
+ #
20
+ # @see http://docs.themoviedb.apiary.io/#reference/find
21
+ #
22
+ # @param [String] external_id the id in the external source
23
+ # @param [String] external_source the the external source to query
24
+ #
25
+ # @return [Hashie::Mash] find response
26
+ #
27
+ # @example Get the find api response
28
+ # TmdbRexx::Client.find("external-id", "external-source")
29
+ def find(external_id, external_source = "imdb_id", options = {})
30
+ raise InvalidExternalSourceError unless EXTERNAL_SOURCES.include?(external_source)
31
+ options.merge!(external_source: external_source)
32
+ get([RESOURCE, external_id].join("/"), options)
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,39 @@
1
+
2
+ module TmdbRexx
3
+ class Client
4
+ module Genre
5
+ RESOURCE = "genre".freeze
6
+ POSSIBLE_TYPES = ["movie", "tv"].freeze
7
+
8
+ # Get the list of movie or tv genres.
9
+ #
10
+ # @see # http://docs.themoviedb.apiary.io/#reference/movies/genres
11
+ #
12
+ # @param [String] type the resource type you want genres for
13
+ #
14
+ # @return [Hashie::Mash] response
15
+ #
16
+ # @example Get the movie genres api response
17
+ # client.genres("movie")
18
+ def genres(type = "movie", options = {})
19
+ raise InvalidTypeError unless POSSIBLE_TYPES.include?(type)
20
+ get([RESOURCE, type, "list"].join("/"), options).genres
21
+ end
22
+
23
+ # Get the list of movies for a particular genre by id. By default, only
24
+ # movies with 10 or more votes are included.
25
+ #
26
+ # @see # http://docs.themoviedb.apiary.io/#reference/movies/genremovielist
27
+ #
28
+ # @param [String] genre_id the if of the genre to get movies for
29
+ #
30
+ # @return [Hashie::Mash] response
31
+ #
32
+ # @example Get the movies for the genre api response
33
+ # client.genre_movies("genre-id")
34
+ def genre_movies(genre_id, options = {})
35
+ get([RESOURCE, genre_id, "movies"].join("/"), options)
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,19 @@
1
+ module TmdbRexx
2
+ class Client
3
+ module Job
4
+ RESOURCE = "job".freeze
5
+
6
+ # Get the list of valid jobs
7
+ #
8
+ # @see # http://docs.themoviedb.apiary.io/#reference/movies/joblist
9
+ #
10
+ # @return [Hashie::Mash] response
11
+ #
12
+ # @example Get the jobs api response
13
+ # client.jobs
14
+ def jobs(options = {})
15
+ get([RESOURCE, "list"].join("/"), options).jobs
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,35 @@
1
+ module TmdbRexx
2
+ class Client
3
+ module Keyword
4
+ RESOURCE = "keyword".freeze
5
+
6
+ # Get the basic information for a specific keyword id.
7
+ #
8
+ # @see # http://docs.themoviedb.apiary.io/#reference/movies/keywordid
9
+ #
10
+ # @param [String] keyword_id the id of the keyword to get information about
11
+ #
12
+ # @return [Hashie::Mash] response
13
+ #
14
+ # @example Get the keyword api response
15
+ # client.keyword("keyword-id")
16
+ def keyword(keyword_id, options = {})
17
+ get([RESOURCE, keyword_id].join("/"), options)
18
+ end
19
+
20
+ # Get the list of movies for a particular keyword by id.
21
+ #
22
+ # @see # http://docs.themoviedb.apiary.io/#reference/movies/keywordidmovies
23
+ #
24
+ # @param [String] keyword_id the id of the keyword to get information about
25
+ #
26
+ # @return [Hashie::Mash] response
27
+ #
28
+ # @example Get the movies for the keyword api response
29
+ # client.keyword_movies("keyword-id")
30
+ def keyword_movies(keyword_id, options = {})
31
+ get([RESOURCE, keyword_id, "movies"].join("/"), options)
32
+ end
33
+ end
34
+ end
35
+ end