rublox 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rublox/derive/group.rb +3 -0
- data/lib/rublox/derive/user.rb +1 -1
- data/lib/rublox/models/full_group.rb +3 -2
- data/lib/rublox/models/full_user.rb +1 -1
- data/lib/rublox/models/presence.rb +2 -0
- data/lib/rublox/util/api_helper.rb +2 -0
- data/lib/rublox/util/errors.rb +1 -1
- data/lib/rublox.rb +12 -4
- data/rublox.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d71b3699e8ae0069057c6df240c9ab0199b98f7891c9675543f4b058faf49d3
|
4
|
+
data.tar.gz: b1816f4f994d9d5a78d10bd9cb9ce53882ebabcf3847f2bb58ae9d8d0c5d2cc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33ab5fe58df3c385f14334db14cfced103b5c7004c62b25b8005041b070cf336e5fffbefc00aa5691a05ee11ba3970157f7533e08e32380d72e0f13f4ff31058
|
7
|
+
data.tar.gz: f76ac4fec783276f419fdf1814cd2b6a71cbc82bbeaf5930f373727e6d3c7e0ebd8f2f8ee555596aa53268d1bbb2752c9a79b8efae4d4a6e2154fcf00e2f518e
|
data/lib/rublox/derive/group.rb
CHANGED
@@ -14,16 +14,19 @@ module Rublox
|
|
14
14
|
))
|
15
15
|
end
|
16
16
|
|
17
|
+
# @return [nil]
|
17
18
|
def accept_join_request(user_id)
|
18
19
|
APIHelper.post("https://groups.roblox.com/v1/groups/#{@id}/join-requests/users/#{user_id}")
|
19
20
|
nil
|
20
21
|
end
|
21
22
|
|
23
|
+
# @return [nil]
|
22
24
|
def decline_join_request(user_id)
|
23
25
|
APIHelper.delete("https://groups.roblox.com/v1/groups/#{@id}/join-requests/users/#{user_id}")
|
24
26
|
nil
|
25
27
|
end
|
26
28
|
|
29
|
+
# @return [nil]
|
27
30
|
def kick(user_id)
|
28
31
|
APIHelper.delete("https://groups.roblox.com/v1/groups/#{@id}/users/#{user_id}")
|
29
32
|
nil
|
data/lib/rublox/derive/user.rb
CHANGED
@@ -8,7 +8,7 @@ module Rublox
|
|
8
8
|
module User
|
9
9
|
include Model
|
10
10
|
|
11
|
-
# @return [
|
11
|
+
# @return [Integer] the amount of robux the current authenticated user has
|
12
12
|
def currency
|
13
13
|
APIHelper.get("https://economy.roblox.com/v1/users/#{@id}/currency")["robux"]
|
14
14
|
end
|
@@ -15,9 +15,9 @@ module Rublox
|
|
15
15
|
attr_reader :name
|
16
16
|
# @return [String]
|
17
17
|
attr_reader :description
|
18
|
-
# @return [SkinnyUser]
|
18
|
+
# @return [SkinnyUser, nil]
|
19
19
|
attr_reader :owner
|
20
|
-
# @return [GroupShout]
|
20
|
+
# @return [GroupShout, nil]
|
21
21
|
attr_reader :shout
|
22
22
|
# @return [Integer]
|
23
23
|
attr_reader :member_count
|
@@ -47,6 +47,7 @@ module Rublox
|
|
47
47
|
end
|
48
48
|
|
49
49
|
# Updates the group shout and sets {#shout} to the new group shout
|
50
|
+
# @return [nil]
|
50
51
|
def update_shout!(message)
|
51
52
|
@shout = update_shout(message)
|
52
53
|
end
|
@@ -32,10 +32,12 @@ module Rublox
|
|
32
32
|
attr_reader :user_presence_type
|
33
33
|
# @return [String]
|
34
34
|
attr_reader :last_location
|
35
|
+
|
35
36
|
# attr_reader :place_id
|
36
37
|
# attr_reader :root_place_id
|
37
38
|
# attr_reader :game_id
|
38
39
|
# attr_reader :universe_id
|
40
|
+
|
39
41
|
# @return [Bases::BaseUser]
|
40
42
|
attr_reader :user
|
41
43
|
# @return [Time]
|
data/lib/rublox/util/errors.rb
CHANGED
@@ -33,7 +33,7 @@ module Rublox
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
# This error is raised when a method that requires
|
36
|
+
# This error is raised when a method that requires authentication is called without a valid .ROBLOSECURITY cookie set
|
37
37
|
class InvalidROBLOSECURITYError < StandardError
|
38
38
|
# @!visibility private
|
39
39
|
def initialize
|
data/lib/rublox.rb
CHANGED
@@ -13,21 +13,22 @@ require "rublox/bases/base_group"
|
|
13
13
|
# Docs: https://rubydoc.info/gems/rublox
|
14
14
|
module Rublox
|
15
15
|
# Sets the .ROBLOSECURITY cookie to send authenticated requests
|
16
|
+
# @return [nil]
|
16
17
|
def self.roblosecurity=(roblosecurity)
|
17
18
|
APIHelper.roblosecurity = roblosecurity
|
18
19
|
end
|
19
20
|
|
20
|
-
#
|
21
|
+
# @return [Models::SkinnyUser] the current authenticated user
|
21
22
|
def self.authenticated_user
|
22
23
|
Models::SkinnyUser.new(APIHelper.get("https://users.roblox.com/v1/users/authenticated"))
|
23
24
|
end
|
24
25
|
|
25
|
-
#
|
26
|
+
# @return [Bases::BaseUser]
|
26
27
|
def self.base_user(id)
|
27
28
|
Bases::BaseUser.new(id)
|
28
29
|
end
|
29
30
|
|
30
|
-
#
|
31
|
+
# @return [Models::FullUser]
|
31
32
|
def self.user_from_id(id)
|
32
33
|
Models::FullUser.new(APIHelper.get("https://users.roblox.com/v1/users/#{id}"))
|
33
34
|
rescue Errors::UnhandledStatusCodeError => e
|
@@ -36,6 +37,7 @@ module Rublox
|
|
36
37
|
raise
|
37
38
|
end
|
38
39
|
|
40
|
+
# @return [Array<Models::SkinnyUser>]
|
39
41
|
def self.users_from_ids(ids, exclude_banned_users: false)
|
40
42
|
APIHelper.post(
|
41
43
|
"https://users.roblox.com/v1/users",
|
@@ -46,6 +48,7 @@ module Rublox
|
|
46
48
|
)["data"].map { |data| Models::SkinnyUser.new(data) }
|
47
49
|
end
|
48
50
|
|
51
|
+
# @return [Array<Models::SkinnyUser>]
|
49
52
|
def self.users_from_usernames(usernames, exclude_banned_users: false)
|
50
53
|
APIHelper.post(
|
51
54
|
"https://users.roblox.com/v1/usernames/users",
|
@@ -56,22 +59,26 @@ module Rublox
|
|
56
59
|
)["data"].map { |data| Models::SkinnyUser.new(data) }
|
57
60
|
end
|
58
61
|
|
62
|
+
# @return [Models::SkinnyUser]
|
59
63
|
def self.user_from_username(username, exclude_banned_users: false)
|
60
64
|
users_from_usernames([username], exclude_banned_users: exclude_banned_users)[0] or raise Errors::UserNotFoundError
|
61
65
|
end
|
62
66
|
|
67
|
+
# @return [Bases::BaseUser]
|
63
68
|
def self.base_group(id)
|
64
69
|
Bases::BaseGroup.new(id)
|
65
70
|
end
|
66
71
|
|
72
|
+
# @return [Models::FullGroup]
|
67
73
|
def self.group_from_id(id)
|
68
|
-
APIHelper.get("https://groups.roblox.com/v1/groups/#{id}")
|
74
|
+
Models::FullGroup.new(APIHelper.get("https://groups.roblox.com/v1/groups/#{id}"))
|
69
75
|
rescue Errors::UnhandledStatusCodeError => e
|
70
76
|
raise Errors::GroupNotFoundError, cause: nil if e.response.status == 400
|
71
77
|
|
72
78
|
raise
|
73
79
|
end
|
74
80
|
|
81
|
+
# @return [Array<Models::Presence>]
|
75
82
|
def self.user_presences_from_ids(ids)
|
76
83
|
APIHelper.post(
|
77
84
|
"https://presence.roblox.com/v1/presence/users",
|
@@ -83,6 +90,7 @@ module Rublox
|
|
83
90
|
raise
|
84
91
|
end
|
85
92
|
|
93
|
+
# @return [Models::Presence]
|
86
94
|
def self.user_presence_from_id(id)
|
87
95
|
user_presences_from_ids([id])[0]
|
88
96
|
end
|
data/rublox.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rublox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zmλdie
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-02-
|
12
|
+
date: 2023-02-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: http
|