Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Features#2, gets IMDB id from routes and makes GET request to OMDB to retrieve movie title #14

Merged
merged 1 commit into from
Feb 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably not good, if we're using dotenv this will most likely change. And also @server-monitor brought up that we should extract all client calls as a separate interface and require it in box-office.

Copy link

@server-monitor server-monitor Aug 18, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if we need to add another route just yet. The Hello world route is OK. But if we do TDD, we need to add a test framework first (1 PR), then add the test for the new route and add the route (could be 2 or 1 PRs? I don't know.). If we're not going to do TDD, it could be chaotic but also fun.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's keep it for this PR, we can change it later when we need. It doesn't hurt DRY not just yet (because even if you extract code, you would use the code only once)

title = response['Title']
title
Copy link
Member

@kangkyu kangkyu Aug 25, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

title = response['Title']
title

can be

response["Title"]

end