-
Notifications
You must be signed in to change notification settings - Fork 1
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
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. title = response['Title']
title can be response["Title"] |
||
end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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)