fact_is_fact 0.3.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/CHANGELOG.md +10 -0
- data/Gemfile.lock +19 -19
- data/README.md +110 -6
- data/fact_is_fact.gemspec +16 -18
- data/lib/fact_is_fact.rb +14 -4
- data/lib/version.rb +1 -0
- metadata +22 -22
- data/lib/fact_is_fact/random.rb +0 -15
- data/lib/fact_is_fact/version.rb +0 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: e0669d6d8cc1793530b82447f4a2e1e897630cf30aa109fee1db3b851fcfb610
|
|
4
|
+
data.tar.gz: 700807423e7dc236871ab2e3eb70c72abe20cae79e7bb15d72e73b3180c01bb7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a57fbde7abf78ee497cc35f570f6061e07cc288ec1103529c957e15ae2531b2cb5728809db70dbc3c9aed97753c330ce5b06973e86b64bbaf5d0c1a01c0e6af2
|
|
7
|
+
data.tar.gz: aec7f4ffd41e7febd7908b5d3c8a9d23fbca1660b770e4a8d90287a46652e197a9bbd5a1963e110096896bc5d7e6402cbab24b05a5c516d6a4dcd733489a2e14
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
## Version 1.2.1
|
|
2
|
+
Documentation for batch request
|
|
3
|
+
|
|
4
|
+
## Version 1.1.0
|
|
5
|
+
Ability to pass optional params with the request
|
|
6
|
+
|
|
7
|
+
## Version 1.0.0
|
|
8
|
+
Deprecating the old way of calling the class method. With this version, you will be able to get trivia, math, year and date facts about the any number of a day.
|
|
9
|
+
|
|
10
|
+
## Version 0.31.1
|
data/Gemfile.lock
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
fact_is_fact (
|
|
4
|
+
fact_is_fact (1.2.1)
|
|
5
5
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: https://rubygems.org/
|
|
8
8
|
specs:
|
|
9
|
-
diff-lcs (1.
|
|
10
|
-
rake (
|
|
11
|
-
rspec (3.
|
|
12
|
-
rspec-core (~> 3.
|
|
13
|
-
rspec-expectations (~> 3.
|
|
14
|
-
rspec-mocks (~> 3.
|
|
15
|
-
rspec-core (3.
|
|
16
|
-
rspec-support (~> 3.
|
|
17
|
-
rspec-expectations (3.
|
|
9
|
+
diff-lcs (1.4.4)
|
|
10
|
+
rake (13.0.3)
|
|
11
|
+
rspec (3.10.0)
|
|
12
|
+
rspec-core (~> 3.10.0)
|
|
13
|
+
rspec-expectations (~> 3.10.0)
|
|
14
|
+
rspec-mocks (~> 3.10.0)
|
|
15
|
+
rspec-core (3.10.1)
|
|
16
|
+
rspec-support (~> 3.10.0)
|
|
17
|
+
rspec-expectations (3.10.1)
|
|
18
18
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
19
|
-
rspec-support (~> 3.
|
|
20
|
-
rspec-mocks (3.
|
|
19
|
+
rspec-support (~> 3.10.0)
|
|
20
|
+
rspec-mocks (3.10.2)
|
|
21
21
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
22
|
-
rspec-support (~> 3.
|
|
23
|
-
rspec-support (3.
|
|
22
|
+
rspec-support (~> 3.10.0)
|
|
23
|
+
rspec-support (3.10.2)
|
|
24
24
|
|
|
25
25
|
PLATFORMS
|
|
26
|
-
|
|
26
|
+
x86_64-darwin-19
|
|
27
27
|
|
|
28
28
|
DEPENDENCIES
|
|
29
|
-
bundler (
|
|
29
|
+
bundler (>= 2.2.17)
|
|
30
30
|
fact_is_fact!
|
|
31
|
-
rake (
|
|
32
|
-
rspec (
|
|
31
|
+
rake (= 13.0.3)
|
|
32
|
+
rspec (= 3.10.0)
|
|
33
33
|
|
|
34
34
|
BUNDLED WITH
|
|
35
|
-
|
|
35
|
+
2.2.19
|
data/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# FactIsFact
|
|
2
2
|
|
|
3
|
-
This gem returns a fact about any number provided. It is useful when you want
|
|
3
|
+
This gem returns a fact about any number provided. It is useful when you want
|
|
4
4
|
some random trivia or facts to be displayed about a number, on your website.
|
|
5
5
|
|
|
6
|
-
P.S: Gem internally uses
|
|
6
|
+
P.S: Gem internally uses http://numbersapi.com/ to return the results.
|
|
7
7
|
|
|
8
8
|
## Installation
|
|
9
9
|
|
|
@@ -22,12 +22,116 @@ Or install it yourself as:
|
|
|
22
22
|
$ gem install fact_is_fact
|
|
23
23
|
|
|
24
24
|
## Usage
|
|
25
|
-
|
|
25
|
+
* `type` is one of `trivia`, `math`, `date`, or `year`. Defaults to `trivia` if omitted.
|
|
26
|
+
* `number` is
|
|
27
|
+
* an `integer`, or
|
|
28
|
+
* the keyword `random`, for which we will try to return a random available fact, or
|
|
29
|
+
* a `day` of year in the form `month/day` (eg. 2/29, 1/09, 04/1), if `type` is `date`
|
|
30
|
+
|
|
31
|
+
basic examples
|
|
32
|
+
```ruby
|
|
33
|
+
# math fact
|
|
34
|
+
FactIsFact.return(type: 'math', number: '1234')
|
|
35
|
+
#=> "1234 is the smallest 4-digit number with increasing digits."
|
|
36
|
+
|
|
37
|
+
# date fact
|
|
38
|
+
FactIsFact.return(type: 'date', number: '2/29')
|
|
39
|
+
#=> "February 29th is the day in 1892 that St. Petersburg, Florida is incorporated."
|
|
40
|
+
|
|
41
|
+
# year fact
|
|
42
|
+
FactIsFact.return(type: 'year', number: '1234')
|
|
43
|
+
#=> "1234 is the year that the Manden region raises against the Kaniaga kingdom."
|
|
44
|
+
|
|
45
|
+
# trivia
|
|
46
|
+
FactIsFact.return(type: 'trivia', number: 'random')
|
|
47
|
+
#=> "150000000 is the number of items held in the British Library."
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Optional parameters
|
|
51
|
+
|
|
52
|
+
### Result in JSON format
|
|
53
|
+
Include the query parameter `json` or set the HTTP header `Content-Type` to `application/json` to return the fact and associated meta-data as a JSON object
|
|
54
|
+
|
|
55
|
+
```ruby
|
|
56
|
+
FactIsFact.return(type: 'math', number: '123', json: '')
|
|
57
|
+
#=> "{\n \"text\": \"123 is the 10^{th} Lucas number.\",\n \"number\": 123,\n \"found\": true,\n \"type\": \"math\"\n}"
|
|
58
|
+
|
|
59
|
+
FactIsFact.return(type: 'trivia', number: 'random', json: true)
|
|
60
|
+
#=> "{\n \"text\": \"88 is the number of keys on a piano (36 black and 52 white).\",\n \"number\": 88,\n \"found\": true,\n \"type\": \"trivia\"\n}"
|
|
61
|
+
|
|
62
|
+
FactIsFact.return(type: 'math', number: '12', json: nil)
|
|
63
|
+
#=> "{\n \"text\": \"12 is a superfactorial, being the product of the first three factorials.\",\n \"number\": 12,\n \"found\": true,\n \"type\": \"math\"\n}"
|
|
64
|
+
```
|
|
65
|
+
**Note**: you can pass any value to `json`, as long as the parameter is present, it does not matter what the value of the `json` parameter is.
|
|
66
|
+
|
|
67
|
+
### FRAGMENT
|
|
68
|
+
Return the fact as a sentence fragment that can be easily included as part of a larger sentence. This means that the first word is lowercase and ending punctuation is omitted. For trivia and math, a noun phrase is returned that can be used in a sentence like "We now have more users than [fact as fragment]!".
|
|
69
|
+
|
|
70
|
+
```ruby
|
|
71
|
+
FactIsFact.return(type: 'math', number: '13', fragment: '')
|
|
72
|
+
#=> "the number of Archimedian solids"
|
|
73
|
+
|
|
74
|
+
FactIsFact.return(type: 'math', number: '139', fragment: nil)
|
|
75
|
+
#=> "the number of unlabeled topologies with 5 elements"
|
|
76
|
+
|
|
77
|
+
FactIsFact.return(type: 'year', number: '1920', fragment: true)
|
|
78
|
+
#=> "the United States Congress refuses to ratify the Treaty of Versailles"
|
|
79
|
+
```
|
|
80
|
+
**Note**: you can pass any value to `fragment`, as long as the parameter is present, it does not matter what the value of the `fragment` parameter is.
|
|
81
|
+
|
|
82
|
+
### Not Found
|
|
83
|
+
The `notfound` field tells us what to do if the number is not found. You can give us
|
|
84
|
+
|
|
85
|
+
* `floor` to round down to the largest number that does have an associated fact, and return that fact.
|
|
86
|
+
```ruby
|
|
87
|
+
FactIsFact.return(type: 'math', number: '123123123', notfound: 'floor')
|
|
88
|
+
#=> "12988816 is the number of domino tilings of an 8\xC3\x978 checkerboard."
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
* `ceil`, which is like `floor` but rounds up to the smallest number that has an associated fact.
|
|
92
|
+
```ruby
|
|
93
|
+
FactIsFact.return(type: 'math', number: '123123123', notfound: 'ceil')
|
|
94
|
+
#=> "215000000 is the number of mathematical constants are collected on the Plouffe's Inverter as of 2010."
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Default message (if notfound)
|
|
98
|
+
|
|
99
|
+
* `default` to return one of our pre-written missing messages, or a message you supply with the default query field. This is the default behaviour.
|
|
100
|
+
|
|
101
|
+
```ruby
|
|
102
|
+
FactIsFact.return(type: 'math', number: '123123123', default: 'no facts found')
|
|
103
|
+
#=> "no facts found"
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### MIN AND MAX
|
|
107
|
+
Restrict the range of values returned to the inclusive range [min, max] when random is given as the number.
|
|
108
|
+
|
|
26
109
|
```ruby
|
|
27
|
-
FactIsFact
|
|
28
|
-
#=> "
|
|
110
|
+
FactIsFact.return(type: 'trivia', number: 'random', min: 10, max: 20)
|
|
111
|
+
#=> "16 is the number of personality types in the Myers-Briggs classification system."
|
|
29
112
|
```
|
|
30
113
|
|
|
114
|
+
### BATCH REQUESTS
|
|
115
|
+
To get facts about multiple numbers in one request, specify ranges for number.
|
|
116
|
+
|
|
117
|
+
A number range (inclusive) is specified as min..max. Separate multiple ranges and individual numbers with , (a comma).
|
|
118
|
+
|
|
119
|
+
The response format will always be a JSON map from numbers to facts, of at most 100 numbers. The query parameter json may still be used to specify whether individual facts will be returned as string literals or JSON objects.
|
|
120
|
+
|
|
121
|
+
```ruby
|
|
122
|
+
FactIsFact.return(type: 'math', number: '1..3', json: '')
|
|
123
|
+
=> "{\n \"1\": \"1 is the most common leading digit in many sets of data, a consequence of Benford's law.\",\n \"2\": \"2 is a primorial, as well as its own factorial.\",\n \"3\": \"3 is the fourth open meandric number.\"\n}"
|
|
124
|
+
|
|
125
|
+
FactIsFact.return(type: 'math', number: '1..3,10,13,15', json: '')
|
|
126
|
+
=> "{\n \"1\": \"1 is also the first and second numbers in the Fibonacci sequence and is the first number in many other mathematical sequences.\",\n \"2\": \"2 is the number of n-Queens Problem solutions for n = 4.\",\n \"3\": \"3 is the first unique prime due to the properties of its reciprocal.\",\n \"10\": \"10 is the aliquot sum of only one number the discrete semiprime 14.\",\n \"13\": \"13 is the number of Archimedian solids.\",\n \"15\": \"15 is a triangular number, a hexagonal number, a pentatope number and the 4th Bell number.\"\n}"
|
|
127
|
+
|
|
128
|
+
FactIsFact.return(type: 'year', number: '1..3,10,13,15', json: '')
|
|
129
|
+
=> "{\n \"1\": \"1 is the year that Emperor Ping of Han China begins his reign and Wang Mang is re-instated as regent by Grand Empress Dowager Wang.\",\n \"2\": \"2 is the year that Cedeides becomes Archon of Athens.\",\n \"3\": \"3 is the year that Augustus adopts his grandson, Gaius Caesar, with the expectation that he will succeed him.\",\n \"10\": \"10 is the year that Ovid completes Tristia (the \\\"Sorrows\\\", 5 books) and Epistulae ex Ponto (Letters from the Black Sea, 4 books) describing the sadness of banishment.\",\n \"13\": \"13 is the year that Strabo publishes his book on the shape of the Earth.\",\n \"15\": \"15 is the year that Germanicus captures Thusnelda, the wife of Arminius.\"\n}"
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
31
135
|
## Development
|
|
32
136
|
|
|
33
137
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
@@ -36,7 +140,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
|
36
140
|
|
|
37
141
|
## Contributing
|
|
38
142
|
|
|
39
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
|
143
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/abhinaykumar/fact_is_fact. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
|
40
144
|
|
|
41
145
|
## License
|
|
42
146
|
|
data/fact_is_fact.gemspec
CHANGED
|
@@ -1,27 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
-
require "fact_is_fact/version"
|
|
1
|
+
require './lib/fact_is_fact'
|
|
2
|
+
require './lib/version'
|
|
5
3
|
|
|
6
4
|
Gem::Specification.new do |spec|
|
|
7
|
-
spec.name =
|
|
8
|
-
spec.version =
|
|
9
|
-
spec.authors = [
|
|
10
|
-
spec.email = [
|
|
5
|
+
spec.name = 'fact_is_fact'
|
|
6
|
+
spec.version = VERSION
|
|
7
|
+
spec.authors = ['Abhinay']
|
|
8
|
+
spec.email = ['abhinay302@gmail.com']
|
|
11
9
|
|
|
12
|
-
spec.summary =
|
|
13
|
-
spec.description =
|
|
14
|
-
spec.homepage =
|
|
15
|
-
spec.license =
|
|
10
|
+
spec.summary = 'This gem allows users to get a random trivia about a number or date or a year'
|
|
11
|
+
spec.description = 'library helps you display random facts about a number or date or a year.'
|
|
12
|
+
spec.homepage = 'https://github.com/abhinaykumar/fact_is_fact'
|
|
13
|
+
spec.license = 'MIT'
|
|
16
14
|
|
|
17
15
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
|
18
16
|
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
|
19
17
|
if spec.respond_to?(:metadata)
|
|
20
18
|
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
|
21
19
|
|
|
22
|
-
spec.metadata[
|
|
23
|
-
spec.metadata[
|
|
24
|
-
spec.metadata[
|
|
20
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
|
21
|
+
spec.metadata['source_code_uri'] = 'https://github.com/abhinaykumar/fact_is_fact'
|
|
22
|
+
spec.metadata['changelog_uri'] = 'https://github.com/abhinaykumar/fact_is_fact/blob/master/CHANGELOG.md'
|
|
25
23
|
else
|
|
26
24
|
raise "RubyGems 2.0 or newer is required to protect against " \
|
|
27
25
|
"public gem pushes."
|
|
@@ -36,7 +34,7 @@ Gem::Specification.new do |spec|
|
|
|
36
34
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
37
35
|
spec.require_paths = ["lib"]
|
|
38
36
|
|
|
39
|
-
spec.add_development_dependency 'bundler', '
|
|
40
|
-
spec.add_development_dependency 'rake', '
|
|
41
|
-
spec.add_development_dependency 'rspec', '
|
|
37
|
+
spec.add_development_dependency 'bundler', '>= 2.2.17'
|
|
38
|
+
spec.add_development_dependency 'rake', '13.0.3'
|
|
39
|
+
spec.add_development_dependency 'rspec', '3.10.0'
|
|
42
40
|
end
|
data/lib/fact_is_fact.rb
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
|
-
require '
|
|
1
|
+
require 'net/http'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
class FactIsFact
|
|
4
|
+
BASE_URI = 'http://numbersapi.com'.freeze
|
|
5
|
+
TYPE = %w[trivia math year date].freeze
|
|
6
|
+
|
|
7
|
+
class << self
|
|
8
|
+
def return(type:, number:, **options)
|
|
9
|
+
return 'not a valid type' unless TYPE.include?(type)
|
|
10
|
+
|
|
11
|
+
query_params = URI.encode_www_form(options)
|
|
12
|
+
number_facts_uri = URI("#{BASE_URI}/#{number}/#{type}?#{query_params}")
|
|
13
|
+
Net::HTTP.get(number_facts_uri)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
6
16
|
|
|
7
17
|
class Error < StandardError; end
|
|
8
18
|
end
|
data/lib/version.rb
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
VERSION = '1.2.1'.freeze
|
metadata
CHANGED
|
@@ -1,58 +1,58 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fact_is_fact
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 1.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
-
|
|
7
|
+
- Abhinay
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2021-07-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - "
|
|
17
|
+
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
19
|
+
version: 2.2.17
|
|
20
20
|
type: :development
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
|
-
- - "
|
|
24
|
+
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version:
|
|
26
|
+
version: 2.2.17
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: rake
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
|
-
- -
|
|
31
|
+
- - '='
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version:
|
|
33
|
+
version: 13.0.3
|
|
34
34
|
type: :development
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
|
-
- -
|
|
38
|
+
- - '='
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version:
|
|
40
|
+
version: 13.0.3
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: rspec
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
44
44
|
requirements:
|
|
45
|
-
- -
|
|
45
|
+
- - '='
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: 3.
|
|
47
|
+
version: 3.10.0
|
|
48
48
|
type: :development
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
|
-
- -
|
|
52
|
+
- - '='
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: 3.
|
|
55
|
-
description: library helps you display random facts
|
|
54
|
+
version: 3.10.0
|
|
55
|
+
description: library helps you display random facts about a number or date or a year.
|
|
56
56
|
email:
|
|
57
57
|
- abhinay302@gmail.com
|
|
58
58
|
executables: []
|
|
@@ -61,6 +61,7 @@ extra_rdoc_files: []
|
|
|
61
61
|
files:
|
|
62
62
|
- ".gitignore"
|
|
63
63
|
- ".travis.yml"
|
|
64
|
+
- CHANGELOG.md
|
|
64
65
|
- CODE_OF_CONDUCT.md
|
|
65
66
|
- Gemfile
|
|
66
67
|
- Gemfile.lock
|
|
@@ -71,8 +72,7 @@ files:
|
|
|
71
72
|
- bin/setup
|
|
72
73
|
- fact_is_fact.gemspec
|
|
73
74
|
- lib/fact_is_fact.rb
|
|
74
|
-
- lib/
|
|
75
|
-
- lib/fact_is_fact/version.rb
|
|
75
|
+
- lib/version.rb
|
|
76
76
|
homepage: https://github.com/abhinaykumar/fact_is_fact
|
|
77
77
|
licenses:
|
|
78
78
|
- MIT
|
|
@@ -80,7 +80,7 @@ metadata:
|
|
|
80
80
|
allowed_push_host: https://rubygems.org
|
|
81
81
|
homepage_uri: https://github.com/abhinaykumar/fact_is_fact
|
|
82
82
|
source_code_uri: https://github.com/abhinaykumar/fact_is_fact
|
|
83
|
-
changelog_uri:
|
|
83
|
+
changelog_uri: https://github.com/abhinaykumar/fact_is_fact/blob/master/CHANGELOG.md
|
|
84
84
|
post_install_message:
|
|
85
85
|
rdoc_options: []
|
|
86
86
|
require_paths:
|
|
@@ -96,9 +96,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
96
96
|
- !ruby/object:Gem::Version
|
|
97
97
|
version: '0'
|
|
98
98
|
requirements: []
|
|
99
|
-
|
|
100
|
-
rubygems_version: 2.5.2.2
|
|
99
|
+
rubygems_version: 3.1.6
|
|
101
100
|
signing_key:
|
|
102
101
|
specification_version: 4
|
|
103
|
-
summary:
|
|
102
|
+
summary: This gem allows users to get a random trivia about a number or date or a
|
|
103
|
+
year
|
|
104
104
|
test_files: []
|
data/lib/fact_is_fact/random.rb
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
module FactIsFact
|
|
2
|
-
class Random
|
|
3
|
-
|
|
4
|
-
def initialize(args)
|
|
5
|
-
@number = args[:number] || 'random'
|
|
6
|
-
@fact_type = args[:fact_type]
|
|
7
|
-
@base_uri = 'http://numbersapi.com'
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def trivia
|
|
11
|
-
number_facts_uri = URI("#{@base_uri}/#{@number}/#{@fact_type}")
|
|
12
|
-
Net::HTTP.get(number_facts_uri)
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
data/lib/fact_is_fact/version.rb
DELETED