omdb 1.0.3 → 1.0.4
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 +4 -4
- data/CHANGELOG +8 -0
- data/README.md +3 -2
- data/lib/omdb/movie.rb +5 -1
- data/lib/omdb/version.rb +1 -1
- data/spec/fixtures/star_wars.json +1 -12
- data/spec/lib/omdb/movie_spec.rb +28 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47c4874c679322d88f01d637938acc7120c5bec9
|
4
|
+
data.tar.gz: 0a722724e52d22703b5336577ccc0589178cd728
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46b1ba2a8f4ca568aa9ff946c2064e811f9a116b12a82e898d9c1bff85dc3270cdc6883a6be6aa561759739003b847903de67aa8773b27e0bcb2dcf9d2975390
|
7
|
+
data.tar.gz: 7b5740cb0f9c828218a3b7975aef48635bf9b5a64a09cb7501196d442042cc13024613848e64e53a824b6b984f1ef3c6f77e3935a11b8b2cf1330ece062a0f3c
|
data/CHANGELOG
ADDED
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Omdb
|
2
|
-
[](https://codeclimate.com/github/jvanbaarsen/omdb)
|
3
3
|
[](https://travis-ci.org/jvanbaarsen/omdb)
|
4
4
|
|
5
5
|
This gem is an easy way to access the OMDB Api (http://www.omdbapi.com)
|
@@ -32,11 +32,12 @@ This will return an hash with movies
|
|
32
32
|
To fetch a single movie (when you know the full name):
|
33
33
|
|
34
34
|
Omdb::Api.new.fetch('MOVIE NAME')
|
35
|
+
Omdb::Api.new.fetch('MOVIE NAME', YEAR (Optional))
|
35
36
|
|
36
37
|
This will return a Omdb::Movie object with the following properties:
|
37
38
|
|
38
39
|
:loaded, :title, :year, :rated, :released, :runtime, :genre, :director, :writer, :actors, :plot,
|
39
|
-
:poster, :imdb_rating, :imdb_votes, :imdb_id, :type
|
40
|
+
:poster, :imdb_rating, :imdb_votes, :imdb_id, :type, :metascore, :language, :country, :awards
|
40
41
|
|
41
42
|
## Contributing
|
42
43
|
|
data/lib/omdb/movie.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Omdb
|
2
2
|
class Movie
|
3
3
|
attr_reader :loaded, :title, :year, :rated, :released, :runtime, :genre, :director, :writer, :actors, :plot,
|
4
|
-
:poster, :imdb_rating, :imdb_votes, :imdb_id, :type
|
4
|
+
:poster, :imdb_rating, :imdb_votes, :imdb_id, :type, :metascore, :language, :country, :awards
|
5
5
|
|
6
6
|
def initialize(movie)
|
7
7
|
@title = movie["Title"]
|
@@ -17,6 +17,10 @@ module Omdb
|
|
17
17
|
@actors = movie["Actors"]
|
18
18
|
@plot = movie["Plot"]
|
19
19
|
@poster = movie["Poster"]
|
20
|
+
@metascore = movie["Metascore"]
|
21
|
+
@language = movie["Language"]
|
22
|
+
@country = movie["Country"]
|
23
|
+
@awards = movie["Awards"]
|
20
24
|
end
|
21
25
|
end
|
22
26
|
end
|
data/lib/omdb/version.rb
CHANGED
@@ -1,12 +1 @@
|
|
1
|
-
{
|
2
|
-
"Title":"Star Wars",
|
3
|
-
"Year":"1977",
|
4
|
-
"Rated":"PG",
|
5
|
-
"Released":"25 May 1977",
|
6
|
-
"Runtime":"2 h 1 min",
|
7
|
-
"Genre":"Action, Adventure, Fantasy, Sci-Fi",
|
8
|
-
"Director":"George Lucas",
|
9
|
-
"Writer":"George Lucas",
|
10
|
-
"Actors":"Mark Hamill, Harrison Ford, Carrie Fisher, Alec Guinness",
|
11
|
-
"Plot":"Luke Skywalker joins forces with a Jedi Knight, a cocky pilot, a wookiee and two droids to save the universe from the Empire's world-destroying battle-station, while also attempting to rescue Princess Leia from the evil Darth Vader.","Poster":"http://ia.media-imdb.com/images/M/MV5BMTU4NTczODkwM15BMl5BanBnXkFtZTcwMzEyMTIyMw@@._V1_SX300.jpg","imdbRating":"8.8","imdbVotes":"542,574","imdbID":"tt0076759","Type":"movie","Response":"True"
|
12
|
-
}
|
1
|
+
{"Title":"Star Wars","Year":"1977","Rated":"PG","Released":"25 May 1977","Runtime":"121 min","Genre":"Action, Adventure, Fantasy","Director":"George Lucas","Writer":"George Lucas","Actors":"Mark Hamill, Harrison Ford, Carrie Fisher, Peter Cushing","Plot":"Luke Skywalker joins forces with a Jedi Knight, a cocky pilot, a wookiee and two droids to save the universe from the Empire's world-destroying battle-station, while also attempting to rescue Princess Leia from the evil Darth Vader.","Language":"English","Country":"USA","Awards":"Won 6 Oscars. Another 35 wins & 26 nominations.","Poster":"http://ia.media-imdb.com/images/M/MV5BMTU4NTczODkwM15BMl5BanBnXkFtZTcwMzEyMTIyMw@@._V1_SX300.jpg","Metascore":"91","imdbRating":"8.7","imdbVotes":"640,710","imdbID":"tt0076759","Type":"movie","Response":"True"}
|
data/spec/lib/omdb/movie_spec.rb
CHANGED
@@ -98,6 +98,34 @@ describe 'Omdb::Movie' do
|
|
98
98
|
expect(movie.poster).to eq('poster_url')
|
99
99
|
end
|
100
100
|
end
|
101
|
+
|
102
|
+
describe '#metascore' do
|
103
|
+
it 'returns the metascore' do
|
104
|
+
movie = create_movie_object('{"Metascore":"100"}')
|
105
|
+
expect(movie.metascore).to eq('100')
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
describe '#language' do
|
110
|
+
it 'returns the language' do
|
111
|
+
movie = create_movie_object('{"Language":"en"}')
|
112
|
+
expect(movie.language).to eq('en')
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
describe '#country' do
|
117
|
+
it 'returns the country' do
|
118
|
+
movie = create_movie_object('{"Country":"USA"}')
|
119
|
+
expect(movie.country).to eq('USA')
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
describe '#awards' do
|
124
|
+
it 'returns the awards' do
|
125
|
+
movie = create_movie_object('{"Awards":"6 Oscars"}')
|
126
|
+
expect(movie.awards).to eq('6 Oscars')
|
127
|
+
end
|
128
|
+
end
|
101
129
|
end
|
102
130
|
|
103
131
|
def create_movie_object(json_data)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omdb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeroen van Baarsen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -104,6 +104,7 @@ files:
|
|
104
104
|
- .gitignore
|
105
105
|
- .rspec
|
106
106
|
- .travis.yml
|
107
|
+
- CHANGELOG
|
107
108
|
- Gemfile
|
108
109
|
- Guardfile
|
109
110
|
- LICENSE.txt
|
@@ -142,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
143
|
version: '0'
|
143
144
|
requirements: []
|
144
145
|
rubyforge_project:
|
145
|
-
rubygems_version: 2.
|
146
|
+
rubygems_version: 2.2.1
|
146
147
|
signing_key:
|
147
148
|
specification_version: 4
|
148
149
|
summary: Easy gateway to the OMDB Api
|