Class: JsonMovieParser

Inherits:
Object
  • Object
show all
Defined in:
lib/filmaffinity/json-movie-parser.rb

Instance Method Summary collapse

Instance Method Details

#to_hash(movie) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/filmaffinity/json-movie-parser.rb', line 4

def to_hash(movie)
  {
    'title' => movie.title,
    'rating' => movie.rating,
    'director' => movie.director,
    'year' => movie.year,
    'duration' => movie.duration,
    'country' => movie.country,
    'script' => movie.script,
    'cast' => movie.cast,
    'sinopsis' => movie.sinopsis,
    'poster_big' => movie.poster_big
  }
end

#to_json(movie) ⇒ Object



19
20
21
22
# File 'lib/filmaffinity/json-movie-parser.rb', line 19

def to_json(movie)
  hash = to_hash movie
  hash.to_json
end