movieDB 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +26 -0
- data/Rakefile +1 -0
- data/lib/movieDB.rb +137 -0
- data/lib/movieDB/base.rb +14 -0
- data/lib/movieDB/movie_error.rb +20 -0
- data/lib/movieDB/person.rb +124 -0
- data/lib/movieDB/status_checker.rb +50 -0
- data/lib/movieDB/version.rb +3 -0
- data/movieDB.gemspec +26 -0
- data/spec/.DS_Store +0 -0
- data/spec/movieDB_spec.rb +64 -0
- data/spec/person_spec.rb +15 -0
- data/spec/spec_helper.rb +8 -0
- metadata +134 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9d31dfb59074b8ad2c6c72aaf78b794ded177607
|
4
|
+
data.tar.gz: 1541e3b8f9f5733b09e8839157a511258a3044de
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2280db3604888ce2dad97e7661b7fdd457b6f37b00e8dfb6d00f4928ae8898a57fefa82f1921fc4d42050d52eab5b658abc4e58ba130a7fce72256567297e9e1
|
7
|
+
data.tar.gz: fab70739464d28c0fb82991d4aec2791b8b98ce2a1342760040078f798ea0e9f99e2b414a1fed0ad9870b4e7f27f7d176d8f2f2be0a5f2786dedea7354fe5008
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Albert_McKeever
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# MovieDB - Open Source Movie Data Analysis Tool
|
2
|
+
|
3
|
+
## Description
|
4
|
+
|
5
|
+
A Simple Ruby Movie/Film library that data store.
|
6
|
+
|
7
|
+
Basic functions:
|
8
|
+
* Allows a user to create, read, update and delete movie items from the data store via API.
|
9
|
+
* Raises an error and perform validations on film titles
|
10
|
+
* Allows a user to search for actors, actresses, directors, writers etc.
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
Add this line to your application's Gemfile:
|
15
|
+
|
16
|
+
gem 'movieDB'
|
17
|
+
|
18
|
+
And then execute:
|
19
|
+
|
20
|
+
$ bundle
|
21
|
+
|
22
|
+
Or install it yourself as:
|
23
|
+
|
24
|
+
$ gem install movieDB
|
25
|
+
|
26
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/lib/movieDB.rb
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'active_support/all'
|
3
|
+
require 'time'
|
4
|
+
require 'MovieDB/base'
|
5
|
+
require 'MovieDB/Person'
|
6
|
+
require "movieDB/version"
|
7
|
+
|
8
|
+
##
|
9
|
+
# Create a new movie record. The values are stored in the key-value data store.
|
10
|
+
#
|
11
|
+
# Default values are supplement during the instantiation of the class.
|
12
|
+
# Those values are overriden when you provide one.
|
13
|
+
#
|
14
|
+
# Example
|
15
|
+
# movie = Movie.new()
|
16
|
+
# movie.title = "When Sally Met Harry"
|
17
|
+
unless defined? MovieDB
|
18
|
+
module MovieDB
|
19
|
+
class Movie < MovieDB::Base
|
20
|
+
|
21
|
+
prepend StatusChecker
|
22
|
+
|
23
|
+
attr_accessor :title, :cast, :director, :released_date, :released_date, :film_release, :writer,
|
24
|
+
:unique_id, :genre, :academy_award_nomination, :academy_award_wins, :golden_globe_nominations, :golden_globe_wins,
|
25
|
+
:bafta_nomination, :bafta_wins, :worldwide_gross
|
26
|
+
alias :released? :film_release
|
27
|
+
|
28
|
+
DEFAULT_TITLE = "Method Missing"
|
29
|
+
DEFAULT_CAST = ['David Black', "Paola Perotta", "Obie Fernandez", "David Chelimsky"]
|
30
|
+
DEFAULT_DIRECTOR = "Yukihiro 'Matz' Matsumoto"
|
31
|
+
DEFAULT_RELEASED_DATE = "2005-12-13"
|
32
|
+
DEFAULT_FILM_RELEASE = ['theatrical', 'video', 'television', 'internet', 'print']
|
33
|
+
DEFAULT_WRITER = 'David Heinemeier Hansson'
|
34
|
+
DEFAULT_UNIQUE_ID = @unique_id
|
35
|
+
DEFAULT_GENRE = ["Bromantic", "Syfy"]
|
36
|
+
DEFAULT_ACADEMY_AWARD_NOMINATION = 4
|
37
|
+
DEFAULT_ACADEMY_AWARD_WINS = 3
|
38
|
+
DEFAULT_GOLDEN_GLOBE_NOMINATIONS = 4
|
39
|
+
DEFAULT_GOLDEN_GLOBE_WINS = 2
|
40
|
+
DEFAULT_BAFTA_NOMINATION = 3
|
41
|
+
DEFAULT_BAFTA_WINS = 1
|
42
|
+
DEFAULT_WORLDWIDE_GROSS = "$9750 Million"
|
43
|
+
|
44
|
+
def initialize(attributes={})
|
45
|
+
movie_attr = %w(title cast director released_date film_release writer unique_id
|
46
|
+
genre academy_award_nomination academy_award_wins golden_globe_nominations
|
47
|
+
golden_globe_wins bafta_nomination bafta_wins worldwide_gross)
|
48
|
+
movie_attr.each do |attr|
|
49
|
+
self.send "#{attr}=", (attributes.has_key?(attr.to_sym) ? attributes[attr.to_sym] : self.class.const_get("DEFAULT_#{attr.upcase}"))
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
##
|
54
|
+
# Iterating through the block for title duplication.
|
55
|
+
# Return a true if the array is not nil.
|
56
|
+
# Absence of title duplications should yield an empty array.
|
57
|
+
|
58
|
+
def self.title_present?
|
59
|
+
titles = Movie.instance_eval{filter_movie_attr("title")}
|
60
|
+
@title_exist = titles.detect{|duplicates|titles.count(duplicates) > 1}
|
61
|
+
!@title_exist.nil?
|
62
|
+
end
|
63
|
+
|
64
|
+
def unique_id
|
65
|
+
@unique_id ||= "#{Date.today}#{Array.new(9){rand(9)}.join}".gsub('-','')
|
66
|
+
end
|
67
|
+
|
68
|
+
class << self
|
69
|
+
def create_movie_info(title, cast, director, released_date, film_release, writer, unique_id,
|
70
|
+
genre, academy_award_nomination, academy_award_wins, golden_globe_nominations,
|
71
|
+
golden_globe_wins, bafta_nomination, bafta_wins, worldwide_gross)
|
72
|
+
|
73
|
+
@movie_DS ||=[]
|
74
|
+
movie_info = Movie.new
|
75
|
+
movie_info.title = title
|
76
|
+
movie_info.cast = cast
|
77
|
+
movie_info.director = director
|
78
|
+
movie_info.released_date = released_date
|
79
|
+
movie_info.film_release = film_release
|
80
|
+
movie_info.writer = writer
|
81
|
+
movie_info.unique_id = @unique_id
|
82
|
+
movie_info.genre = genre
|
83
|
+
movie_info.academy_award_nomination = academy_award_nomination
|
84
|
+
movie_info.academy_award_wins = academy_award_wins
|
85
|
+
movie_info.golden_globe_nominations = golden_globe_nominations
|
86
|
+
movie_info.golden_globe_wins = golden_globe_wins
|
87
|
+
movie_info.bafta_nomination = bafta_nomination
|
88
|
+
movie_info.bafta_wins = bafta_wins
|
89
|
+
movie_info.worldwide_gross = worldwide_gross
|
90
|
+
@movie_DS << movie_info
|
91
|
+
|
92
|
+
if Movie.title_present?
|
93
|
+
raise ArgumentError, "The title #{@title_exist} has already been taking"
|
94
|
+
else
|
95
|
+
return @movie_DS
|
96
|
+
end
|
97
|
+
|
98
|
+
end
|
99
|
+
|
100
|
+
##
|
101
|
+
# Filter the data store for the movie attributes. Return an array of the attributes.
|
102
|
+
#
|
103
|
+
# Example.
|
104
|
+
# Movie.filter_movie_attr('cast') #=> ["Chris_Hemsworth", "Natalie_Portman"]
|
105
|
+
|
106
|
+
def filter_movie_attr(attr)
|
107
|
+
attr_raw = attr
|
108
|
+
attr_sym = attr.to_sym
|
109
|
+
|
110
|
+
raise ArgumentError, "#{attr_sym} is not a valid attribute." if !attr_sym == :director && :cast
|
111
|
+
filtered = @movie_DS.select{|ds| ds.attr_title?}.map(&attr_sym).flatten
|
112
|
+
attr_raw == 'title' ? filtered : filtered.uniq
|
113
|
+
end
|
114
|
+
end
|
115
|
+
private_class_method :create_movie_info, :filter_movie_attr
|
116
|
+
|
117
|
+
def attr_title
|
118
|
+
!@title.nil?
|
119
|
+
end
|
120
|
+
alias :attr_title? :attr_title
|
121
|
+
|
122
|
+
##
|
123
|
+
# Use the double splat to capture auxillary arguments.
|
124
|
+
#
|
125
|
+
# Example
|
126
|
+
#
|
127
|
+
# capture(synopsis: "Last Vegas - Four geriatric friends vow to set Las Vegas Ablaze.")
|
128
|
+
def capture(**opts)
|
129
|
+
@synopsis = opts
|
130
|
+
end
|
131
|
+
|
132
|
+
def wrap(synopsis, before: "(", after: ")")
|
133
|
+
"#{before}#{synopsis}#{after}"
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
data/lib/movieDB/base.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'MovieDB/status_checker'
|
3
|
+
require 'MovieDB/movie_error'
|
4
|
+
|
5
|
+
module MovieDB #:nodoc
|
6
|
+
# MoviesDB v0.1.0 can manage the data store of pre-production, production and final film releases.
|
7
|
+
# Its a solution to the common problem of building a multi-database that utilizes both SQL and NoSQL
|
8
|
+
# combined features to increase speed and performance for reading records.
|
9
|
+
class Base
|
10
|
+
include StatusChecker
|
11
|
+
include MovieError
|
12
|
+
end
|
13
|
+
end
|
14
|
+
$:.unshift File.expand_path('..', __FILE__)
|
@@ -0,0 +1,20 @@
|
|
1
|
+
##
|
2
|
+
#TODO: Re-word the responses to be human readable.
|
3
|
+
|
4
|
+
module MovieDB
|
5
|
+
module MovieError
|
6
|
+
def raise_errors(response)
|
7
|
+
case response.to_i
|
8
|
+
when 200
|
9
|
+
raise OK, "(#{response}: Successful )"
|
10
|
+
when 404
|
11
|
+
raise NotFound, "(#{response}: Resource Not found)"
|
12
|
+
when 500
|
13
|
+
raise Lookup, "(#{response}: Internal Server Error.)"
|
14
|
+
when 503
|
15
|
+
raise Unavailable, "(#{response}: Resource is Unavailable.)"
|
16
|
+
else
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,124 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'time'
|
3
|
+
|
4
|
+
##
|
5
|
+
# Create an actor instance and return the values for
|
6
|
+
# actor = MovieDB::Actor.instance_eval{create_with_info("Brittany Murphy", "F", "1977-11-10", "2009-12-20")}
|
7
|
+
# actor = MovieDB::Actor.instance_eval{create_with_info("George Clooney", "M", "1961-05-06", nil)}
|
8
|
+
# # Name
|
9
|
+
# # actor_name = actor.map(&:name) #=> ["Brittany Murphy"]
|
10
|
+
#
|
11
|
+
# # Alive?
|
12
|
+
# # actor_name = actor.map(&:alive?) #=> [false, true]
|
13
|
+
#
|
14
|
+
# # Age
|
15
|
+
# # actor_name = actor.map(&:age) #=> [32, 52]
|
16
|
+
#
|
17
|
+
|
18
|
+
module MovieDB
|
19
|
+
class Person
|
20
|
+
attr_accessor :name, :gender, :birth_date, :death_date, :birthplace
|
21
|
+
|
22
|
+
def initialize(name = nil, gender = nil, birth_date = nil, death_date = nil, birth_place = nil, opt={})
|
23
|
+
@name = name
|
24
|
+
@gender = gender
|
25
|
+
@birth_date = birth_date
|
26
|
+
@death_date = death_date
|
27
|
+
@birth_place = birth_place
|
28
|
+
end
|
29
|
+
|
30
|
+
def age
|
31
|
+
if alive?
|
32
|
+
a = Time.now - Time.parse(@birth_date)
|
33
|
+
else
|
34
|
+
a = Time.parse(@death_date) - Time.parse(@birth_date)
|
35
|
+
end
|
36
|
+
|
37
|
+
return (a/60/60/24/365).to_i
|
38
|
+
end
|
39
|
+
|
40
|
+
def alive?
|
41
|
+
!@death_date.nil?
|
42
|
+
end
|
43
|
+
|
44
|
+
class << self
|
45
|
+
def create_with_info(name, gender, birth_date, death_date)
|
46
|
+
@person_DS ||= []
|
47
|
+
person = MovieDB::Person.new
|
48
|
+
person.name = name
|
49
|
+
person.gender = gender
|
50
|
+
person.birth_date = birth_date
|
51
|
+
person.death_date = death_date
|
52
|
+
return @person_DS << person
|
53
|
+
end
|
54
|
+
|
55
|
+
def filter_person(attr)
|
56
|
+
attr = attr.to_sym
|
57
|
+
raise ArgumentError, "#{attr} can only be name or age" if !attr == :age && :name
|
58
|
+
return @person_DS.select{|s| s.alive?}.map(&attr)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
private_class_method :create_with_info, :filter_person
|
62
|
+
end
|
63
|
+
|
64
|
+
class Actor < Person
|
65
|
+
attr_accessor :filmography
|
66
|
+
|
67
|
+
def initialize(filmography = [])
|
68
|
+
super()
|
69
|
+
@filmography = filmography
|
70
|
+
end
|
71
|
+
|
72
|
+
def addFilms film
|
73
|
+
@filmology ||= []
|
74
|
+
end
|
75
|
+
|
76
|
+
def actor_actress_gender(person)
|
77
|
+
case when person.gender == 'F'
|
78
|
+
return "actress"
|
79
|
+
when person.gender == "M"
|
80
|
+
return "actor"
|
81
|
+
else
|
82
|
+
"N/A"
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
class << self
|
87
|
+
|
88
|
+
def filter_actor_alive(attr)
|
89
|
+
attr = attr.to_sym
|
90
|
+
raise ArgumentError, "#{attr} can only be name or age" if !attr == :age && :name
|
91
|
+
return @person_DS.select{|s| s.alive?}.map(&"#{attr.to_sym}")
|
92
|
+
end
|
93
|
+
|
94
|
+
def filter_actor_deceased(actor)
|
95
|
+
return @person_DS.select{|s| !s.alive?}.map{|m| "#{m.age}"} if attr == "age"
|
96
|
+
return @person_DS.select{|s| !s.alive?}.map{|m| "#{m.name}"} if attr == "name"
|
97
|
+
end
|
98
|
+
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
class Writer < Person
|
103
|
+
|
104
|
+
attr_accessor :published_work
|
105
|
+
alias :published? :published_work
|
106
|
+
|
107
|
+
def initialize(published_work = [])
|
108
|
+
super()
|
109
|
+
@published_work = published_work
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
113
|
+
|
114
|
+
class Director < Person
|
115
|
+
|
116
|
+
attr_accessor :filmography
|
117
|
+
|
118
|
+
def initialize(filmography = [])
|
119
|
+
super()
|
120
|
+
@filmography = filmography
|
121
|
+
end
|
122
|
+
|
123
|
+
end
|
124
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
##
|
2
|
+
# Check the film release and updates the status.
|
3
|
+
#
|
4
|
+
# Example
|
5
|
+
#
|
6
|
+
# movie = Movie.new(film_release: ['theatrical', 'print'])
|
7
|
+
# movie.status_check #=> 'Modified Wide Release'
|
8
|
+
|
9
|
+
module MovieDB
|
10
|
+
module StatusChecker
|
11
|
+
def self.included(base)
|
12
|
+
base.class_eval {
|
13
|
+
|
14
|
+
def theatrical_released?
|
15
|
+
self.movie_status == 'theartrical'
|
16
|
+
end
|
17
|
+
|
18
|
+
def video_released?
|
19
|
+
self.movie_status == 'video'
|
20
|
+
end
|
21
|
+
|
22
|
+
def television_released?
|
23
|
+
self.movie_status == 'television'
|
24
|
+
end
|
25
|
+
|
26
|
+
def internet_released?
|
27
|
+
self.movie_status == 'internet'
|
28
|
+
end
|
29
|
+
|
30
|
+
def print_released?
|
31
|
+
self.movie_status == 'print'
|
32
|
+
end
|
33
|
+
|
34
|
+
def status_check
|
35
|
+
case when self.theatrical_released? && self.television_released? && self.video_released? && self.print_released?
|
36
|
+
"Wide Release"
|
37
|
+
when self.theatrical_released? && self.print_released?
|
38
|
+
"Modified Wide Release"
|
39
|
+
when self.theatrical_released? && (self.internet_released? || self.print_released?)
|
40
|
+
"Exclusive and Limited Runs"
|
41
|
+
when self.theatrical_released? || self.television_released? || self.video_released? || self.print_released?
|
42
|
+
"Territorial Saturation"
|
43
|
+
else
|
44
|
+
"Not Released"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
}
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
data/movieDB.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'movieDB/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "movieDB"
|
8
|
+
spec.version = MovieDB::VERSION
|
9
|
+
spec.authors = ["Albert_McKeever"]
|
10
|
+
spec.email = ["kotn_ep1@hotmail.com"]
|
11
|
+
spec.description = %q{Collect Movie information And Analyse Data}
|
12
|
+
spec.summary = %q{Movie Statistic and Data Analysis}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "rspec"
|
24
|
+
spec.add_development_dependency 'fakeweb'
|
25
|
+
spec.add_dependency "activesupport", ">= 4.0.0"
|
26
|
+
end
|
data/spec/.DS_Store
ADDED
Binary file
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe MovieDB do
|
4
|
+
let(:defaultMovie){ MovieDB::Movie.new() }
|
5
|
+
|
6
|
+
describe "Initialize" do
|
7
|
+
it "should create a default list of movie attributes" do
|
8
|
+
defaultMovie.title.should == "Method Missing"
|
9
|
+
defaultMovie.cast.should == ['David Black', "Paola Perotta", "Obie Fernandez", "David Chelimsky"]
|
10
|
+
defaultMovie.director.should == "Yukihiro 'Matz' Matsumoto"
|
11
|
+
defaultMovie.released_date.should == "2005-12-13"
|
12
|
+
defaultMovie.film_release.should == ['theatrical', 'video', 'television', 'internet', 'print']
|
13
|
+
defaultMovie.writer.should == 'David Heinemeier Hansson'
|
14
|
+
defaultMovie.genre.should == ["Bromantic", "Syfy"]
|
15
|
+
defaultMovie.academy_award_nomination.should == 4
|
16
|
+
defaultMovie.academy_award_wins.should == 3
|
17
|
+
defaultMovie.golden_globe_nominations.should == 4
|
18
|
+
defaultMovie.golden_globe_wins.should == 2
|
19
|
+
defaultMovie.bafta_nomination.should == 3
|
20
|
+
defaultMovie.bafta_wins.should == 1
|
21
|
+
defaultMovie.worldwide_gross.should == "$9750 Million"
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should allow you to update title" do
|
25
|
+
defaultMovie.title = "Rails 4: Turbolinks Reloaded!"
|
26
|
+
defaultMovie.title.should == "Rails 4: Turbolinks Reloaded!"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "Adding movies to data store" do
|
31
|
+
before :each do
|
32
|
+
movie_DS = MovieDB::Movie.instance_eval{create_movie_info('Thor', %w(Chris_Hemsworth Natalie_Portman Tom_Hiddleston), 'Jon Turteltaub',
|
33
|
+
'2013-10-30', ['theatrical', 'print'], ["Christopher_Yost", "Christopher Markus"], ['Action', 'Adventure', 'Fantasy'], "",
|
34
|
+
"", "", "", "", "", "", '$86.1 Million')}
|
35
|
+
movie_DS = MovieDB::Movie.instance_eval{create_movie_info('Last Vegas', %w(Morgan Freeman', 'Robert De Niro', 'Michael Douglas', 'Kevin Kline', 'Mary Steenburgen'), 'Alan Taylor',
|
36
|
+
'2013-10-30', ['theatrical', 'print'], ["Dan Fogelman"], ['Comedy'], "",
|
37
|
+
"", "", "", "", "", "", '$11.2 Million')}
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
it "Should return names of all titles" do
|
42
|
+
MovieDB::Movie.instance_eval{filter_movie_attr("title")}.should == ["Thor", "Last Vegas"]
|
43
|
+
end
|
44
|
+
|
45
|
+
it "Should return names of all directors" do
|
46
|
+
MovieDB::Movie.instance_eval{filter_movie_attr("director")}.should == ["Jon Turteltaub", "Alan Taylor"]
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe "Raise an Error" do
|
51
|
+
it "should raise an error if title already exists" do
|
52
|
+
expect { movie_DS }.to raise_error
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
context "#capture" do
|
57
|
+
let!(:newCap){ MovieDB::Movie.new()}
|
58
|
+
|
59
|
+
it "should accept new synopsis argument" do
|
60
|
+
newCap.capture( synopsis: "Last Vegas - Four geriatric friends vow to set Las Vegas Ablaze.").should === {:synopsis=>"Last Vegas - Four geriatric friends vow to set Las Vegas Ablaze."}
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
data/spec/person_spec.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe MovieDB::Person do
|
4
|
+
|
5
|
+
context "#filter_person" do
|
6
|
+
it "should return attributes" do
|
7
|
+
MovieDB::Person.instance_eval{create_with_info("Brittany Murphy", "F", "1977-11-10", "2009-12-20")}
|
8
|
+
MovieDB::Person.instance_eval{create_with_info("George Clooney", "M", "1961-05-06", nil)}
|
9
|
+
|
10
|
+
|
11
|
+
MovieDB::Person.instance_eval{filter_person('name')}.should == ['Brittany Murphy', 'George Clooney']
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: movieDB
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Albert_McKeever
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-11-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: fakeweb
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: activesupport
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 4.0.0
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 4.0.0
|
83
|
+
description: Collect Movie information And Analyse Data
|
84
|
+
email:
|
85
|
+
- kotn_ep1@hotmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- .gitignore
|
91
|
+
- Gemfile
|
92
|
+
- LICENSE.txt
|
93
|
+
- README.md
|
94
|
+
- Rakefile
|
95
|
+
- lib/movieDB.rb
|
96
|
+
- lib/movieDB/base.rb
|
97
|
+
- lib/movieDB/movie_error.rb
|
98
|
+
- lib/movieDB/person.rb
|
99
|
+
- lib/movieDB/status_checker.rb
|
100
|
+
- lib/movieDB/version.rb
|
101
|
+
- movieDB.gemspec
|
102
|
+
- spec/.DS_Store
|
103
|
+
- spec/movieDB_spec.rb
|
104
|
+
- spec/person_spec.rb
|
105
|
+
- spec/spec_helper.rb
|
106
|
+
homepage: ''
|
107
|
+
licenses:
|
108
|
+
- MIT
|
109
|
+
metadata: {}
|
110
|
+
post_install_message:
|
111
|
+
rdoc_options: []
|
112
|
+
require_paths:
|
113
|
+
- lib
|
114
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - '>='
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - '>='
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
requirements: []
|
125
|
+
rubyforge_project:
|
126
|
+
rubygems_version: 2.1.3
|
127
|
+
signing_key:
|
128
|
+
specification_version: 4
|
129
|
+
summary: Movie Statistic and Data Analysis
|
130
|
+
test_files:
|
131
|
+
- spec/.DS_Store
|
132
|
+
- spec/movieDB_spec.rb
|
133
|
+
- spec/person_spec.rb
|
134
|
+
- spec/spec_helper.rb
|