Skip to content

Commit

Permalink
Merge pull request #14 from LARailsLearners/features#2
Browse files Browse the repository at this point in the history
Features#2, gets IMDB id from routes and makes GET request to OMDB to retrieve movie title
  • Loading branch information
kangkyu authored Feb 3, 2018
2 parents 6df76de + c3f95ff commit 235b8e3
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
source "https://rubygems.org"

gem 'dotenv', groups: [:development, :test]
gem 'sinatra'
gem 'httparty'
gem 'pry-byebug'
36 changes: 36 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
GEM
remote: https://rubygems.org/
specs:
byebug (9.0.5)
coderay (1.1.1)
httparty (0.14.0)
multi_xml (>= 0.5.2)
method_source (0.8.2)
multi_xml (0.5.5)
pry (0.10.3)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
pry-byebug (3.4.0)
byebug (~> 9.0)
pry (~> 0.10)
rack (1.6.4)
rack-protection (1.5.3)
rack
sinatra (1.4.7)
rack (~> 1.5)
rack-protection (~> 1.4)
tilt (>= 1.3, < 3)
slop (3.6.0)
tilt (2.0.5)

PLATFORMS
ruby

DEPENDENCIES
httparty
pry-byebug
sinatra

BUNDLED WITH
1.11.2
7 changes: 7 additions & 0 deletions box-office.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
require 'sinatra'
require 'httparty'

require 'dotenv'
Dotenv.load

get '/' do
'Hello world!'
end

get '/movies/:imdbid' do |id|
response = HTTParty.get("http://www.omdbapi.com/?apikey=#{ENV['OMDB_API_KEY']}&i=#{id}&plot=full&r=json")
title = response['Title']
title
end

0 comments on commit 235b8e3

Please sign in to comment.