acnh_informations 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/acnh_informations/api.rb +8 -6
- data/lib/acnh_informations/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d512b4761de49a89d6136d1ca7074f09611af34b72f3540f12e2772e472fcad8
|
4
|
+
data.tar.gz: 7ae3a6d373ddac8ff805b5d5d0100e195091de597bafefa161b633cdeefa3498
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 876c1c3dbf684793dd95375ca41e8f60dbfae50a0688604aa94e9889b61b68f97386806e0aea39da749c02265117561c825aff14bd98bb7dc09db7068c9f9b5c
|
7
|
+
data.tar.gz: 6bdca42eb39195cb458b82ab965fe57355a633b7e84a1f92d285703eef9b71ceee307e977cbb9f9725f35a1580691cee443eca6500b1aa0e3e7570539aa44e10
|
@@ -14,11 +14,13 @@ module AcnhInformations
|
|
14
14
|
##
|
15
15
|
# Verify if the object exists
|
16
16
|
#
|
17
|
-
# @param [Symbol,
|
18
|
-
# @param id [Symbol,
|
17
|
+
# @param [Symbol, String] category The category to find the object
|
18
|
+
# @param id [Symbol, String, NilClass] The id to get
|
19
19
|
# @return [Boolean] True or False, if the wanted research exists
|
20
20
|
def self.valid?(category, id = nil)
|
21
|
-
|
21
|
+
return false unless id.to_s.ascii_only?
|
22
|
+
|
23
|
+
RestClient.get("#{BASE_URL}/v1/#{category.to_s}/#{id ? id.to_s : ""}")
|
22
24
|
true
|
23
25
|
rescue RestClient::NotFound
|
24
26
|
false
|
@@ -27,12 +29,12 @@ module AcnhInformations
|
|
27
29
|
##
|
28
30
|
# Scrape informations from API
|
29
31
|
#
|
30
|
-
# @param [Symbol,
|
31
|
-
# @param id [Symbol,
|
32
|
+
# @param [Symbol, String] category The category to find the object
|
33
|
+
# @param id [Symbol, String, NilClass] The id to get
|
32
34
|
# @return [Object] The result as a Hash
|
33
35
|
# @see Api#valid?
|
34
36
|
def self.scrape(category, id = nil)
|
35
|
-
return false unless valid?(category, id)
|
37
|
+
return false unless valid?(category.to_s, id.to_s)
|
36
38
|
|
37
39
|
JSON.parse(RestClient.get("#{BASE_URL}/v1/#{category.to_s}/#{id ? id.to_s : ""}"), :symbolize_names => true)
|
38
40
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acnh_informations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- senchuu
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-06-
|
11
|
+
date: 2021-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: 'Get things informations from Animal Crossing New Horizons using https://acnhapi.com/.
|
14
14
|
Warning: That doesn''t get informations from players. Only included things.'
|