acnh_critterpedia 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/CHANGELOG.md +23 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +36 -0
- data/LICENSE.txt +21 -0
- data/README.md +37 -0
- data/Rakefile +4 -0
- data/acnh_critterpedia.gemspec +35 -0
- data/bin/acnh_critterpedia +20 -0
- data/bin/setup +8 -0
- data/lib/acnh_critterpedia.rb +11 -0
- data/lib/acnh_critterpedia/api.rb +56 -0
- data/lib/acnh_critterpedia/cli.rb +108 -0
- data/lib/acnh_critterpedia/critter.rb +23 -0
- data/lib/acnh_critterpedia/version.rb +5 -0
- data/notes.md +34 -0
- metadata +135 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ec1745fd7d759ade55ebaec250d616f7d6d82a840f36af0e4147452736a8d061
|
4
|
+
data.tar.gz: 6774bfc522dfb4bfdfd7852dba15fe46bf7b8a44c74d8c513769f78523186a98
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 577b1e3e027048f047670b6a3b7b70dd08c28c7178bb5a8e664c00ad978e5a24e1ca56736d560e60ed8ca95fab985b7e068a9ad07e3ffd343b1ed622a622fa7c
|
7
|
+
data.tar.gz: dded3e48ba7f12ec404ad0bb3be6e29d68f008dcc0d8bfd9f7b4a43ae4eb869127821919e5a33d5db85e5ad3350fab809b05bb910f7789eeff7ab410308b87cd
|
data/.gitignore
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# Changelog
|
2
|
+
All notable changes to this project will be documented in this file.
|
3
|
+
|
4
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
|
+
|
7
|
+
## [Unreleased]
|
8
|
+
|
9
|
+
## [1.0.1] - 2021-02-01
|
10
|
+
### Fixed
|
11
|
+
|
12
|
+
- Removed duplicate gem bundle inside folder that was causing errors for building the gem.
|
13
|
+
|
14
|
+
## [1.0.0] - 2021-02-01
|
15
|
+
### Added
|
16
|
+
|
17
|
+
- Command Line Interface that prompts user for choices, allows user to request the list of choices again, learn more about the program, and exit the program.
|
18
|
+
- AcnhCritterpedia::CLI class handles the flow of the program from the user's perspective.
|
19
|
+
- AcnhCritterpedia::API class requests data from the API and performs searches.
|
20
|
+
- AcnhCritterpedia::Critter class builds Critter instances from data gathered by API and has a method to print attributes in a readable format.
|
21
|
+
|
22
|
+
[Unreleased]: https://github.com/merlumina/acnh-critterpedia/compare/v1.0.0...HEAD
|
23
|
+
[1.0.0]: https://github.com/merlumina/acnh-critterpedia/releases/tag/v1.0.0
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
6
|
+
|
7
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
8
|
+
|
9
|
+
## Our Standards
|
10
|
+
|
11
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
12
|
+
|
13
|
+
* Demonstrating empathy and kindness toward other people
|
14
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
15
|
+
* Giving and gracefully accepting constructive feedback
|
16
|
+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
17
|
+
* Focusing on what is best not just for us as individuals, but for the overall community
|
18
|
+
|
19
|
+
Examples of unacceptable behavior include:
|
20
|
+
|
21
|
+
* The use of sexualized language or imagery, and sexual attention or
|
22
|
+
advances of any kind
|
23
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
24
|
+
* Public or private harassment
|
25
|
+
* Publishing others' private information, such as a physical or email
|
26
|
+
address, without their explicit permission
|
27
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
28
|
+
professional setting
|
29
|
+
|
30
|
+
## Enforcement Responsibilities
|
31
|
+
|
32
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
33
|
+
|
34
|
+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
35
|
+
|
36
|
+
## Scope
|
37
|
+
|
38
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
39
|
+
|
40
|
+
## Enforcement
|
41
|
+
|
42
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at lizriderwilson@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
|
43
|
+
|
44
|
+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
45
|
+
|
46
|
+
## Enforcement Guidelines
|
47
|
+
|
48
|
+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
49
|
+
|
50
|
+
### 1. Correction
|
51
|
+
|
52
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
53
|
+
|
54
|
+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
55
|
+
|
56
|
+
### 2. Warning
|
57
|
+
|
58
|
+
**Community Impact**: A violation through a single incident or series of actions.
|
59
|
+
|
60
|
+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
61
|
+
|
62
|
+
### 3. Temporary Ban
|
63
|
+
|
64
|
+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
65
|
+
|
66
|
+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
67
|
+
|
68
|
+
### 4. Permanent Ban
|
69
|
+
|
70
|
+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
71
|
+
|
72
|
+
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
73
|
+
|
74
|
+
## Attribution
|
75
|
+
|
76
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
|
77
|
+
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
78
|
+
|
79
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
80
|
+
|
81
|
+
[homepage]: https://www.contributor-covenant.org
|
82
|
+
|
83
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
84
|
+
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
acnh_critterpedia (1.0.1)
|
5
|
+
colorize
|
6
|
+
require_all
|
7
|
+
terminal-table
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
colorize (0.8.1)
|
13
|
+
httparty (0.18.1)
|
14
|
+
mime-types (~> 3.0)
|
15
|
+
multi_xml (>= 0.5.2)
|
16
|
+
mime-types (3.3.1)
|
17
|
+
mime-types-data (~> 3.2015)
|
18
|
+
mime-types-data (3.2020.1104)
|
19
|
+
multi_xml (0.6.0)
|
20
|
+
rake (13.0.3)
|
21
|
+
require_all (3.0.0)
|
22
|
+
terminal-table (3.0.0)
|
23
|
+
unicode-display_width (~> 1.1, >= 1.1.1)
|
24
|
+
unicode-display_width (1.7.0)
|
25
|
+
|
26
|
+
PLATFORMS
|
27
|
+
x86_64-linux
|
28
|
+
|
29
|
+
DEPENDENCIES
|
30
|
+
acnh_critterpedia!
|
31
|
+
bundler
|
32
|
+
httparty
|
33
|
+
rake (~> 13.0)
|
34
|
+
|
35
|
+
BUNDLED WITH
|
36
|
+
2.2.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2021 Liz
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# ACNH Critterpedia
|
2
|
+
|
3
|
+
ACNH Critterpedia is a CLI application for interacting with the Critterpedia from Animal Crossing New Horizons. It allows you to see what critters are available to catch at the current moment, as well as searching critters by month and pulling up information on specific critters.
|
4
|
+
|
5
|
+
Future functionality is planned to allow adding critters to your personal collection so you can use the Critterpedia to keep track of which critters you still need to catch.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
To install, run the following command:
|
10
|
+
|
11
|
+
$ gem install acnh_critterpedia
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
After installing, run
|
16
|
+
$ acnh_critterpedia
|
17
|
+
to start the application.
|
18
|
+
|
19
|
+
ACNH Critterpedia is an interactive app for interfacing with Animal Crossing New Horizon's Critterpedia. It is for personal use to help you keep track of available critters while you play the game!
|
20
|
+
|
21
|
+
## Development
|
22
|
+
|
23
|
+
After checking out the repo, run `bin/setup` to install dependencies.
|
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 the created tag, 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/merlumina/acnh_critterpedia. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/merlumina/acnh_critterpedia/blob/master/CODE_OF_CONDUCT.md).
|
30
|
+
|
31
|
+
## License
|
32
|
+
|
33
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
34
|
+
|
35
|
+
## Code of Conduct
|
36
|
+
|
37
|
+
Everyone interacting in the AcnhCritterpedia project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/acnh_critterpedia/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/acnh_critterpedia/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "acnh_critterpedia"
|
7
|
+
spec.version = AcnhCritterpedia::VERSION
|
8
|
+
spec.authors = ["Liz Wilson"]
|
9
|
+
spec.email = ["lizriderwilson@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = "CLI Critterpedia for ACNH"
|
12
|
+
spec.description = "ACNH Critterpedia is a CLI application that allows searching for critters and their availability for Animal Crossing: New Horizons"
|
13
|
+
spec.homepage = "https://github.com/merlumina/acnh-critterpedia/"
|
14
|
+
spec.license = "MIT"
|
15
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.6.1")
|
16
|
+
|
17
|
+
spec.metadata["homepage_uri"] = "https://github.com/merlumina/acnh-critterpedia/"
|
18
|
+
spec.metadata["source_code_uri"] = "https://github.com/merlumina/acnh-critterpedia/"
|
19
|
+
spec.metadata["changelog_uri"] = "https://github.com/merlumina/acnh-critterpedia/blob/main/changelog.md"
|
20
|
+
|
21
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
22
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
|
23
|
+
end
|
24
|
+
|
25
|
+
spec.bindir = "bin"
|
26
|
+
spec.executables = 'acnh_critterpedia'
|
27
|
+
spec.require_paths = ["lib"]
|
28
|
+
|
29
|
+
spec.add_development_dependency "bundler"
|
30
|
+
spec.add_development_dependency "httparty"
|
31
|
+
spec.add_dependency "require_all"
|
32
|
+
spec.add_dependency "colorize"
|
33
|
+
spec.add_dependency "terminal-table"
|
34
|
+
|
35
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'acnh_critterpedia'
|
5
|
+
|
6
|
+
puts %q{
|
7
|
+
___ _ _ _____ _
|
8
|
+
/ _ \ (_) | | / __ \ (_)
|
9
|
+
/ /_\ \_ __ _ _ __ ___ __ _| | | / \/_ __ ___ ___ ___ _ _ __ __ _
|
10
|
+
| _ | '_ \| | '_ ` _ \ / _` | | | | | '__/ _ \/ __/ __| | '_ \ / _` |
|
11
|
+
| | | | | | | | | | | | | (_| | | | \__/\ | | (_) \__ \__ \ | | | | (_| |
|
12
|
+
\_| |_/_| |_|_|_| |_| |_|\__,_|_| \____/_| \___/|___/___/_|_| |_|\__, |
|
13
|
+
__/ |
|
14
|
+
^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ |___/
|
15
|
+
/N\ /e\ /w\ /H\ /o\ /r\ /i\ /z\ /o\ /n\ /s\
|
16
|
+
<___X___X___> <___X___X___X___X___X___X___X___>
|
17
|
+
|
18
|
+
}.light_yellow
|
19
|
+
|
20
|
+
AcnhCritterpedia::CLI.new.run
|
data/bin/setup
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
class AcnhCritterpedia::API
|
2
|
+
attr_accessor :url, :hemisphere
|
3
|
+
|
4
|
+
def initialize(hemisphere)
|
5
|
+
@url = "https://acnhapi.com/v1a"
|
6
|
+
@hemisphere = hemisphere
|
7
|
+
end
|
8
|
+
|
9
|
+
def search_critter_by_name(name, critter_type)
|
10
|
+
req_url = "#{url}/#{critter_type}/#{name}"
|
11
|
+
data = HTTParty.get(req_url)
|
12
|
+
|
13
|
+
if data.message == "Not Found"
|
14
|
+
"error"
|
15
|
+
else
|
16
|
+
critter_hash = {
|
17
|
+
name: data["name"]["name-USen"],
|
18
|
+
location: data["availability"]["location"],
|
19
|
+
catch_phrase: data["catch-phrase"],
|
20
|
+
month_range: data["availability"]["month-#{hemisphere}"],
|
21
|
+
is_all_year: data["availability"]["isAllYear"],
|
22
|
+
time_range: data["availability"]["time"],
|
23
|
+
is_all_day: data["availability"]["isAllDay"]
|
24
|
+
}
|
25
|
+
|
26
|
+
critter = AcnhCritterpedia::Critter.new(critter_hash)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def search_critters_by_month(month, critter_type)
|
31
|
+
req_url = "#{url}/#{critter_type}/"
|
32
|
+
data = HTTParty.get(req_url)
|
33
|
+
|
34
|
+
critter_list = data.select do |critter|
|
35
|
+
critter["availability"]["month-array-#{hemisphere}"].include?(month)
|
36
|
+
end
|
37
|
+
|
38
|
+
list_critter_names(critter_list)
|
39
|
+
end
|
40
|
+
|
41
|
+
def critters_available_now(critter_type)
|
42
|
+
req_url = "#{url}/#{critter_type}/"
|
43
|
+
data = HTTParty.get(req_url)
|
44
|
+
|
45
|
+
critter_list = data.select do |critter|
|
46
|
+
critter["availability"]["month-array-#{hemisphere}"].include?(Time.now.month) && critter["availability"]["time-array"].include?(Time.now.hour)
|
47
|
+
end
|
48
|
+
|
49
|
+
list_critter_names(critter_list)
|
50
|
+
end
|
51
|
+
|
52
|
+
def list_critter_names(critter_list)
|
53
|
+
critter_list.map {|critter| critter["name"]["name-USen"]}
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
class AcnhCritterpedia::CLI
|
2
|
+
attr_accessor :critterpedia_api
|
3
|
+
|
4
|
+
def run
|
5
|
+
|
6
|
+
puts "#{"Welcome to Critterpedia!".light_green} Right now, it is #{Time.now.strftime("%l:%M%p - %A, %B %e %Y")}\n\n"
|
7
|
+
|
8
|
+
print "Which hemisphere are you playing in? (#{"northern".light_magenta}/#{"southern".light_magenta}): "
|
9
|
+
hemisphere = gets.chomp.downcase
|
10
|
+
while hemisphere != "northern" && hemisphere != "southern" do
|
11
|
+
if hemisphere == "north" || hemisphere == "south"
|
12
|
+
hemisphere += "ern"
|
13
|
+
else
|
14
|
+
print "Hmm...I don't recognize that hemisphere. Please enter 'northern' or 'southern'! ".light_red
|
15
|
+
hemisphere = gets.chomp.downcase
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
@critterpedia_api = AcnhCritterpedia::API.new(hemisphere)
|
20
|
+
puts "You're in the #{hemisphere.capitalize} Hemisphere! We'll be sure to display your results accordingly."
|
21
|
+
list_options
|
22
|
+
|
23
|
+
input = ""
|
24
|
+
while input != "exit"
|
25
|
+
print "\nWhat would you like to do now? Type '#{"options".light_magenta}' for a list of available commands. "
|
26
|
+
input = gets.strip
|
27
|
+
|
28
|
+
case input
|
29
|
+
when "options"
|
30
|
+
list_options
|
31
|
+
when "about"
|
32
|
+
about_program
|
33
|
+
when "1"
|
34
|
+
available_critters("fish")
|
35
|
+
when "2"
|
36
|
+
available_critters("bugs")
|
37
|
+
when "3"
|
38
|
+
available_critters("sea")
|
39
|
+
when "4"
|
40
|
+
critters_by_month("fish")
|
41
|
+
when "5"
|
42
|
+
critters_by_month("bugs")
|
43
|
+
when "6"
|
44
|
+
critters_by_month("sea")
|
45
|
+
when "7"
|
46
|
+
critters_by_name("fish")
|
47
|
+
when "8"
|
48
|
+
critters_by_name("bugs")
|
49
|
+
when "9"
|
50
|
+
critters_by_name("sea")
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def list_options
|
56
|
+
|
57
|
+
table = Terminal::Table.new do |t|
|
58
|
+
t.title = "Options (pick a number)"
|
59
|
+
t.add_row ["1. View Available #{"Fish".cyan}", "2. View Available #{"Bugs".green}", "3. View Available #{"Sea Creatures".blue}"]
|
60
|
+
t.add_row ["4. View #{"Fish".cyan} by Month", "5. View #{"Bugs".green} by Month", "6. View #{"Sea Creatures".blue} by Month"]
|
61
|
+
t.add_row ["7. Search #{"Fish".cyan} by Name", "8. Search #{"Bugs".green} by Name", "9. Search #{"Sea Creatures".blue} by Name"]
|
62
|
+
t.style = {:all_separators => true}
|
63
|
+
end
|
64
|
+
|
65
|
+
puts ""
|
66
|
+
puts table
|
67
|
+
puts "Type '#{"about".light_magenta}' for more information."
|
68
|
+
puts "Type '#{"exit".light_magenta}' to close the program."
|
69
|
+
end
|
70
|
+
|
71
|
+
def about_program
|
72
|
+
puts ""
|
73
|
+
puts "* #{"View Available [Critter]".green.bold} (options 1-3) will list all of the critters of the chosen type that are available to catch right now."
|
74
|
+
puts "* #{"View [Critter] by Month".green.bold} (options 4-6) asks you to choose a month (1-12) and lists all the critters of the chosen type that can be caught during that month."
|
75
|
+
puts "* #{"Search [Critter] by Name".green.bold} (options 7-9) will list the months and time of day the critter can be caught, where it can be caught, and its catch phrase.\n"
|
76
|
+
end
|
77
|
+
|
78
|
+
def parse_name(string)
|
79
|
+
string.gsub(" ", "_").gsub("'", "").downcase
|
80
|
+
end
|
81
|
+
|
82
|
+
def available_critters(critter_type)
|
83
|
+
puts "\n#{critter_type == "sea" ? critter_type.capitalize + " creatures" : critter_type.capitalize} currently available to catch:\n".yellow.bold
|
84
|
+
puts critterpedia_api.critters_available_now(critter_type)
|
85
|
+
end
|
86
|
+
|
87
|
+
def critters_by_month(critter_type)
|
88
|
+
print "Please choose a month (1-12) to see the #{critter_type == "sea" ? critter_type + " creatures" : critter_type} available that month: "
|
89
|
+
month = gets.chomp.to_i
|
90
|
+
|
91
|
+
puts "\n#{critter_type == "sea" ? critter_type.capitalize + " creatures" : critter_type.capitalize} available to catch in #{Time.new(1970, month).strftime("%B")}:\n".yellow.bold
|
92
|
+
puts critterpedia_api.search_critters_by_month(month, critter_type)
|
93
|
+
end
|
94
|
+
|
95
|
+
def critters_by_name(critter_type)
|
96
|
+
print "Please type the name of the #{critter_type == "sea" ? critter_type + " creature" : critter_type} you'd like to learn more about: "
|
97
|
+
name = parse_name(gets.chomp)
|
98
|
+
|
99
|
+
critter = critterpedia_api.search_critter_by_name(name, critter_type)
|
100
|
+
if critter == "error"
|
101
|
+
puts "Sorry, I don't recognize the name of that #{critter_type == "sea" ? critter_type + " creature" : critter_type}! Please type another name.".light_red
|
102
|
+
critters_by_name(critter_type)
|
103
|
+
else
|
104
|
+
critter.print_attributes
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class AcnhCritterpedia::Critter
|
2
|
+
|
3
|
+
attr_reader :name, :location, :catch_phrase, :time_range, :is_all_year, :is_all_day
|
4
|
+
attr_accessor :month_range
|
5
|
+
|
6
|
+
def initialize(hash)
|
7
|
+
hash.each do |key, value|
|
8
|
+
self.instance_variable_set("@#{key}", value)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def print_attributes
|
13
|
+
puts <<-CRITTER_INFO
|
14
|
+
|
15
|
+
#{"Name:".light_cyan} #{name.capitalize}
|
16
|
+
#{"Months Available:".light_cyan} #{is_all_year ? "All Year" : month_range}
|
17
|
+
#{"Hours Available:".light_cyan} #{is_all_day ? "All Day" : time_range}
|
18
|
+
#{"Location:".light_cyan} #{location == nil ? "Ocean" : location}
|
19
|
+
#{"Catch Phrase:".light_cyan} #{catch_phrase}
|
20
|
+
CRITTER_INFO
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
data/notes.md
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# Project Structure
|
2
|
+
|
3
|
+
## Program Flow
|
4
|
+
|
5
|
+
1. Greets User, asks for hemisphere (northern or southern)
|
6
|
+
2. User provides hemisphere
|
7
|
+
3. Responds with hemisphere and local time, asks user to pick a selection:
|
8
|
+
1. View Available Bugs
|
9
|
+
2. View Available Fish
|
10
|
+
3. View Available Sea Creatures
|
11
|
+
4. List Bugs by Month
|
12
|
+
5. List Fish by Month
|
13
|
+
6. List Sea Creatures by Month
|
14
|
+
8. Exit
|
15
|
+
|
16
|
+
## Classes
|
17
|
+
|
18
|
+
- Critters
|
19
|
+
- Bugs
|
20
|
+
- Fish
|
21
|
+
- Sea Creatures
|
22
|
+
- CLI
|
23
|
+
- API
|
24
|
+
|
25
|
+
### Notes
|
26
|
+
|
27
|
+
https://acnhapi.com/v1a/fish/
|
28
|
+
https://acnhapi.com/v1a/bugs/
|
29
|
+
https://acnhapi.com/v1a/sea/
|
30
|
+
|
31
|
+
Attributes for Critter class
|
32
|
+
name[name-USen]
|
33
|
+
availability[month-array-northern, month-array-southern, time-array, location]
|
34
|
+
catch-phrase
|
metadata
ADDED
@@ -0,0 +1,135 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: acnh_critterpedia
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Liz Wilson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-02-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: httparty
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: require_all
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: colorize
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: terminal-table
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: 'ACNH Critterpedia is a CLI application that allows searching for critters
|
84
|
+
and their availability for Animal Crossing: New Horizons'
|
85
|
+
email:
|
86
|
+
- lizriderwilson@gmail.com
|
87
|
+
executables:
|
88
|
+
- acnh_critterpedia
|
89
|
+
extensions: []
|
90
|
+
extra_rdoc_files: []
|
91
|
+
files:
|
92
|
+
- ".gitignore"
|
93
|
+
- CHANGELOG.md
|
94
|
+
- CODE_OF_CONDUCT.md
|
95
|
+
- Gemfile
|
96
|
+
- Gemfile.lock
|
97
|
+
- LICENSE.txt
|
98
|
+
- README.md
|
99
|
+
- Rakefile
|
100
|
+
- acnh_critterpedia.gemspec
|
101
|
+
- bin/acnh_critterpedia
|
102
|
+
- bin/setup
|
103
|
+
- lib/acnh_critterpedia.rb
|
104
|
+
- lib/acnh_critterpedia/api.rb
|
105
|
+
- lib/acnh_critterpedia/cli.rb
|
106
|
+
- lib/acnh_critterpedia/critter.rb
|
107
|
+
- lib/acnh_critterpedia/version.rb
|
108
|
+
- notes.md
|
109
|
+
homepage: https://github.com/merlumina/acnh-critterpedia/
|
110
|
+
licenses:
|
111
|
+
- MIT
|
112
|
+
metadata:
|
113
|
+
homepage_uri: https://github.com/merlumina/acnh-critterpedia/
|
114
|
+
source_code_uri: https://github.com/merlumina/acnh-critterpedia/
|
115
|
+
changelog_uri: https://github.com/merlumina/acnh-critterpedia/blob/main/changelog.md
|
116
|
+
post_install_message:
|
117
|
+
rdoc_options: []
|
118
|
+
require_paths:
|
119
|
+
- lib
|
120
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 2.6.1
|
125
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - ">="
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '0'
|
130
|
+
requirements: []
|
131
|
+
rubygems_version: 3.1.4
|
132
|
+
signing_key:
|
133
|
+
specification_version: 4
|
134
|
+
summary: CLI Critterpedia for ACNH
|
135
|
+
test_files: []
|