mojang_api 0.0.1 → 0.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bffb2c03109fdb1916fc77f8877571ce641f2651
4
- data.tar.gz: 45fbbf50a9a2bdf73912bf4670ee97017ca133cd
3
+ metadata.gz: d2b71f8d230024f97fe8d4dfe2fb26e61ab36a99
4
+ data.tar.gz: 1543280b354e88fb6974ce69cf8ff4925ffb8dae
5
5
  SHA512:
6
- metadata.gz: 1ab345871c85dc76003f7ab4f1820cc918be1b5686ac2d7dc4d0f7c42f3bdd9a2b6cb8c4f4d4f945a5bc5cdd0512bc1e5f5873ced145aa227012bc605475cd90
7
- data.tar.gz: dc2025f7f387d55230d887cfb626078689b28905b02c8ada52ce03d06c1ebf716a2af393ca70b75c171b01b5bef8545be34aa5f4e7776888545aab132dcdfe07
6
+ metadata.gz: 20dd844f284db3afe27f55da76c6a32b7e5b299b60ce6f2f4959db80ce332450855802a5ee6d5797a1748f12e94abaebdad08ba0dcd3f0a004c5921c481c435d
7
+ data.tar.gz: e3a3f7ff381ea93907d9b507966aa36d7d80ac2862719c7f82ce66dd21833c9f88cc4abace931e1e46eb4313b49b89e814106b03aa9974dadf044af3597f533d
@@ -15,8 +15,10 @@ module MojangApi
15
15
  end
16
16
 
17
17
  def uuid=(new_uuid)
18
- new_uuid = new_uuid.strip.tr('-', '')
19
- raise "UUID is incorrect length." if new_uuid.length != 32
18
+ if new_uuid
19
+ new_uuid = new_uuid.strip.tr('-', '')
20
+ raise "UUID is incorrect length." if new_uuid.length != 32
21
+ end
20
22
  @uuid = new_uuid
21
23
  end
22
24
 
@@ -33,6 +35,7 @@ module MojangApi
33
35
  opts[:query] = { at: at.to_i } if at
34
36
  response = self.class.get("/users/profiles/#{@game}/#{@name}", opts)
35
37
  @uuid = response['id']
38
+ @name = response['name']
36
39
  @uuid_time = at.nil? ? Time.now : at
37
40
  @uuid
38
41
  end
@@ -1,3 +1,3 @@
1
1
  module MojangApi
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -14,6 +14,10 @@ module MojangApi
14
14
  self
15
15
  end
16
16
 
17
+ def to_s
18
+ serialize
19
+ end
20
+
17
21
  def save_to(filename)
18
22
  File.open(filename, "w") { |f| f.write(serialize) }
19
23
  end
@@ -5,8 +5,9 @@ module MojangApi
5
5
 
6
6
  def parse(input)
7
7
  usernames = []
8
- input.each_line { |username| usernames << username.strip }
9
- @profiles = MojangApi.get_profiles_from_name_list(usernames)
8
+ input.each_line { |username| usernames << username.strip.downcase }
9
+ pry binding
10
+ @profiles = MojangApi.get_profiles_from_name_list(usernames.uniq)
10
11
  end
11
12
 
12
13
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mojang_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - downslope7