Strainer_2.0 1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: cd978f715e98f07fc2af37d9c50eff5e19d01cf84c14546ef1960c24191b8dab
4
+ data.tar.gz: 3e6b07cc47760b3b644c5098456439c29573d093e4f6b91455382a388eaec923
5
+ SHA512:
6
+ metadata.gz: e75b8c1d81e0faa727e65a79880e6b384bde6141638f26b5712816ce6b36fd549c5ca0360668b016546ceefb5593a81f1c943f818f63f2301b0a235f9ef7816d
7
+ data.tar.gz: 7552af10a7f2ba53f740355aebe7627a9a3732dbdf09a4b23b7daeea6a5474794262df3b3a86200cb398b03b1021f9bc4855fb24a96e17a7adf495d13fc377cc
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.7.0
6
+ before_install: gem install bundler -v 2.1.2
File without changes
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ gem "rake", "~> 12.0"
6
+ gem "rspec", "~> 3.0"
7
+ gem "tty-prompt"
@@ -0,0 +1,48 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ Strainer_2.0 (1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ diff-lcs (1.4.4)
10
+ pastel (0.8.0)
11
+ tty-color (~> 0.5)
12
+ rake (12.3.3)
13
+ rspec (3.9.0)
14
+ rspec-core (~> 3.9.0)
15
+ rspec-expectations (~> 3.9.0)
16
+ rspec-mocks (~> 3.9.0)
17
+ rspec-core (3.9.2)
18
+ rspec-support (~> 3.9.3)
19
+ rspec-expectations (3.9.2)
20
+ diff-lcs (>= 1.2.0, < 2.0)
21
+ rspec-support (~> 3.9.0)
22
+ rspec-mocks (3.9.1)
23
+ diff-lcs (>= 1.2.0, < 2.0)
24
+ rspec-support (~> 3.9.0)
25
+ rspec-support (3.9.3)
26
+ tty-color (0.5.1)
27
+ tty-cursor (0.7.1)
28
+ tty-prompt (0.22.0)
29
+ pastel (~> 0.8)
30
+ tty-reader (~> 0.8)
31
+ tty-reader (0.8.0)
32
+ tty-cursor (~> 0.7)
33
+ tty-screen (~> 0.8)
34
+ wisper (~> 2.0)
35
+ tty-screen (0.8.1)
36
+ wisper (2.0.1)
37
+
38
+ PLATFORMS
39
+ ruby
40
+
41
+ DEPENDENCIES
42
+ Strainer_2.0!
43
+ rake (~> 12.0)
44
+ rspec (~> 3.0)
45
+ tty-prompt
46
+
47
+ BUNDLED WITH
48
+ 2.1.2
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Michael Ruhaak
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,34 @@
1
+ ## Installation
2
+
3
+ Add this line to your application's Gemfile:
4
+
5
+ ```ruby
6
+ gem 'strainer'
7
+ ```
8
+
9
+ And then execute:
10
+
11
+ $ bundle install
12
+
13
+ Or install it yourself as:
14
+
15
+ $ gem install strainer
16
+
17
+ ## Usage
18
+
19
+ This will help any medical marijuana or recreational users in finding specific information about all the variets of marijuana strains that exist in The Strain API. You can search by strain name, flavor, effect, race (indica, sativa, hybid) or you can list all of them. Though, this last option is not recommended by The Strain API developer as it takes a lot of resources to run.
20
+
21
+ ## Development
22
+
23
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
24
+
25
+ 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 tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
26
+
27
+ ## Contributing
28
+
29
+ Bug reports and pull requests are welcome on GitHub at https://github.com/Sinrock/strainer.
30
+
31
+
32
+ ## License
33
+
34
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,36 @@
1
+ ## Installation
2
+
3
+ Add this line to your application's Gemfile:
4
+
5
+ ```ruby
6
+ gem 'strainer'
7
+ ```
8
+
9
+ And then execute:
10
+
11
+ $ bundle install
12
+
13
+ Or install it yourself as:
14
+
15
+ $ gem install strainer
16
+
17
+ ## Usage
18
+
19
+ This will help any medical marijuana or recreational users in finding specific information about all the variets of marijuana strains that exist in The Strain API. You can search by strain name, flavor, effect, race (indica, sativa, hybid) or you can list all of them. Though, this last option is not recommended by The Strain API developer as it takes a lot of resources to run.
20
+
21
+ ## Development
22
+
23
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
24
+
25
+ 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 tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
26
+
27
+ ## Contributing
28
+
29
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[Sinrock]/strainer.
30
+
31
+
32
+ ## License
33
+
34
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
35
+ # strainer
36
+ # strainer
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "strainer"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'strainer'
@@ -0,0 +1,15 @@
1
+ class AttributeParser
2
+ def initialize(url)
3
+ @url = url
4
+ end
5
+
6
+ def get_response_body
7
+ uri = URI.parse(@url)
8
+ response = Net::HTTP.get_response(uri)
9
+ response.body
10
+ end
11
+
12
+ def parse_json
13
+ JSON.parse(get_response_body)
14
+ end
15
+ end
@@ -0,0 +1,5 @@
1
+ require 'open-uri'
2
+ require 'net/http'
3
+ require 'json'
4
+ require 'tty-prompt'
5
+ require 'uri-handler'
@@ -0,0 +1,25 @@
1
+ require_relative './environment.rb'
2
+ require_relative './attributeparser.rb'
3
+
4
+ module Strainer
5
+ class Error < StandardError; end
6
+ puts "Choosing ALL returns a LOT of data, be ready for it!"
7
+ prompt = TTY::Prompt.new
8
+ first_choice = prompt.select("By what strain attribute would you like to search?", %w(Name Race Effect Flavor ALL))
9
+
10
+ if first_choice == "ALL"
11
+ then
12
+ all_choice = AttributeParser.new("http://strainapi.evanbusse.com/rvxnT8j/strains/search/#{first_choice}")
13
+ puts all_choice.parse_json
14
+ else
15
+
16
+ prompt_two = TTY::Prompt.new
17
+ second_choice = prompt_two.ask("Which #{first_choice} would you like to search for? If nothing is returned, your search term isn't one thats accepted.")
18
+
19
+ encoded_second_choice = URI::encode("#{second_choice}") #changes spaces in the user's input into 8 bit, or %20 in the URL
20
+
21
+ selection = AttributeParser.new("http://strainapi.evanbusse.com/rvxnT8j/strains/search/#{first_choice}/#{encoded_second_choice}")
22
+
23
+ puts selection.parse_json
24
+ end
25
+ end
@@ -0,0 +1,25 @@
1
+ Gem::Specification.new do |spec|
2
+ spec.name = "Strainer_2.0"
3
+ spec.version = "1.0"
4
+ spec.authors = ["Michael Ruhaak"]
5
+ spec.email = ["mruhaak@gmail.com"]
6
+
7
+ spec.summary = "Will access The Strain API to return information based on any of 4 criteria, or it can list all known strains and their attributes."
8
+ spec.description = "Will allow a user to retrieve strain specific information such as Name, Race, Effects & Flavor."
9
+ spec.homepage = "https://github.com/Sinrock/Strainer.git"
10
+ spec.license = "MIT"
11
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
12
+
13
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
14
+
15
+ spec.metadata["homepage_uri"] = spec.homepage
16
+ spec.metadata["source_code_uri"] = "https://github.com/Sinrock/Strainer.git"
17
+ spec.metadata["changelog_uri"] = "https://github.com/Sinrock/strainer/blob/master/CHANGELOG.md"
18
+
19
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
20
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
+ end
22
+ spec.bindir = 'bin'
23
+ spec.executables = 'strainer'
24
+ spec.require_paths = ["lib"]
25
+ end
metadata ADDED
@@ -0,0 +1,67 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: Strainer_2.0
3
+ version: !ruby/object:Gem::Version
4
+ version: '1.0'
5
+ platform: ruby
6
+ authors:
7
+ - Michael Ruhaak
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-08-05 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Will allow a user to retrieve strain specific information such as Name,
14
+ Race, Effects & Flavor.
15
+ email:
16
+ - mruhaak@gmail.com
17
+ executables:
18
+ - strainer
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - ".gitignore"
23
+ - ".rspec"
24
+ - ".travis.yml"
25
+ - CHANGELOG.md
26
+ - Gemfile
27
+ - Gemfile.lock
28
+ - LICENSE.txt
29
+ - README.md
30
+ - README.txt
31
+ - Rakefile
32
+ - bin/console
33
+ - bin/setup
34
+ - bin/strainer
35
+ - lib/strainer/attributeparser.rb
36
+ - lib/strainer/environment.rb
37
+ - lib/strainer/strainer.rb
38
+ - strainer.gemspec
39
+ homepage: https://github.com/Sinrock/Strainer.git
40
+ licenses:
41
+ - MIT
42
+ metadata:
43
+ allowed_push_host: https://rubygems.org
44
+ homepage_uri: https://github.com/Sinrock/Strainer.git
45
+ source_code_uri: https://github.com/Sinrock/Strainer.git
46
+ changelog_uri: https://github.com/Sinrock/strainer/blob/master/CHANGELOG.md
47
+ post_install_message:
48
+ rdoc_options: []
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 2.3.0
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ requirements: []
62
+ rubygems_version: 3.1.2
63
+ signing_key:
64
+ specification_version: 4
65
+ summary: Will access The Strain API to return information based on any of 4 criteria,
66
+ or it can list all known strains and their attributes.
67
+ test_files: []