filmaffinity 0.0.4 → 0.1.0

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: 8902c8713ff5695c57f80e2e44ba3b770b9041cd
4
- data.tar.gz: f366e254a0e4ba6ac495af6bd25adc6b7f9906d8
3
+ metadata.gz: b0efb3c7cb1edd3e42f6cc26cf6ff46115e35fcd
4
+ data.tar.gz: 143906fc579ab95b2ab9805412add696670fa6af
5
5
  SHA512:
6
- metadata.gz: 5337977d4d3a5bd3f7a666d8f9334cb6f9ae5cd587f4ac02837e68267c14ff32f797100d73f7bffa2be99d322f31fc68e7cdaf11df4830cdf60eb6da2d82fcef
7
- data.tar.gz: 0c258a0e379f73c8e7dd135b61bb2da5215f38773e3d76cf2a78beee9c1c552087c1442b2117c6a1b48a35c93445a3fd60969a3a315c9b75a7275bc1c7297e06
6
+ metadata.gz: e761a415326681ab8d31c647b8f26146dcf2233d1b1bab5ee5b9fa76dcb93bba4ac486e1fa30b2d89fbade3f4db2566cb2021cfc9d5d1eff9312c7173a3285f3
7
+ data.tar.gz: bd347512aed9c02a5a6192be2dea5ee94f9eca13d8bd56541251b19e6d5c09270a3d66b3e3a54bd19c07c354b56774618b7fb7c800e6b6a687d798e3e98419dd
data/README.md CHANGED
@@ -2,17 +2,23 @@
2
2
 
3
3
  ## Description
4
4
 
5
- The filmaffinity gem allows you to easy access publicly available data from Filmaffinity.com in spanish.
5
+ The filmaffinity gem allows you to easy access publicly available data from **Filmaffinity.com in spanish**.
6
6
 
7
7
  ## Features
8
8
 
9
- - ```FilmAffinity::Search.new title``` Search movies for a title
10
- - ```FilmAffinity::Movie.new id, title``` Retrieve complete movie info
11
- - ```FilmAffinity::Top.new``` Retrieve the Top 30
12
- - ```FilmAffinity::Top.new options``` Retrieve the Top with the given options
9
+ - Search movies for a title
10
+ - Retrieve complete movie info
11
+ - Retrieve the Top 30 of filmaffinity.com
12
+ - Retrieve the Top with the given options
13
13
 
14
14
  ## Documentation
15
15
 
16
+ ##### FilmAffinity::Search
17
+ Return an array of FilmAffinity::Movie, just containing preload ID and title.
18
+
19
+ ##### FilmAffinity::Movie
20
+ Include some methods to retrieve the complete movie info.
21
+
16
22
  ##### FilmAffinity::Top options
17
23
  The options hash could include:
18
24
  ```
@@ -68,7 +74,7 @@ The options hash could include:
68
74
  <FilmAffinity::Movie>
69
75
  ...]
70
76
 
71
- search.movies.first
77
+ top.movies.first
72
78
  #=> #<FilmAffinity::Movie>
73
79
 
74
80
  #Top FilmAffinity with options
@@ -84,7 +90,7 @@ The options hash could include:
84
90
  <FilmAffinity::Movie>
85
91
  ...]
86
92
 
87
- search.movies.first
93
+ top.movies.first
88
94
  #=> #<FilmAffinity::Movie>
89
95
 
90
96
  ### Search:
data/filmaffinity.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'filmaffinity'
3
- s.version = '0.0.4'
3
+ s.version = '0.1.0'
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"
@@ -80,5 +80,9 @@ module FilmAffinity
80
80
  raw_rating = document_html.at('div[itemprop="ratingValue"]').content.strip
81
81
  raw_rating.gsub(",",".").to_f
82
82
  end
83
+
84
+ def poster
85
+ poster_url = document_html.at('img[itemprop="image"]')["src"]
86
+ end
83
87
  end
84
88
  end
@@ -1,5 +1,3 @@
1
- require "cgi"
2
-
3
1
  module FilmAffinity
4
2
  class Search
5
3
  def initialize query
@@ -1,5 +1,3 @@
1
- require "cgi"
2
-
3
1
  module FilmAffinity
4
2
  class Top
5
3
  def initialize options = nil
@@ -100,4 +100,15 @@ describe "FilmAffinity::Movie" do
100
100
  end
101
101
  end
102
102
 
103
+
104
+ describe "#poster" do
105
+ subject(:movie) { FilmAffinity::Movie.new(504889, "El show de Truman (Una vida en directo)") }
106
+ it "should return a String" do
107
+ expect(movie.poster).to be_a(String)
108
+ end
109
+ it "should return the correct img url" do
110
+ expect(movie.poster).to eq("http://pics.filmaffinity.com/El_show_de_Truman_Una_vida_en_directo-130091557-main.jpg")
111
+ end
112
+ end
113
+
103
114
  end
@@ -3,7 +3,7 @@ require_relative "../spec_helper"
3
3
  describe "FilmAffinity::Top" do
4
4
 
5
5
  describe "#create_document_html" do
6
- subject(:top) { FilmAffinity::Search.new("truman") }
6
+ subject(:top) { FilmAffinity::Top.new }
7
7
 
8
8
  it "#create_document_html" do
9
9
  document_html = top.document_html
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.0.4
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Santos, Oriol Bellido