steam-id2 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -1
- data/lib/steam-id/steam_id.rb +26 -1
- data/steam-id2.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d183c82371f5eedb4ddd26cbc5e89b7f3a8bf8c9
|
4
|
+
data.tar.gz: 306c084c0aedef2069f78e9095a34a83edacb5e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3cf2b56059e8bedf703cc3eeefa3615107c175e7e85b654a18b0c64227634845b795db5ffbb7da452eed6046d8077a2b43b0e007109735eb217afbdc1a8d94d
|
7
|
+
data.tar.gz: ce11e50a85cf45d3d976e6cce46a2ca9cb3cfe05d581af3fe368ba1f55492e58b668b7209a33b10bc64260842bd574d0ec5ea1165c6a97af4b00d57c5aada592
|
data/CHANGELOG.md
CHANGED
@@ -19,7 +19,14 @@ glance - what to expact from upgrading to a new version.
|
|
19
19
|
### Removed
|
20
20
|
|
21
21
|
|
22
|
-
## [0.1.
|
22
|
+
## [0.1.1] - 2017-01-02
|
23
|
+
|
24
|
+
### Fixed
|
25
|
+
|
26
|
+
- Implements missing SteamID::SteamID.from_string method.
|
27
|
+
|
28
|
+
|
29
|
+
## [0.1.0] - 2017-01-02
|
23
30
|
|
24
31
|
### Added
|
25
32
|
|
data/lib/steam-id/steam_id.rb
CHANGED
@@ -82,7 +82,32 @@ module SteamID
|
|
82
82
|
raise ArgumentError, "#{ id.inspect } is not a supported SteamID."
|
83
83
|
end
|
84
84
|
|
85
|
-
def self.from_string(s)
|
85
|
+
def self.from_string(s, steam_api_key: nil)
|
86
|
+
account_id = nil
|
87
|
+
|
88
|
+
# Todo: Refactor
|
89
|
+
begin
|
90
|
+
# Checking for Steam ID first. Most restrictive check, and also does
|
91
|
+
# not require a call to Steam Web API.
|
92
|
+
account_id = from_steam_id(s)
|
93
|
+
rescue ArgumentError
|
94
|
+
begin
|
95
|
+
# Community URL afterwards, does not require an API call either.
|
96
|
+
account_id = from_community_url(s)
|
97
|
+
rescue ArgumentError
|
98
|
+
begin
|
99
|
+
# Trying to resolve as custom/vanity URL now.
|
100
|
+
account_id = from_vanity_url(s, steam_api_key: steam_api_key)
|
101
|
+
rescue ArgumentError
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
if account_id.nil?
|
107
|
+
raise ArgumentError, "Could not convert #{ s } to account id."
|
108
|
+
else
|
109
|
+
account_id
|
110
|
+
end
|
86
111
|
end
|
87
112
|
end
|
88
113
|
end
|
data/steam-id2.gemspec
CHANGED