liblab_the_one 0.3.0 → 0.3.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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +4 -3
- data/lib/liblab/quote/guess_the_quote.rb +4 -4
- data/lib/liblab/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4a46278376323b078492b7eed5571cbaefbf3b2ffcd85c691ff20206e12c4b5f
|
|
4
|
+
data.tar.gz: c1e9cb7245773b9ae262a55088e5a28d0ddb263e5386c0148a2219579e38c9e7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8124e96726f1c218b3dee540a7a10211c8306e598298ebe3b5215de8ca8b047e00bad0cf3af1aff46035e983ec8cbf8bb6db5473d1289e6d709809513ac6872d
|
|
7
|
+
data.tar.gz: dd4bbfe013e808f027fb2b66013760982c189b122ca090870cba55747c128df72eb9ba002b6a67128145fd7bc754e7d1ba085918b73d8649cb1ffbe1dfccf2fd
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -12,7 +12,7 @@ Add the following environment variables. You can request an `access_token` at ht
|
|
|
12
12
|
LIBLAB_ACCESS_TOKEN=
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
Add this line to your application's Gemfile:
|
|
15
|
+
Add this line to your application's Gemfile if using Ruby on Rails:
|
|
16
16
|
|
|
17
17
|
```ruby
|
|
18
18
|
gem 'liblab_the_one'
|
|
@@ -22,10 +22,11 @@ And then execute:
|
|
|
22
22
|
|
|
23
23
|
$ bundle install
|
|
24
24
|
|
|
25
|
-
Or install it yourself as:
|
|
25
|
+
Or install it yourself in a ruby environment as:
|
|
26
26
|
|
|
27
27
|
$ gem install pex_api
|
|
28
28
|
|
|
29
|
+
|
|
29
30
|
After installing you can test by running `irb`, then `require "liblab"` and then running `Liblab::Movie::List.call()` This should return a list of movies.
|
|
30
31
|
|
|
31
32
|
## Usage
|
|
@@ -54,7 +55,7 @@ Example response is `{:quote=>"Your bodyguard?", :movie_name=>"The Two Towers"}`
|
|
|
54
55
|
|
|
55
56
|
## Development
|
|
56
57
|
|
|
57
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `
|
|
58
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
58
59
|
|
|
59
60
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
60
61
|
|
|
@@ -5,7 +5,7 @@ module Liblab
|
|
|
5
5
|
# Example returns {:quote=>"Your bodyguard?", :movie_name=>"The Two Towers"}
|
|
6
6
|
|
|
7
7
|
def self.call()
|
|
8
|
-
page = rand(2)
|
|
8
|
+
page = rand(1..2)
|
|
9
9
|
_path = "quote?page=#{page}"
|
|
10
10
|
|
|
11
11
|
# Get a random page of quotes
|
|
@@ -13,7 +13,7 @@ module Liblab
|
|
|
13
13
|
|
|
14
14
|
if quote_result.code == 200
|
|
15
15
|
# Get a random quote from returned quotes
|
|
16
|
-
index = rand(999)
|
|
16
|
+
index = rand(1..999)
|
|
17
17
|
quote = JSON.parse(quote_result.body)["docs"][index]
|
|
18
18
|
movie_result = ::Liblab::Movie::Get.call(quote["movie"])
|
|
19
19
|
|
|
@@ -23,10 +23,10 @@ module Liblab
|
|
|
23
23
|
|
|
24
24
|
return { quote: quote["dialog"], movie_name: movie["name"] }
|
|
25
25
|
else
|
|
26
|
-
return
|
|
26
|
+
return movie_result
|
|
27
27
|
end
|
|
28
28
|
else
|
|
29
|
-
return
|
|
29
|
+
return quote_result
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
end
|
data/lib/liblab/version.rb
CHANGED