omdb 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a6748705ab9e28e8983957325715af4fd7acf414
4
- data.tar.gz: 97e56ae05d7a03727b2ce5a3ded80654980e59fa
3
+ metadata.gz: 47c4874c679322d88f01d637938acc7120c5bec9
4
+ data.tar.gz: 0a722724e52d22703b5336577ccc0589178cd728
5
5
  SHA512:
6
- metadata.gz: 2cb7b298e24ec2e345862f7186f4e7cf44f410d15f227c76af320a404ba4718258516469f16aa51c570dd0a412c79b8e84f51c11045dbefc2387bd6c8d202538
7
- data.tar.gz: b691899f7d286275e26894f9bf289afec68ecc25bcdf7b555df7daf788bcaa1cdc9fa0ab1483cf56cb09d73d17c1584c9a086a58594bb5c361daf7c58867bd9c
6
+ metadata.gz: 46b1ba2a8f4ca568aa9ff946c2064e811f9a116b12a82e898d9c1bff85dc3270cdc6883a6be6aa561759739003b847903de67aa8773b27e0bcb2dcf9d2975390
7
+ data.tar.gz: 7b5740cb0f9c828218a3b7975aef48635bf9b5a64a09cb7501196d442042cc13024613848e64e53a824b6b984f1ef3c6f77e3935a11b8b2cf1330ece062a0f3c
data/CHANGELOG ADDED
@@ -0,0 +1,8 @@
1
+ 1.0.4
2
+ * Added Metascore, language, country and awards
3
+
4
+ 1.0.3
5
+ * Added poster information
6
+
7
+ 1.0
8
+ * Initial creation of the gem
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # Omdb
2
- [![Code Climate](https://codeclimate.com/repos/51dc6afbc7f3a37a72002061/badges/c245beb7b5f063dc7e94/gpa.png)](https://codeclimate.com/repos/51dc6afbc7f3a37a72002061/feed)
2
+ [![Code Climate](https://codeclimate.com/github/jvanbaarsen/omdb.png)](https://codeclimate.com/github/jvanbaarsen/omdb)
3
3
  [![Build Status](https://travis-ci.org/jvanbaarsen/omdb.png?branch=master)](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,3 +1,3 @@
1
1
  module Omdb
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
3
3
  end
@@ -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"}
@@ -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.3
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: 2013-11-18 00:00:00.000000000 Z
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.0.6
146
+ rubygems_version: 2.2.1
146
147
  signing_key:
147
148
  specification_version: 4
148
149
  summary: Easy gateway to the OMDB Api