steam-id2 0.1.0 → 0.1.1

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: 1bba90f3409c8ed2fa3a29936611a9ee8f1a3ce8
4
- data.tar.gz: bc66bac1e1595e8e8bf8c710c211949f6a2d429b
3
+ metadata.gz: d183c82371f5eedb4ddd26cbc5e89b7f3a8bf8c9
4
+ data.tar.gz: 306c084c0aedef2069f78e9095a34a83edacb5e9
5
5
  SHA512:
6
- metadata.gz: 5702892387d37107eb996ec168f44315c4a9958eb80a6480a5e0de143251d3c0f1ef0b13463f137260c7b63cdb3da7f0be780b83b5babfd2ce3d44372cc2b8dc
7
- data.tar.gz: 24763f1af669221b5434bd12a3efbcf4b2ecadca4ef617c119596032730ae11a1bbdb108c2a44aae17f0c818c3d7bdb16a61f2b9ad425fdfb29f7775aff794b2
6
+ metadata.gz: f3cf2b56059e8bedf703cc3eeefa3615107c175e7e85b654a18b0c64227634845b795db5ffbb7da452eed6046d8077a2b43b0e007109735eb217afbdc1a8d94d
7
+ data.tar.gz: ce11e50a85cf45d3d976e6cce46a2ca9cb3cfe05d581af3fe368ba1f55492e58b668b7209a33b10bc64260842bd574d0ec5ea1165c6a97af4b00d57c5aada592
@@ -19,7 +19,14 @@ glance - what to expact from upgrading to a new version.
19
19
  ### Removed
20
20
 
21
21
 
22
- ## [0.1.0] - 02.01.2017
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
 
@@ -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
@@ -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.1.0'
7
+ spec.version = '0.1.1'
8
8
  spec.authors = ["Michael Senn"]
9
9
  spec.email = ["michael@morrolan.ch"]
10
10
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: steam-id2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Senn