filmaffinity 0.3.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/.rubocop_todo.yml +11 -190
- data/Gemfile +1 -1
- data/README.md +42 -44
- data/filmaffinity.gemspec +5 -5
- data/lib/constants/constants.rb +2 -2
- data/lib/filmaffinity.rb +11 -11
- data/lib/filmaffinity/configuration.rb +1 -1
- data/lib/filmaffinity/json-movie-parser.rb +10 -10
- data/lib/filmaffinity/json-movies-parser.rb +2 -2
- data/lib/filmaffinity/movie.rb +47 -17
- data/lib/filmaffinity/poster-manager.rb +4 -4
- data/lib/filmaffinity/search.rb +6 -5
- data/lib/filmaffinity/top.rb +7 -6
- data/spec/filmaffinity/json-movie-parser_spec.rb +7 -6
- data/spec/filmaffinity/matchers/include-movie.rb +1 -1
- data/spec/filmaffinity/movie_spec.rb +155 -119
- data/spec/filmaffinity/search_spec.rb +17 -17
- data/spec/filmaffinity/top_spec.rb +30 -31
- data/spec/spec_helper.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c232bbeb3fd4824e04e3c9388dc54a02c40dc075
|
4
|
+
data.tar.gz: 301a948520b891e16758f277c785c793b80a4c08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8403c435c1b3426ad6f088b25a550dfbe46cb18f1c42a3c9ea4f18cd90d00cc31f855dc39ca1d0ead0e66a9790629e0854492b336f3cba98b388eb222548e3b9
|
7
|
+
data.tar.gz: 55ffa273246c0a3f6b7c19ba0bffb9bf2313f821693da0c93b46f28e976721639dbe7eb986758832f880910781f5f52573cbdb25242527ea40d88e6a440e5950
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -1,27 +1,17 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2016-04-
|
3
|
+
# on 2016-04-20 13:45:56 +0200 using RuboCop version 0.39.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
-
# Offense count: 2
|
10
|
-
# Cop supports --auto-correct.
|
11
|
-
# Configuration parameters: AlignWith, SupportedStyles.
|
12
|
-
# SupportedStyles: either, start_of_block, start_of_line
|
13
|
-
Lint/BlockAlignment:
|
14
|
-
Exclude:
|
15
|
-
|
16
|
-
|
17
9
|
# Offense count: 1
|
18
|
-
#
|
19
|
-
|
20
|
-
|
21
|
-
Exclude:
|
22
|
-
# - 'lib/filmaffinity/top.rb'
|
10
|
+
# Configuration parameters: CountComments.
|
11
|
+
Metrics/ClassLength:
|
12
|
+
Max: 107
|
23
13
|
|
24
|
-
# Offense count:
|
14
|
+
# Offense count: 34
|
25
15
|
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
|
26
16
|
# URISchemes: http, https
|
27
17
|
Metrics/LineLength:
|
@@ -32,196 +22,27 @@ Metrics/LineLength:
|
|
32
22
|
Metrics/MethodLength:
|
33
23
|
Max: 50
|
34
24
|
|
35
|
-
# Offense count: 1
|
36
|
-
# Cop supports --auto-correct.
|
37
|
-
Performance/StringReplacement:
|
38
|
-
Exclude:
|
39
|
-
# - 'lib/filmaffinity/movie.rb'
|
40
|
-
|
41
|
-
# Offense count: 8
|
42
|
-
# Cop supports --auto-correct.
|
43
|
-
# Configuration parameters: EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle, SupportedLastArgumentHashStyles.
|
44
|
-
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
|
45
|
-
Style/AlignHash:
|
46
|
-
Exclude:
|
47
|
-
|
48
|
-
|
49
|
-
# Offense count: 1
|
50
|
-
# Cop supports --auto-correct.
|
51
|
-
# Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, FunctionalMethods, IgnoredMethods.
|
52
|
-
# SupportedStyles: line_count_based, semantic, braces_for_chaining
|
53
|
-
# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
|
54
|
-
# FunctionalMethods: let, let!, subject, watch
|
55
|
-
# IgnoredMethods: lambda, proc, it
|
56
|
-
Style/BlockDelimiters:
|
57
|
-
Exclude:
|
58
|
-
|
59
|
-
|
60
25
|
# Offense count: 9
|
61
26
|
Style/Documentation:
|
62
27
|
Exclude:
|
63
28
|
- 'spec/**/*'
|
64
29
|
- 'test/**/*'
|
65
|
-
- 'lib/constants/constants.rb'
|
66
|
-
- 'lib/filmaffinity.rb'
|
67
|
-
- 'lib/filmaffinity/configuration.rb'
|
68
|
-
- 'lib/filmaffinity/json-movie-parser.rb'
|
69
|
-
- 'lib/filmaffinity/json-movies-parser.rb'
|
70
|
-
- 'lib/filmaffinity/movie.rb'
|
71
|
-
- 'lib/filmaffinity/poster-manager.rb'
|
72
|
-
- 'lib/filmaffinity/search.rb'
|
73
|
-
- 'lib/filmaffinity/top.rb'
|
74
|
-
|
75
|
-
# Offense count: 2
|
76
|
-
# Cop supports --auto-correct.
|
77
|
-
# Configuration parameters: AllowAdjacentOneLineDefs.
|
78
|
-
Style/EmptyLineBetweenDefs:
|
79
|
-
Exclude:
|
30
|
+
# - 'lib/constants/constants.rb'
|
31
|
+
# - 'lib/filmaffinity.rb'
|
32
|
+
# - 'lib/filmaffinity/configuration.rb'
|
80
33
|
# - 'lib/filmaffinity/json-movie-parser.rb'
|
81
34
|
# - 'lib/filmaffinity/json-movies-parser.rb'
|
82
|
-
|
83
|
-
#
|
84
|
-
#
|
85
|
-
Style/EmptyLines:
|
86
|
-
Exclude:
|
87
|
-
|
88
|
-
|
89
|
-
# Offense count: 13
|
90
|
-
# Cop supports --auto-correct.
|
91
|
-
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
92
|
-
# SupportedStyles: empty_lines, no_empty_lines
|
93
|
-
Style/EmptyLinesAroundBlockBody:
|
94
|
-
Exclude:
|
95
|
-
|
96
|
-
|
97
|
-
# Offense count: 5
|
98
|
-
# Cop supports --auto-correct.
|
99
|
-
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
100
|
-
# SupportedStyles: empty_lines, no_empty_lines
|
101
|
-
Style/EmptyLinesAroundClassBody:
|
102
|
-
Exclude:
|
103
|
-
|
104
|
-
|
105
|
-
# Offense count: 2
|
106
|
-
# Cop supports --auto-correct.
|
107
|
-
Style/EmptyLinesAroundMethodBody:
|
108
|
-
Exclude:
|
109
|
-
|
110
|
-
# Offense count: 2
|
111
|
-
# Cop supports --auto-correct.
|
112
|
-
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
113
|
-
# SupportedStyles: empty_lines, no_empty_lines
|
114
|
-
Style/EmptyLinesAroundModuleBody:
|
115
|
-
Exclude:
|
116
|
-
|
117
|
-
# Offense count: 1
|
118
|
-
# Cop supports --auto-correct.
|
119
|
-
Style/EmptyLiteral:
|
120
|
-
Exclude:
|
121
|
-
|
35
|
+
# - 'lib/filmaffinity/movie.rb'
|
36
|
+
# - 'lib/filmaffinity/poster-manager.rb'
|
37
|
+
# - 'lib/filmaffinity/search.rb'
|
122
38
|
|
123
39
|
# Offense count: 6
|
124
40
|
# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts.
|
125
41
|
Style/FileName:
|
126
42
|
Exclude:
|
127
|
-
#CAREFUL FileName Bug!
|
128
43
|
- 'lib/filmaffinity/json-movie-parser.rb'
|
129
44
|
- 'lib/filmaffinity/json-movies-parser.rb'
|
130
45
|
- 'lib/filmaffinity/poster-manager.rb'
|
131
46
|
- 'spec/filmaffinity/json-movie-parser_spec.rb'
|
132
47
|
- 'spec/filmaffinity/json-movies-parser_spec.rb'
|
133
48
|
- 'spec/filmaffinity/matchers/include-movie.rb'
|
134
|
-
|
135
|
-
# Offense count: 59
|
136
|
-
# Cop supports --auto-correct.
|
137
|
-
# Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues.
|
138
|
-
# SupportedStyles: ruby19, ruby19_no_mixed_keys, hash_rockets
|
139
|
-
Style/HashSyntax:
|
140
|
-
Enabled: enable
|
141
|
-
|
142
|
-
# Offense count: 3
|
143
|
-
# Cop supports --auto-correct.
|
144
|
-
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
145
|
-
# SupportedStyles: normal, rails
|
146
|
-
Style/IndentationConsistency:
|
147
|
-
Exclude:
|
148
|
-
# - 'lib/filmaffinity/top.rb'
|
149
|
-
# - 'spec/filmaffinity/movie_spec.rb'
|
150
|
-
|
151
|
-
# Offense count: 1
|
152
|
-
# Cop supports --auto-correct.
|
153
|
-
Style/LeadingCommentSpace:
|
154
|
-
Exclude:
|
155
|
-
# - 'spec/filmaffinity/search_spec.rb'
|
156
|
-
|
157
|
-
# Offense count: 11
|
158
|
-
# Cop supports --auto-correct.
|
159
|
-
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
160
|
-
# SupportedStyles: require_parentheses, require_no_parentheses, require_no_parentheses_except_multiline
|
161
|
-
Style/MethodDefParentheses:
|
162
|
-
Enabled: true
|
163
|
-
|
164
|
-
# Offense count: 29
|
165
|
-
# Cop supports --auto-correct.
|
166
|
-
Style/NumericLiterals:
|
167
|
-
Enabled: true
|
168
|
-
|
169
|
-
# Offense count: 3
|
170
|
-
# Cop supports --auto-correct.
|
171
|
-
Style/RedundantParentheses:
|
172
|
-
Exclude:
|
173
|
-
|
174
|
-
|
175
|
-
# Offense count: 6
|
176
|
-
# Cop supports --auto-correct.
|
177
|
-
Style/RedundantSelf:
|
178
|
-
Exclude:
|
179
|
-
|
180
|
-
|
181
|
-
# Offense count: 4
|
182
|
-
# Cop supports --auto-correct.
|
183
|
-
Style/SpaceAfterColon:
|
184
|
-
Exclude:
|
185
|
-
|
186
|
-
|
187
|
-
# Offense count: 9
|
188
|
-
# Cop supports --auto-correct.
|
189
|
-
Style/SpaceAfterComma:
|
190
|
-
Exclude:
|
191
|
-
|
192
|
-
|
193
|
-
# Offense count: 1
|
194
|
-
# Cop supports --auto-correct.
|
195
|
-
# Configuration parameters: AllowForAlignment.
|
196
|
-
Style/SpaceAroundOperators:
|
197
|
-
Exclude:
|
198
|
-
|
199
|
-
|
200
|
-
# Offense count: 3
|
201
|
-
# Cop supports --auto-correct.
|
202
|
-
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles.
|
203
|
-
# SupportedStyles: space, no_space
|
204
|
-
Style/SpaceInsideHashLiteralBraces:
|
205
|
-
Enabled: false
|
206
|
-
|
207
|
-
# Offense count: 209
|
208
|
-
# Cop supports --auto-correct.
|
209
|
-
# Configuration parameters: EnforcedStyle, SupportedStyles, ConsistentQuotesInMultiline.
|
210
|
-
# SupportedStyles: single_quotes, double_quotes
|
211
|
-
Style/StringLiterals:
|
212
|
-
Enabled: false
|
213
|
-
|
214
|
-
# Offense count: 1
|
215
|
-
# Cop supports --auto-correct.
|
216
|
-
# Configuration parameters: EnforcedStyleForMultiline, SupportedStyles.
|
217
|
-
# SupportedStyles: comma, consistent_comma, no_comma
|
218
|
-
Style/TrailingCommaInLiteral:
|
219
|
-
Exclude:
|
220
|
-
- 'lib/constants/constants.rb'
|
221
|
-
|
222
|
-
# Offense count: 2
|
223
|
-
# Cop supports --auto-correct.
|
224
|
-
# Configuration parameters: SupportedStyles, MinSize, WordRegex.
|
225
|
-
# SupportedStyles: percent, brackets
|
226
|
-
Style/WordArray:
|
227
|
-
EnforcedStyle: brackets
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -3,13 +3,13 @@
|
|
3
3
|
|
4
4
|
## Description
|
5
5
|
|
6
|
-
The filmaffinity gem allows you to
|
6
|
+
The filmaffinity gem allows you to easily access publicly available data from **Filmaffinity.com in english and spanish**.
|
7
7
|
|
8
|
-
|
8
|
+
It is also available as **RESTful API** at [heroku](https://filmaffinity-unofficial.herokuapp.com/).
|
9
9
|
|
10
10
|
## Features
|
11
11
|
|
12
|
-
- Search movies
|
12
|
+
- Search movies by title
|
13
13
|
- Retrieve complete movie info
|
14
14
|
- Retrieve the Top N of filmaffinity.com
|
15
15
|
- Retrieve the Top N with the given options
|
@@ -22,7 +22,7 @@ Add this line to your application's Gemfile:
|
|
22
22
|
|
23
23
|
And then execute:
|
24
24
|
|
25
|
-
$ bundle
|
25
|
+
$ bundle install
|
26
26
|
|
27
27
|
Or install it yourself as:
|
28
28
|
|
@@ -31,26 +31,26 @@ Or install it yourself as:
|
|
31
31
|
## Documentation
|
32
32
|
|
33
33
|
##### FilmAffinity configuration
|
34
|
-
FilmAffinity
|
34
|
+
FilmAffinity offers some configuration options, which you can configure globally before your requests. You could include an ```imgur_id``` to upload the posters on Imgur and avoid forbidden hotlinking from filmaffinity. You can also change the ```language```,which is english by default.
|
35
35
|
```
|
36
36
|
FilmAffinity.configure do |config|
|
37
|
-
config.imgur_id =
|
38
|
-
config.language =
|
37
|
+
config.imgur_id = 'Your-imgur-client-id'
|
38
|
+
config.language = 'ES'
|
39
39
|
end
|
40
40
|
```
|
41
41
|
|
42
42
|
##### FilmAffinity::Search
|
43
|
-
|
43
|
+
Returns an array of FilmAffinity::Movie, containing preload ID and title.
|
44
44
|
|
45
45
|
##### FilmAffinity::Movie
|
46
|
-
|
46
|
+
Includes some methods to retrieve the complete movie info.
|
47
47
|
|
48
48
|
##### FilmAffinity::Top options
|
49
|
-
The options hash
|
49
|
+
The options hash accepts several parameters:
|
50
50
|
```
|
51
51
|
{
|
52
|
-
:genre =>
|
53
|
-
:country =>
|
52
|
+
:genre => 'AC',
|
53
|
+
:country => 'DE',
|
54
54
|
:from_year => 2014,
|
55
55
|
:to_year => 2016,
|
56
56
|
:no_doc => true,
|
@@ -58,25 +58,25 @@ The options hash could include:
|
|
58
58
|
}
|
59
59
|
```
|
60
60
|
##### :genre
|
61
|
-
-
|
62
|
-
-
|
63
|
-
-
|
64
|
-
-
|
65
|
-
-
|
66
|
-
-
|
67
|
-
-
|
68
|
-
-
|
69
|
-
-
|
70
|
-
-
|
71
|
-
-
|
72
|
-
-
|
73
|
-
-
|
74
|
-
-
|
75
|
-
-
|
76
|
-
-
|
77
|
-
-
|
78
|
-
-
|
79
|
-
-
|
61
|
+
- 'AC' Action
|
62
|
+
- 'AV' Adventure
|
63
|
+
- 'AN' Animation
|
64
|
+
- 'CO' Comedy
|
65
|
+
- 'DO' Documentary
|
66
|
+
- 'DR' Drama
|
67
|
+
- 'FAN' Fantasy
|
68
|
+
- 'F-N' Film-Noir
|
69
|
+
- 'TE' Horror
|
70
|
+
- 'INF' Kids
|
71
|
+
- 'MU' Musical
|
72
|
+
- 'INT' Mystery
|
73
|
+
- 'RO' Romance
|
74
|
+
- 'C-F' Sci-Fi
|
75
|
+
- 'TH' Thriller
|
76
|
+
- 'TV_SE' TV Series
|
77
|
+
- 'DESC' Unknown
|
78
|
+
- 'BE' War
|
79
|
+
- 'WE' Western
|
80
80
|
|
81
81
|
##### :country
|
82
82
|
2-letter code supplied by the ISO
|
@@ -103,12 +103,12 @@ The options hash could include:
|
|
103
103
|
top.movies.first
|
104
104
|
#=> #<FilmAffinity::Movie>
|
105
105
|
|
106
|
-
#Top FilmAffinity with options
|
106
|
+
#Top FilmAffinity with options and number of results
|
107
107
|
options = {
|
108
|
-
:genre =>
|
108
|
+
:genre => 'AN',
|
109
109
|
:no_tv => true
|
110
110
|
}
|
111
|
-
top = FilmAffinity::Top.new options
|
111
|
+
top = FilmAffinity::Top.new options, 20
|
112
112
|
|
113
113
|
top.movies
|
114
114
|
#=> [<FilmAffinity::Movie>
|
@@ -121,7 +121,7 @@ The options hash could include:
|
|
121
121
|
|
122
122
|
### Search:
|
123
123
|
|
124
|
-
search = FilmAffinity::Search.new(
|
124
|
+
search = FilmAffinity::Search.new('Padrino')
|
125
125
|
|
126
126
|
search.movies
|
127
127
|
#=> [<FilmAffinity::Movie>
|
@@ -134,10 +134,10 @@ The options hash could include:
|
|
134
134
|
|
135
135
|
### Movie:
|
136
136
|
|
137
|
-
movie = FilmAffinity::Movie.new(809297,
|
137
|
+
movie = FilmAffinity::Movie.new(809297, 'El Padrino')
|
138
138
|
|
139
139
|
movie.director
|
140
|
-
#=>
|
140
|
+
#=> 'Francis Ford Coppola'
|
141
141
|
|
142
142
|
movie.year
|
143
143
|
#=> 1972
|
@@ -146,15 +146,13 @@ The options hash could include:
|
|
146
146
|
#=> 9.1
|
147
147
|
|
148
148
|
movie.cast
|
149
|
-
#=> [
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
149
|
+
#=> ['Marlon Brando',
|
150
|
+
'Al Pacino',
|
151
|
+
'James Caan',
|
152
|
+
'Robert Duvall',
|
153
|
+
'Diane Keaton',
|
154
154
|
...]
|
155
155
|
|
156
|
-
movie.genres, movie.country, movie.sinopsis...
|
157
|
-
|
158
156
|
## Contributors
|
159
157
|
|
160
158
|
This gem is created and maintained by [Oriol Bellido](https://github.com/oricodes89) and [David Santos](https://github.com/davidsantosmerino)
|
data/filmaffinity.gemspec
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'filmaffinity'
|
3
|
-
s.version = '0.
|
4
|
-
s.date = '2016-04-
|
5
|
-
s.summary =
|
6
|
-
s.description =
|
7
|
-
s.authors = [
|
3
|
+
s.version = '1.0.0'
|
4
|
+
s.date = '2016-04-26'
|
5
|
+
s.summary = 'filmaffinity'
|
6
|
+
s.description = 'Easily use Ruby or the command line to find information on Filmaffinity.com'
|
7
|
+
s.authors = ['David Santos', 'Oriol Bellido']
|
8
8
|
s.email = 'dsantosmerino92@gmail.com'
|
9
9
|
s.files = `git ls-files`.split("\n")
|
10
10
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
data/lib/constants/constants.rb
CHANGED
@@ -6,7 +6,7 @@ module Constants
|
|
6
6
|
from_year: 'fromyear=%i&',
|
7
7
|
to_year: 'toyear=%i&',
|
8
8
|
no_doc: 'nodoc&',
|
9
|
-
no_tv: 'notvse&'
|
9
|
+
no_tv: 'notvse&'
|
10
10
|
}
|
11
11
|
end
|
12
12
|
|
@@ -42,7 +42,7 @@ module Constants
|
|
42
42
|
},
|
43
43
|
|
44
44
|
music: { EN: 'dt:contains("Music")',
|
45
|
-
ES: 'dt:contains("
|
45
|
+
ES: 'dt:contains("Music")'
|
46
46
|
},
|
47
47
|
|
48
48
|
company: { EN: 'dt:contains("Producer")',
|