royw-imdb 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- data/README +4 -2
- data/lib/imdb/imdb_movie.rb +20 -0
- metadata +1 -1
data/README
CHANGED
@@ -20,6 +20,8 @@ ImdbMovie Indiana Jones and the Last Crusade
|
|
20
20
|
- should get some photos
|
21
21
|
- should get the tagline
|
22
22
|
- should get the aspect ratio
|
23
|
+
- should convert to xml
|
24
|
+
- should convert to yaml
|
23
25
|
|
24
26
|
ImdbMovie Han robado una estrella
|
25
27
|
- should query IMDB url
|
@@ -82,6 +84,6 @@ String unescape_html
|
|
82
84
|
String strip_tags
|
83
85
|
- should strip HTML tags
|
84
86
|
|
85
|
-
Finished in 3.
|
87
|
+
Finished in 3.464305 seconds
|
86
88
|
|
87
|
-
|
89
|
+
61 examples, 0 failures
|
data/lib/imdb/imdb_movie.rb
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'xmlsimple'
|
3
|
+
|
1
4
|
class ImdbMovie
|
2
5
|
include Comparable
|
3
6
|
|
@@ -168,6 +171,23 @@ class ImdbMovie
|
|
168
171
|
cert_hash
|
169
172
|
end
|
170
173
|
|
174
|
+
def to_hash
|
175
|
+
hash = {}
|
176
|
+
[:title, :directors, :poster_url, :tiny_poster_url, :poster, :rating, :cast_members,
|
177
|
+
:writers, :year, :genres, :plot, :tagline, :aspect_ratio, :length, :release_date,
|
178
|
+
:countries, :languages, :color, :company, :photos, :raw_title, :release_year,
|
179
|
+
:also_known_as, :mpaa, :certifications].each {|sym| hash[sym.to_s] = send(sym.to_s)}
|
180
|
+
hash
|
181
|
+
end
|
182
|
+
|
183
|
+
def to_xml
|
184
|
+
XmlSimple.xml_out(to_hash, 'NoAttr' => true, 'RootName' => 'movie')
|
185
|
+
end
|
186
|
+
|
187
|
+
def to_yaml
|
188
|
+
YAML.dump(to_hash)
|
189
|
+
end
|
190
|
+
|
171
191
|
private
|
172
192
|
|
173
193
|
# def update_title
|