From d300bddae521f03559555afd0d98166063457087 Mon Sep 17 00:00:00 2001 From: sanipym Date: Tue, 1 Dec 2015 19:33:35 +0530 Subject: [PATCH 1/4] Adding film.rb --- batch-1/movie-info/sanish/film.rb | 1 + 1 file changed, 1 insertion(+) create mode 100644 batch-1/movie-info/sanish/film.rb diff --git a/batch-1/movie-info/sanish/film.rb b/batch-1/movie-info/sanish/film.rb new file mode 100644 index 0000000..6f06b14 --- /dev/null +++ b/batch-1/movie-info/sanish/film.rb @@ -0,0 +1 @@ +puts "hell welcome" From 88f63d592bbdd5edc09abbd5bfb441e6f7303cad Mon Sep 17 00:00:00 2001 From: sanipym Date: Sat, 12 Dec 2015 13:26:47 +0530 Subject: [PATCH 2/4] Lucy.html file created --- batch-1/movie-info/sanish/Lucy.html | 83 +++++++++++++++++++++++++++++ batch-1/movie-info/sanish/film.rb | 1 - 2 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 batch-1/movie-info/sanish/Lucy.html delete mode 100644 batch-1/movie-info/sanish/film.rb diff --git a/batch-1/movie-info/sanish/Lucy.html b/batch-1/movie-info/sanish/Lucy.html new file mode 100644 index 0000000..8043580 --- /dev/null +++ b/batch-1/movie-info/sanish/Lucy.html @@ -0,0 +1,83 @@ + + + + Lucy + + + + + +
+
+

Lucy

+
+ +
+
+ +
+ +
+

A woman, accidentally caught in a dark deal, turns the tables on her captors and transforms into a merciless warrior evolved beyond human logic.

+ +
+
AUTHOR
+

Luc Besson

+
+ +
+
YEAR
+

2014

+
+
+
+
+ + + diff --git a/batch-1/movie-info/sanish/film.rb b/batch-1/movie-info/sanish/film.rb deleted file mode 100644 index 6f06b14..0000000 --- a/batch-1/movie-info/sanish/film.rb +++ /dev/null @@ -1 +0,0 @@ -puts "hell welcome" From 1ff27a98ad36f6f4401f228a0dcf62604f125bf7 Mon Sep 17 00:00:00 2001 From: sanipym Date: Sat, 12 Dec 2015 13:35:15 +0530 Subject: [PATCH 3/4] Add the ruby code for collecting data from url --- batch-1/movie-info/sanish/movie_ruby.rb | 30 +++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 batch-1/movie-info/sanish/movie_ruby.rb diff --git a/batch-1/movie-info/sanish/movie_ruby.rb b/batch-1/movie-info/sanish/movie_ruby.rb new file mode 100644 index 0000000..604e40a --- /dev/null +++ b/batch-1/movie-info/sanish/movie_ruby.rb @@ -0,0 +1,30 @@ +require 'open-uri' +require 'json' + +class MovieDataGenerator + + def initialize(movie_name) + @movie_tilte = "http://www.omdbapi.com/?t=#{movie_name}&y=&plot=short&r=json" + end + + def read_movie + api_data=open(@movie_tilte).read + m_info=JSON.parse(api_data) + temp_html=File.read('template.html') + temp_html.gsub!('{{Poster}}',m_info['Poster']) + temp_html.gsub!('{{Title}}',m_info['Title']) + temp_html.gsub!('{{Plot}}',m_info['Plot']) + temp_html.gsub!('{{Director}}',m_info['Director']) + temp_html.gsub!('{{Year}}',m_info['Year']) + + write_html(temp_html) + end + + def write_html(template) + File.write("Lucy.html",template) + end + +end + +MovieDataGenerator.new('Lucy').read_movie + From 2f6f12cc16f012f5f65f7bbcd93bde0816dc7e27 Mon Sep 17 00:00:00 2001 From: sanipym Date: Sat, 12 Dec 2015 13:37:20 +0530 Subject: [PATCH 4/4] Adding template for the webpage --- batch-1/movie-info/sanish/template.html | 83 +++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 batch-1/movie-info/sanish/template.html diff --git a/batch-1/movie-info/sanish/template.html b/batch-1/movie-info/sanish/template.html new file mode 100644 index 0000000..b412ab7 --- /dev/null +++ b/batch-1/movie-info/sanish/template.html @@ -0,0 +1,83 @@ + + + + {{Title}} + + + + + +
+
+

{{Title}}

+
+ +
+
+ +
+ +
+

{{Plot}}

+ +
+
AUTHOR
+

{{Director}}

+
+ +
+
YEAR
+

{{Year}}

+
+
+
+
+ + +