-
Notifications
You must be signed in to change notification settings - Fork 2
Numbers: random numbers facts #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
base: master
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,5 @@ | |
module Tlaws | ||
# Your code goes here... | ||
end | ||
|
||
require_relative 'tlaws/numbers' | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
require 'tlaw' | ||
|
||
|
||
module Tlaws | ||
class Numbers < TLAW::API | ||
define do | ||
desc %Q{ | ||
Wrapper for [Numbers API](http://numbersapi.com). Facts about numbers. | ||
} | ||
|
||
docs 'http://numbersapi.com' | ||
|
||
base 'http://numbersapi.com' | ||
|
||
namespace :[], '/{numb}' do | ||
desc %Q{ | ||
Facts about numbers. | ||
} | ||
|
||
param :numb, required: true | ||
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. Let's keep it 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. fix it |
||
|
||
endpoint :math, '/math?json' do | ||
desc %Q{ | ||
Get an interesting mathematical fact about the number. | ||
|
||
NB: | ||
} | ||
end | ||
end | ||
|
||
namespace :random do | ||
desc %Q{ | ||
Facts about random numbers. | ||
} | ||
endpoint :math, '/math?json' do | ||
desc %Q{ | ||
Get an interesting mathematical fact about the random number. | ||
} | ||
end | ||
endpoint :year, '/year?json' do | ||
desc %Q{ | ||
Get an interesting fact about the random year. | ||
} | ||
end | ||
endpoint :date, '/date?json' do | ||
desc %Q{ | ||
Get an interesting fact about the date number. | ||
} | ||
end | ||
endpoint :trivia, '/trivia?json' do | ||
desc %Q{ | ||
Get an interesting fact about the random number. | ||
} | ||
end | ||
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. I believe the same endpoints repeats for one number ( 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. ok, got it |
||
|
||
end | ||
|
||
end | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,12 +6,12 @@ require "tlaws/version" | |
Gem::Specification.new do |spec| | ||
spec.name = "tlaws" | ||
spec.version = Tlaws::VERSION | ||
spec.authors = ["TODO: Write your name"] | ||
spec.email = ["TODO: Write your email address"] | ||
spec.authors = ["Yuri Valigursky"] | ||
spec.email = ["[email protected]"] | ||
|
||
spec.summary = %q{TODO: Write a short summary, because Rubygems requires one.} | ||
spec.description = %q{TODO: Write a longer description or delete this line.} | ||
spec.homepage = "TODO: Put your gem's website or public repo URL here." | ||
spec.summary = %q{A repository for TLAW-based thin API wrappers, for all the world} | ||
spec.description = %q{A repository for TLAW-based thin API wrappers, for all the world} | ||
spec.homepage = "https://github.com/molybdenum-99/tlaws" | ||
spec.license = "MIT" | ||
|
||
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host' | ||
|
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 don't think we should require them all here. Imagine some of the wrappers depend on other libraries (like nokogiri, or some geo-services, or even SQL databases) — we don't want all of it to be required at once. Typical use case is "I install entire Tlaws (say, 30 wrappers), but use only wrappers X and Y, so I require only them".