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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ca58ae27999a8a9d6dad08937ce3167d34163e903571912c47da20cd19c1814a
4
- data.tar.gz: 6116e15392c612305c88425a84d737a867bf6531d36022354f4d410147987837
3
+ metadata.gz: 4d71b3699e8ae0069057c6df240c9ab0199b98f7891c9675543f4b058faf49d3
4
+ data.tar.gz: b1816f4f994d9d5a78d10bd9cb9ce53882ebabcf3847f2bb58ae9d8d0c5d2cc0
5
5
  SHA512:
6
- metadata.gz: 353887d40de73fdb4926837cdfc5209e310db9a9bd323283f288ed312e709e71425133f556f734badd7a54429fbff8fd8acc066fe00dc5701a72ca5c0491bc18
7
- data.tar.gz: 03bbc4ff1011eda5b039c7dcdd9dafcbec8c3f20ae6c462e6e817dcd3b5e2abe849fd2a318ed6d92e7ff542e882aa4b5647e5070430e80b34ade740631b77631
6
+ metadata.gz: 33ab5fe58df3c385f14334db14cfced103b5c7004c62b25b8005041b070cf336e5fffbefc00aa5691a05ee11ba3970157f7533e08e32380d72e0f13f4ff31058
7
+ data.tar.gz: f76ac4fec783276f419fdf1814cd2b6a71cbc82bbeaf5930f373727e6d3c7e0ebd8f2f8ee555596aa53268d1bbb2752c9a79b8efae4d4a6e2154fcf00e2f518e
@@ -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
@@ -8,7 +8,7 @@ module Rublox
8
8
  module User
9
9
  include Model
10
10
 
11
- # @return [Number] the amount of robux the current authenticated user has
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
@@ -13,7 +13,7 @@ module Rublox
13
13
  attr_reader :created
14
14
  # @return [Boolean]
15
15
  attr_reader :is_banned
16
- # @return [String?]
16
+ # @return [String, nil]
17
17
  attr_reader :external_app_display_name
18
18
  # @return [Boolean]
19
19
  attr_reader :has_verified_badge
@@ -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]
@@ -46,6 +46,8 @@ module Rublox
46
46
  "x-csrf-token" => response.headers
47
47
  }
48
48
  )
49
+ else
50
+ raise Errors::UnhandledStatusCodeError.new(response, get_errors_from_response(response))
49
51
  end
50
52
  when 401
51
53
  raise Errors::InvalidROBLOSECURITYError
@@ -33,7 +33,7 @@ module Rublox
33
33
  end
34
34
  end
35
35
 
36
- # This error is raised when a method that requires authenticated is called without a valid .ROBLOSECURITY cookie set
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
- # Returns the current authenticated user
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
- # Returns a BaseUser
26
+ # @return [Bases::BaseUser]
26
27
  def self.base_user(id)
27
28
  Bases::BaseUser.new(id)
28
29
  end
29
30
 
30
- # Returns a user
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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "rublox"
5
- spec.version = "0.3.0"
5
+ spec.version = "0.3.1"
6
6
  spec.authors = %w[zmλdie keef]
7
7
  spec.email = "rorg.devv@gmail.com"
8
8
  spec.summary = "A Roblox web API wrapper written in Ruby"
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.0
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-03 00:00:00.000000000 Z
12
+ date: 2023-02-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: http