steam-id2 0.4.3 → 0.4.4

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
  SHA1:
3
- metadata.gz: ba7072926756ac80a5781db6e6ffc65b89b0bdf2
4
- data.tar.gz: a7401e6ad98f14dd251e04d8059b54c733fb7a6a
3
+ metadata.gz: ed99ffe307bdb0a96a85b23542c12f3477256354
4
+ data.tar.gz: 2d8b93e0cb06c09b42f9f0d5d45aa2a49867de8f
5
5
  SHA512:
6
- metadata.gz: a60344b2ac790464335e8727f87800eff124f110f315d1c295a2ae3e24e1225d02c4b3c98fbdc0c27d721fe14597fdf38a6d44fb9ef3154375b87d90ae22c48e
7
- data.tar.gz: 57d1e29d46fb4837d29fb781e40d8ce5fa4f837573fdae015c487cee551485b10ea2ee141e1c40d22130648f1a939bcb629f4cccfc6851879bf9f5f09335a6f0
6
+ metadata.gz: aecbaee6e95c4444ddb84c1dfae29d0f87b0d9a8f0df349aec486b31c6a0acdb37b7369ea98602f2425bbbb374008d606d52852698bf2bd6de5e137b9787e542
7
+ data.tar.gz: 1773cb0182baee98127acd5d2811f95b572f9b0e16b0dd029228b64be6ce656507bf5e0c86495f6b82b569dd6872481da981b686926ad338b318557fb2436abd
data/CHANGELOG.md CHANGED
@@ -19,6 +19,14 @@ glance - what to expact from upgrading to a new version.
19
19
  ### Removed
20
20
 
21
21
 
22
+ ## [0.4.4] - 2018-03-25
23
+
24
+ ### Fixed
25
+
26
+ - Handle vanity URLs which can't be part of a valid URI by throwing an
27
+ exception instead of failing when creating an URL.
28
+
29
+
22
30
  ## [0.4.3] - 2017-11-30
23
31
 
24
32
  ### Fixed
@@ -6,6 +6,8 @@ module SteamID
6
6
  # Create SteamID objects based on numeric or string-based Steam ID inputs.
7
7
  # @see SteamID
8
8
  class Parser
9
+ STEAM_CUSTOM_URL_BASE = 'https://steamcommunity.com/id/%s'
10
+
9
11
  # Pattern to match classical Steam IDs (STEAM_0:...)
10
12
  PATTERN_STEAM_ID = /^STEAM_[0-9]:([0-9]):([0-9]+)$/i
11
13
  # Pattern to match Steam ID 3 format ([U:1:...])
@@ -131,11 +133,16 @@ module SteamID
131
133
  # @raise [ArgumentError] If the supplied string was not a valid custom URL.
132
134
  # @raise [WebApiError] If the Steam API returned an error.
133
135
  def from_vanity_url(url)
134
- raise ArgumentError, "Vanity URL must be ASCII." unless url.ascii_only?
135
136
  PATTERN_CUSTOM_URL.match(url) do |m|
136
137
  url = m[1]
137
138
  end
138
139
 
140
+ begin
141
+ URI(STEAM_CUSTOM_URL_BASE % url)
142
+ rescue URI::InvalidURIError
143
+ raise ArgumentError, "#{ url } can't be part of a valid URI."
144
+ end
145
+
139
146
  steam_id = SteamId.resolve_vanity_url(url)
140
147
  if steam_id.nil?
141
148
  raise ArgumentError, "#{ url } was not a valid custom URL."
data/steam-id2.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "steam-id2"
7
- spec.version = '0.4.3'
7
+ spec.version = '0.4.4'
8
8
  spec.authors = ["Michael Senn"]
9
9
  spec.email = ["michael@morrolan.ch"]
10
10
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: steam-id2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Senn
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-11-30 00:00:00.000000000 Z
11
+ date: 2018-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: steam-condenser