Strainer_2.0 1.0 → 2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cd978f715e98f07fc2af37d9c50eff5e19d01cf84c14546ef1960c24191b8dab
4
- data.tar.gz: 3e6b07cc47760b3b644c5098456439c29573d093e4f6b91455382a388eaec923
3
+ metadata.gz: a71e7e08f136cd52fe1d26ba009794b7c1d04f180d1cea8448cfb2182122c973
4
+ data.tar.gz: 469bd83e74933695db404e2835ac26826c73b6328eecc3ce0b52543441ee0a51
5
5
  SHA512:
6
- metadata.gz: e75b8c1d81e0faa727e65a79880e6b384bde6141638f26b5712816ce6b36fd549c5ca0360668b016546ceefb5593a81f1c943f818f63f2301b0a235f9ef7816d
7
- data.tar.gz: 7552af10a7f2ba53f740355aebe7627a9a3732dbdf09a4b23b7daeea6a5474794262df3b3a86200cb398b03b1021f9bc4855fb24a96e17a7adf495d13fc377cc
6
+ metadata.gz: 0d4eb33e5dc82ee2157384f52f47e571663bd1c6ba531cbc26454c09e3ff37bab1349e33ae34f8de3a59c47c183937e316e9db3cd805dd7fee2f72916e809b6c
7
+ data.tar.gz: 66e03c854fc4482a81c3a3cc2e6cb0badae3dcea9a2f210e16d401889bffafe1c6a1630e53c1616a799be93093b8c908b961271aa161412fbe67daa242ec84fe
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- Strainer_2.0 (1.0)
4
+ Strainer_2.0 (2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,3 +1,5 @@
1
+ require_relative './environment.rb'
2
+
1
3
  class AttributeParser
2
4
  def initialize(url)
3
5
  @url = url
@@ -2,4 +2,5 @@ require 'open-uri'
2
2
  require 'net/http'
3
3
  require 'json'
4
4
  require 'tty-prompt'
5
- require 'uri-handler'
5
+ require 'uri-handler'
6
+ require 'hirb'
@@ -3,7 +3,9 @@ require_relative './attributeparser.rb'
3
3
 
4
4
  module Strainer
5
5
  class Error < StandardError; end
6
- puts "Choosing ALL returns a LOT of data, be ready for it!"
6
+
7
+ puts "Choosing ALL returns a LOT of data in a hash, be ready for it!"
8
+
7
9
  prompt = TTY::Prompt.new
8
10
  first_choice = prompt.select("By what strain attribute would you like to search?", %w(Name Race Effect Flavor ALL))
9
11
 
@@ -20,6 +22,9 @@ encoded_second_choice = URI::encode("#{second_choice}") #changes spaces in the u
20
22
 
21
23
  selection = AttributeParser.new("http://strainapi.evanbusse.com/rvxnT8j/strains/search/#{first_choice}/#{encoded_second_choice}")
22
24
 
23
- puts selection.parse_json
25
+ results = selection.parse_json
26
+
27
+ puts Hirb::Helpers::AutoTable.render(results, fields: %w|id name race desc flavor effect|)
28
+
24
29
  end
25
30
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "Strainer_2.0"
3
- spec.version = "1.0"
3
+ spec.version = "2.0"
4
4
  spec.authors = ["Michael Ruhaak"]
5
5
  spec.email = ["mruhaak@gmail.com"]
6
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Strainer_2.0
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.0'
4
+ version: '2.0'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Ruhaak
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-05 00:00:00.000000000 Z
11
+ date: 2020-08-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Will allow a user to retrieve strain specific information such as Name,
14
14
  Race, Effects & Flavor.