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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1376f9d5370f4e616af22ece0333821840a47c36b4d0af66c91583a640b90d4f
4
- data.tar.gz: cb84e7af63bbbe7365c90cf87ab013f936c4300c121e56ab474c1c1a6abc2434
3
+ metadata.gz: d512b4761de49a89d6136d1ca7074f09611af34b72f3540f12e2772e472fcad8
4
+ data.tar.gz: 7ae3a6d373ddac8ff805b5d5d0100e195091de597bafefa161b633cdeefa3498
5
5
  SHA512:
6
- metadata.gz: e173270f17792509d0f426b44e3807067563c53c191f79f9f470ff260d51c84f82f388a97c80cd365328c3bf567b3b88ccf4d645870fe149f808799d7969ddb3
7
- data.tar.gz: a39c65112399fbea6c2acea525a007875efa1aed040de713f55ddf9088481eddeed4cb8a1a0d38002e448b91da75c5ffe432c35dfb0656c7fa818ac0f94bac3f
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, StringIO] category The category to find the object
18
- # @param id [Symbol, StringIO, NilClass] The id to get
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
- RestClient.get("#{BASE_URL}/v1/#{category.to_s}/#{id ? id.to_s.ascii_only? ? id.to_s : "" : ""}")
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, StringIO] category The category to find the object
31
- # @param id [Symbol, StringIO, NilClass] The id to get
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
@@ -2,5 +2,5 @@
2
2
 
3
3
  module AcnhInformations
4
4
  # The current version of the gem
5
- VERSION = "0.1.2"
5
+ VERSION = "0.1.3"
6
6
  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.2
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-15 00:00:00.000000000 Z
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.'