filmaffinity 0.2.3 → 0.2.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: 99b7c4d40a9e6593e9acfdee78840caf2bc05315
4
- data.tar.gz: 18eecf30e69c72d50e2aaf0545d0314861f4bea5
3
+ metadata.gz: 2b29b693cc94f96db2f05370d4a03c0c8b3938d8
4
+ data.tar.gz: af3023f07dbabf1b2372fd53401c8143e56b8b11
5
5
  SHA512:
6
- metadata.gz: f4d840368e62a73569e87d9a8fc6dda2a8bb47cd3f51b10348cf2d7e65ec2725927397dd434aa7f54c2fb870344e9581ee194bc7693e4782fbf599631bdce408
7
- data.tar.gz: f2656e1c31454ff8ef4bccf7b4b19bcb8483373891882219c8307f99f5e9a1e4952a1d83b6c59bb89cb3b68f87b25bd127ef209e9bbba948f75aa278b88b990c
6
+ metadata.gz: 12916f6d182bca700f638dbd0b4116560978d0ea927136ce7466d320b817a71776945581ed2907fc34845329716cb81cf990819ee013b6c109aea1510e2e2282
7
+ data.tar.gz: 070b296f0ae33872d7f5696ddac89a73193cacbf9caca8286efe35794f1277f2cd6f17a8b3363e924e1fb97fb652833d9ded80dea5e3485a178d153dd9bb6b4f
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'filmaffinity'
3
- s.version = '0.2.3'
3
+ s.version = '0.2.4'
4
4
  s.date = '2016-04-05'
5
5
  s.summary = "filmaffinity"
6
6
  s.description = "Easily use Ruby or the command line to find information on Filmaffinity.com"
@@ -1,9 +1,9 @@
1
1
  module FilmAffinity
2
2
  class Movie
3
3
  attr_reader :id, :title
4
- def initialize id,title
4
+ def initialize id, title = nil
5
5
  @id = id
6
- @title = title
6
+ @title = title if title
7
7
  @json_parser = JsonMovieParser.new
8
8
  end
9
9
 
@@ -15,6 +15,10 @@ module FilmAffinity
15
15
  open(Constants.urls[:movie] % id)
16
16
  end
17
17
 
18
+ def title
19
+ @title ||= document_html.at('#main-title span').content.strip
20
+ end
21
+
18
22
  def year
19
23
  document_html.at('dd[itemprop="datePublished"]').content[/\d+/].to_i
20
24
  end
@@ -2,6 +2,13 @@ require_relative "../spec_helper"
2
2
 
3
3
  describe "FilmAffinity::Movie" do
4
4
 
5
+ describe "#title" do
6
+ subject(:movie) { FilmAffinity::Movie.new(504889) }
7
+ it "should return an valid title when initializes with no title" do
8
+ expect(movie.title).to eq("El show de Truman (Una vida en directo)")
9
+ end
10
+ end
11
+
5
12
  describe "#rating" do
6
13
  subject(:movie) { FilmAffinity::Movie.new(504889, "El show de Truman (Una vida en directo)") }
7
14
  it "should return an Float" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: filmaffinity
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Santos, Oriol Bellido