nexus-invision 1.10.1 → 1.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/Gemfile.lock +2 -0
- data/lib/nexus/invision/client.rb +28 -31
- data/lib/nexus/invision/client_interface.rb +0 -5
- data/lib/nexus/invision/resources/ensure_member.rb +12 -0
- data/lib/nexus/invision/resources/field.rb +31 -0
- data/lib/nexus/invision/resources/field_group.rb +32 -0
- data/lib/nexus/invision/resources/forum.rb +43 -0
- data/lib/nexus/invision/resources/group.rb +12 -0
- data/lib/nexus/invision/resources/login_link.rb +11 -0
- data/lib/nexus/invision/resources/member.rb +41 -1
- data/lib/nexus/invision/resources/poll.rb +38 -0
- data/lib/nexus/invision/resources/post.rb +21 -1
- data/lib/nexus/invision/resources/question.rb +32 -0
- data/lib/nexus/invision/resources/rank.rb +33 -0
- data/lib/nexus/invision/resources/topic.rb +37 -0
- data/lib/nexus/invision/resources/user.rb +11 -0
- data/lib/nexus/invision/resources/warning.rb +11 -0
- data/lib/nexus/invision/version.rb +2 -2
- data/sorbet/rbi/gems/vcr@6.2.0.rbi +3036 -0
- metadata +10 -5
- data/lib/nexus/invision/requests/unread_count.rb +0 -17
- data/lib/nexus/invision/resources/unread_count.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0b337b979579f1c60c832c5c26a537d53677e6f656af941079a083f3916849d
|
4
|
+
data.tar.gz: a845ba2c6b4ac3f1513ae9da46098893e64cd04e506c04435ed0ca52d9c0cc8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c143cb42c3a74a32bafaa18d48eb7290e6509c63b650873d3774942561c0172a2e112c7bb9c07ee7dec48997e2df57f60afc4d2707cd187f2d18ace388c8fa31
|
7
|
+
data.tar.gz: 4b96b0d6bc5e1b4a55cccc0609354e9f7ea89f6da2ea0582b201d9009ddc04da78e12ec5b72f2242b415b4ab07293033dfceeba0e7ff56d09a64193427f21da0
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -87,6 +87,7 @@ GEM
|
|
87
87
|
yard-sorbet
|
88
88
|
thor (1.3.0)
|
89
89
|
unicode-display_width (2.5.0)
|
90
|
+
vcr (6.2.0)
|
90
91
|
yard (0.9.34)
|
91
92
|
yard-sorbet (0.8.1)
|
92
93
|
sorbet-runtime (>= 0.5)
|
@@ -105,6 +106,7 @@ DEPENDENCIES
|
|
105
106
|
sorbet
|
106
107
|
sorbet-runtime
|
107
108
|
tapioca
|
109
|
+
vcr
|
108
110
|
|
109
111
|
BUNDLED WITH
|
110
112
|
2.4.13
|
@@ -2,6 +2,9 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require "faraday"
|
5
|
+
require "sorbet-runtime"
|
6
|
+
require "uri"
|
7
|
+
|
5
8
|
require "nexus/invision/client_interface"
|
6
9
|
require "nexus/invision/errors/bad_request"
|
7
10
|
require "nexus/invision/errors/unexpected_response"
|
@@ -12,23 +15,25 @@ require "nexus/invision/requests/create_member_warning"
|
|
12
15
|
require "nexus/invision/requests/create_message"
|
13
16
|
require "nexus/invision/requests/delete_member"
|
14
17
|
require "nexus/invision/requests/edit_member"
|
15
|
-
require "nexus/invision/requests/list_forum_topics"
|
16
|
-
require "nexus/invision/requests/remove_member_from_secondary_group"
|
17
18
|
require "nexus/invision/requests/edit_member_primary_group"
|
18
19
|
require "nexus/invision/requests/ensure_member"
|
19
|
-
require "nexus/invision/requests/
|
20
|
+
require "nexus/invision/requests/list_forum_topics"
|
21
|
+
require "nexus/invision/requests/remove_member_from_secondary_group"
|
22
|
+
require "nexus/invision/resources/ensure_member"
|
23
|
+
require "nexus/invision/resources/field"
|
24
|
+
require "nexus/invision/resources/field_group"
|
25
|
+
require "nexus/invision/resources/forum"
|
20
26
|
require "nexus/invision/resources/group"
|
21
27
|
require "nexus/invision/resources/login_link"
|
22
28
|
require "nexus/invision/resources/member"
|
23
29
|
require "nexus/invision/resources/page"
|
30
|
+
require "nexus/invision/resources/poll"
|
24
31
|
require "nexus/invision/resources/post"
|
32
|
+
require "nexus/invision/resources/question"
|
33
|
+
require "nexus/invision/resources/rank"
|
25
34
|
require "nexus/invision/resources/topic"
|
26
35
|
require "nexus/invision/resources/user"
|
27
36
|
require "nexus/invision/resources/warning"
|
28
|
-
require "nexus/invision/resources/ensure_member"
|
29
|
-
require "nexus/invision/resources/unread_count"
|
30
|
-
require "sorbet-runtime"
|
31
|
-
require "uri"
|
32
37
|
|
33
38
|
module Nexus
|
34
39
|
module Invision
|
@@ -96,7 +101,7 @@ module Nexus
|
|
96
101
|
endpoint: URI("forums/posts/#{post_id}"),
|
97
102
|
)
|
98
103
|
|
99
|
-
Resources::Post.
|
104
|
+
Resources::Post.from_response(response.body)
|
100
105
|
end
|
101
106
|
|
102
107
|
sig { override.params(request: Requests::ListForumTopics).returns(Resources::Page[Resources::Topic]) }
|
@@ -114,7 +119,9 @@ module Nexus
|
|
114
119
|
per_page: body.fetch("perPage"),
|
115
120
|
total_results: body.fetch("totalResults"),
|
116
121
|
total_pages: body.fetch("totalPages"),
|
117
|
-
results: body.fetch("results").map
|
122
|
+
results: body.fetch("results").map do |result|
|
123
|
+
Resources::Topic.from_response(result)
|
124
|
+
end,
|
118
125
|
)
|
119
126
|
end
|
120
127
|
|
@@ -126,7 +133,7 @@ module Nexus
|
|
126
133
|
params: request.serialize,
|
127
134
|
)
|
128
135
|
|
129
|
-
Resources::Topic.
|
136
|
+
Resources::Topic.from_response(response.body)
|
130
137
|
end
|
131
138
|
|
132
139
|
sig { override.params(request: Requests::CreateForumPost).returns(Resources::Post) }
|
@@ -137,7 +144,7 @@ module Nexus
|
|
137
144
|
params: request.serialize,
|
138
145
|
)
|
139
146
|
|
140
|
-
Resources::Post.
|
147
|
+
Resources::Post.from_response(response.body)
|
141
148
|
end
|
142
149
|
|
143
150
|
sig { override.params(nexusmods_member_id: Integer).returns(Resources::LoginLink) }
|
@@ -147,7 +154,7 @@ module Nexus
|
|
147
154
|
endpoint: URI("core/loginlinks/#{nexusmods_member_id}"),
|
148
155
|
)
|
149
156
|
|
150
|
-
Resources::LoginLink.
|
157
|
+
Resources::LoginLink.from_response(response.body)
|
151
158
|
end
|
152
159
|
|
153
160
|
sig { override.params(nexusmods_member_id: Integer).returns(Resources::Member) }
|
@@ -157,7 +164,7 @@ module Nexus
|
|
157
164
|
endpoint: URI("core/members/#{nexusmods_member_id}"),
|
158
165
|
)
|
159
166
|
|
160
|
-
Resources::Member.
|
167
|
+
Resources::Member.from_response(response.body)
|
161
168
|
end
|
162
169
|
|
163
170
|
sig { override.params(request: Requests::EnsureMember).returns(Resources::EnsureMember) }
|
@@ -168,7 +175,7 @@ module Nexus
|
|
168
175
|
params: request.serialize.except("id"),
|
169
176
|
)
|
170
177
|
|
171
|
-
Resources::EnsureMember.
|
178
|
+
Resources::EnsureMember.from_response(response.body)
|
172
179
|
end
|
173
180
|
|
174
181
|
sig { override.params(request: Requests::CreateMessage).void }
|
@@ -180,16 +187,6 @@ module Nexus
|
|
180
187
|
)
|
181
188
|
end
|
182
189
|
|
183
|
-
sig { override.params(request: Requests::UnreadCount).returns(Resources::UnreadCount) }
|
184
|
-
def unread_count(request)
|
185
|
-
response = request(
|
186
|
-
http_method: HTTPMethod::GET,
|
187
|
-
endpoint: URI("core/unreadcount/#{request.id}"),
|
188
|
-
)
|
189
|
-
|
190
|
-
Resources::UnreadCount.from_hash(response.body)
|
191
|
-
end
|
192
|
-
|
193
190
|
sig { override.params(request: Requests::EditMemberPrimaryGroup).returns(Resources::Member) }
|
194
191
|
def edit_member_primary_group(request)
|
195
192
|
response = request(
|
@@ -197,7 +194,7 @@ module Nexus
|
|
197
194
|
endpoint: URI("core/members/#{request.member_id}"),
|
198
195
|
params: request.serialize.except("member_id"),
|
199
196
|
)
|
200
|
-
Resources::Member.
|
197
|
+
Resources::Member.from_response(response.body)
|
201
198
|
end
|
202
199
|
|
203
200
|
sig { override.params(request: Requests::AddMemberToSecondaryGroup).returns(Resources::User) }
|
@@ -207,7 +204,7 @@ module Nexus
|
|
207
204
|
endpoint: URI("core/members/#{request.member_id}/secgroup/#{request.group_id}"),
|
208
205
|
)
|
209
206
|
|
210
|
-
Resources::User.
|
207
|
+
Resources::User.from_response(response.body)
|
211
208
|
end
|
212
209
|
|
213
210
|
sig { override.params(request: Requests::RemoveMemberFromSecondaryGroup).returns(Resources::User) }
|
@@ -217,7 +214,7 @@ module Nexus
|
|
217
214
|
endpoint: URI("core/members/#{request.member_id}/secgroup/#{request.group_id}"),
|
218
215
|
)
|
219
216
|
|
220
|
-
Resources::User.
|
217
|
+
Resources::User.from_response(response.body)
|
221
218
|
end
|
222
219
|
|
223
220
|
sig { override.params(request: Requests::CreateMemberWarning).returns(Resources::Warning) }
|
@@ -228,7 +225,7 @@ module Nexus
|
|
228
225
|
params: request.serialize.except("member_id"),
|
229
226
|
)
|
230
227
|
|
231
|
-
Resources::Warning.
|
228
|
+
Resources::Warning.from_response(response.body)
|
232
229
|
end
|
233
230
|
|
234
231
|
sig { override.params(member_id: Integer).returns(Resources::User) }
|
@@ -238,7 +235,7 @@ module Nexus
|
|
238
235
|
endpoint: URI("core/bans/#{member_id}"),
|
239
236
|
)
|
240
237
|
|
241
|
-
Resources::User.
|
238
|
+
Resources::User.from_response(response.body)
|
242
239
|
end
|
243
240
|
|
244
241
|
sig { override.params(member_id: Integer).returns(Resources::User) }
|
@@ -248,7 +245,7 @@ module Nexus
|
|
248
245
|
endpoint: URI("core/bans/#{member_id}"),
|
249
246
|
)
|
250
247
|
|
251
|
-
Resources::User.
|
248
|
+
Resources::User.from_response(response.body)
|
252
249
|
end
|
253
250
|
|
254
251
|
sig { override.params(request: Requests::DeleteMember).void }
|
@@ -269,7 +266,7 @@ module Nexus
|
|
269
266
|
endpoint: URI("core/members/#{request.member_id}"),
|
270
267
|
params: request.serialize.except("member_id"),
|
271
268
|
)
|
272
|
-
Resources::User.
|
269
|
+
Resources::User.from_response(response.body)
|
273
270
|
end
|
274
271
|
|
275
272
|
private
|
@@ -15,7 +15,6 @@ require "nexus/invision/requests/list_forum_topics"
|
|
15
15
|
require "nexus/invision/requests/remove_member_from_secondary_group"
|
16
16
|
require "nexus/invision/requests/edit_member_primary_group"
|
17
17
|
require "nexus/invision/requests/ensure_member"
|
18
|
-
require "nexus/invision/requests/unread_count"
|
19
18
|
require "nexus/invision/resources/group"
|
20
19
|
require "nexus/invision/resources/login_link"
|
21
20
|
require "nexus/invision/resources/member"
|
@@ -25,7 +24,6 @@ require "nexus/invision/resources/topic"
|
|
25
24
|
require "nexus/invision/resources/user"
|
26
25
|
require "nexus/invision/resources/warning"
|
27
26
|
require "nexus/invision/resources/ensure_member"
|
28
|
-
require "nexus/invision/resources/unread_count"
|
29
27
|
require "sorbet-runtime"
|
30
28
|
require "uri"
|
31
29
|
|
@@ -66,9 +64,6 @@ module Nexus
|
|
66
64
|
sig { abstract.params(request: Requests::CreateMessage).void }
|
67
65
|
def create_message(request) end
|
68
66
|
|
69
|
-
sig { abstract.params(request: Requests::UnreadCount).returns(Resources::UnreadCount) }
|
70
|
-
def unread_count(request) end
|
71
|
-
|
72
67
|
sig { abstract.params(request: Requests::EditMemberPrimaryGroup).returns(Resources::Member) }
|
73
68
|
def edit_member_primary_group(request) end
|
74
69
|
|
@@ -12,6 +12,18 @@ module Nexus
|
|
12
12
|
|
13
13
|
const :id, Integer
|
14
14
|
const :created, T::Boolean
|
15
|
+
|
16
|
+
class << self
|
17
|
+
extend T::Sig
|
18
|
+
|
19
|
+
sig { params(response: T::Hash[String, T.untyped]).returns(EnsureMember) }
|
20
|
+
def from_response(response)
|
21
|
+
EnsureMember.new(
|
22
|
+
id: response["id"],
|
23
|
+
created: response["created"],
|
24
|
+
)
|
25
|
+
end
|
26
|
+
end
|
15
27
|
end
|
16
28
|
end
|
17
29
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "sorbet-runtime"
|
5
|
+
|
6
|
+
require "nexus/invision/value_object"
|
7
|
+
|
8
|
+
module Nexus
|
9
|
+
module Invision
|
10
|
+
module Resources
|
11
|
+
class Field < T::Struct
|
12
|
+
include ValueObject
|
13
|
+
|
14
|
+
const :name, String
|
15
|
+
const :value, String
|
16
|
+
|
17
|
+
class << self
|
18
|
+
extend T::Sig
|
19
|
+
|
20
|
+
sig { params(response: T::Hash[String, T.untyped]).returns(Field) }
|
21
|
+
def from_response(response)
|
22
|
+
Field.new(
|
23
|
+
name: response["name"],
|
24
|
+
value: response["value"],
|
25
|
+
)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "sorbet-runtime"
|
5
|
+
|
6
|
+
require "nexus/invision/value_object"
|
7
|
+
require "nexus/invision/resources/field"
|
8
|
+
|
9
|
+
module Nexus
|
10
|
+
module Invision
|
11
|
+
module Resources
|
12
|
+
class FieldGroup < T::Struct
|
13
|
+
include ValueObject
|
14
|
+
|
15
|
+
const :name, Integer
|
16
|
+
const :fields, T::Hash[String, Field]
|
17
|
+
|
18
|
+
class << self
|
19
|
+
extend T::Sig
|
20
|
+
|
21
|
+
sig { params(response: T::Hash[String, T.untyped]).returns(FieldGroup) }
|
22
|
+
def from_response(response)
|
23
|
+
FieldGroup.new(
|
24
|
+
name: response["name"],
|
25
|
+
fields: response["fields"].map { |f| Field.from_response(f) },
|
26
|
+
)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "sorbet-runtime"
|
5
|
+
|
6
|
+
require "nexus/invision/value_object"
|
7
|
+
|
8
|
+
module Nexus
|
9
|
+
module Invision
|
10
|
+
module Resources
|
11
|
+
class Forum < T::Struct
|
12
|
+
include ValueObject
|
13
|
+
|
14
|
+
const :id, Integer
|
15
|
+
const :name, String
|
16
|
+
const :path, String
|
17
|
+
const :type, String
|
18
|
+
const :topics, Integer
|
19
|
+
const :url, String
|
20
|
+
const :parentId, T.nilable(Integer)
|
21
|
+
const :permissions, T.nilable(T::Hash[T.untyped, T.untyped])
|
22
|
+
|
23
|
+
class << self
|
24
|
+
extend T::Sig
|
25
|
+
|
26
|
+
sig { params(response: T::Hash[String, T.untyped]).returns(Forum) }
|
27
|
+
def from_response(response)
|
28
|
+
Forum.new(
|
29
|
+
id: response["id"],
|
30
|
+
name: response["name"],
|
31
|
+
path: response["path"],
|
32
|
+
type: response["type"],
|
33
|
+
topics: response["topics"],
|
34
|
+
url: response["url"],
|
35
|
+
parentId: response["parentId"],
|
36
|
+
permissions: response["permissions"],
|
37
|
+
)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -12,6 +12,18 @@ module Nexus
|
|
12
12
|
|
13
13
|
const :id, Integer
|
14
14
|
const :name, String
|
15
|
+
|
16
|
+
class << self
|
17
|
+
extend T::Sig
|
18
|
+
|
19
|
+
sig { params(response: T::Hash[String, T.untyped]).returns(Group) }
|
20
|
+
def from_response(response)
|
21
|
+
Group.new(
|
22
|
+
id: response["id"],
|
23
|
+
name: response["name"],
|
24
|
+
)
|
25
|
+
end
|
26
|
+
end
|
15
27
|
end
|
16
28
|
end
|
17
29
|
end
|
@@ -11,6 +11,17 @@ module Nexus
|
|
11
11
|
include ValueObject
|
12
12
|
|
13
13
|
const :id, Integer
|
14
|
+
|
15
|
+
class << self
|
16
|
+
extend T::Sig
|
17
|
+
|
18
|
+
sig { params(response: T::Hash[String, T.untyped]).returns(LoginLink) }
|
19
|
+
def from_response(response)
|
20
|
+
LoginLink.new(
|
21
|
+
id: response["id"],
|
22
|
+
)
|
23
|
+
end
|
24
|
+
end
|
14
25
|
end
|
15
26
|
end
|
16
27
|
end
|
@@ -1,9 +1,12 @@
|
|
1
1
|
# typed: strict
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
require "nexus/invision/value_object"
|
5
4
|
require "sorbet-runtime"
|
6
5
|
|
6
|
+
require "nexus/invision/value_object"
|
7
|
+
require "nexus/invision/resources/rank"
|
8
|
+
require "nexus/invision/resources/field_group"
|
9
|
+
|
7
10
|
module Nexus
|
8
11
|
module Invision
|
9
12
|
module Resources
|
@@ -12,7 +15,44 @@ module Nexus
|
|
12
15
|
include ValueObject
|
13
16
|
|
14
17
|
const :id, Integer
|
18
|
+
# const :name, String
|
19
|
+
# const :title, T.nilable(String)
|
20
|
+
# const :timeZone, String
|
21
|
+
# const :formattedName, String
|
15
22
|
const :primaryGroup, Group
|
23
|
+
# const :secondaryGroups, T::Array[Group]
|
24
|
+
# const :email, String
|
25
|
+
# const :joined, Time
|
26
|
+
# const :registrationIpAddress, String
|
27
|
+
# const :warningPoints, Integer
|
28
|
+
# const :reputationPoints, Integer
|
29
|
+
# const :photoUrl, String
|
30
|
+
# const :photoUrlIsDefault, T::Boolean
|
31
|
+
# const :coverPhotoUrl, String
|
32
|
+
# const :profileUrl, T.nilable(String)
|
33
|
+
# const :validating, T::Boolean
|
34
|
+
# const :posts, Integer
|
35
|
+
# const :lastActivity, Time
|
36
|
+
# const :lastVisit, Time
|
37
|
+
# const :birthday, Date
|
38
|
+
# const :profileViews, Integer
|
39
|
+
# const :customFields, T::Hash[String, FieldGroup]
|
40
|
+
# const :rank, Rank
|
41
|
+
# const :achievements_points, Integer
|
42
|
+
# const :allowAdminEmails, T::Boolean
|
43
|
+
# const :completed, T::Boolean
|
44
|
+
|
45
|
+
class << self
|
46
|
+
extend T::Sig
|
47
|
+
|
48
|
+
sig { params(response: T::Hash[String, T.untyped]).returns(Member) }
|
49
|
+
def from_response(response)
|
50
|
+
Member.new(
|
51
|
+
id: response["id"],
|
52
|
+
primaryGroup: Group.from_response(response["primaryGroup"]),
|
53
|
+
)
|
54
|
+
end
|
55
|
+
end
|
16
56
|
end
|
17
57
|
end
|
18
58
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "sorbet-runtime"
|
5
|
+
|
6
|
+
require "nexus/invision/resources/question"
|
7
|
+
require "nexus/invision/value_object"
|
8
|
+
|
9
|
+
module Nexus
|
10
|
+
module Invision
|
11
|
+
module Resources
|
12
|
+
# Member is a User with additional information about their membership.
|
13
|
+
class Poll < T::Struct
|
14
|
+
include ValueObject
|
15
|
+
|
16
|
+
const :id, Integer
|
17
|
+
# const :title, String
|
18
|
+
# const :start_date, DateTime
|
19
|
+
# const :closed, T::Boolean
|
20
|
+
# const :closedDate, String
|
21
|
+
# const :public, T::Boolean
|
22
|
+
# const :votes, Integer
|
23
|
+
# const :questions, T::Array[Question]
|
24
|
+
|
25
|
+
class << self
|
26
|
+
extend T::Sig
|
27
|
+
|
28
|
+
sig { params(response: T::Hash[String, T.untyped]).returns(Poll) }
|
29
|
+
def from_response(response)
|
30
|
+
Poll.new(
|
31
|
+
id: response["id"],
|
32
|
+
)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -1,9 +1,11 @@
|
|
1
1
|
# typed: strict
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
require "nexus/invision/value_object"
|
5
4
|
require "sorbet-runtime"
|
6
5
|
|
6
|
+
require "nexus/invision/value_object"
|
7
|
+
require "nexus/invision/resources/member"
|
8
|
+
|
7
9
|
module Nexus
|
8
10
|
module Invision
|
9
11
|
module Resources
|
@@ -12,6 +14,24 @@ module Nexus
|
|
12
14
|
|
13
15
|
const :id, Integer
|
14
16
|
const :item_id, Integer
|
17
|
+
# const :author, Member
|
18
|
+
# const :date, Time
|
19
|
+
# const :content, String
|
20
|
+
# const :hidden, T::Boolean
|
21
|
+
# const :url, String
|
22
|
+
# const :reactions, T::Hash[String, T::Array[String]]
|
23
|
+
|
24
|
+
class << self
|
25
|
+
extend T::Sig
|
26
|
+
|
27
|
+
sig { params(response: T::Hash[String, T.untyped]).returns(Post) }
|
28
|
+
def from_response(response)
|
29
|
+
Post.new(
|
30
|
+
id: response["id"],
|
31
|
+
item_id: response["item_id"],
|
32
|
+
)
|
33
|
+
end
|
34
|
+
end
|
15
35
|
end
|
16
36
|
end
|
17
37
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "sorbet-runtime"
|
5
|
+
|
6
|
+
require "nexus/invision/value_object"
|
7
|
+
|
8
|
+
module Nexus
|
9
|
+
module Invision
|
10
|
+
module Resources
|
11
|
+
# Member is a User with additional information about their membership.
|
12
|
+
class Question < T::Struct
|
13
|
+
include ValueObject
|
14
|
+
|
15
|
+
const :question, String
|
16
|
+
const :options, T::Hash[String, T.untyped]
|
17
|
+
|
18
|
+
class << self
|
19
|
+
extend T::Sig
|
20
|
+
|
21
|
+
sig { params(response: T::Hash[String, T.untyped]).returns(Question) }
|
22
|
+
def from_response(response)
|
23
|
+
Question.new(
|
24
|
+
question: response["question"],
|
25
|
+
options: response["options"],
|
26
|
+
)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "sorbet-runtime"
|
5
|
+
|
6
|
+
module Nexus
|
7
|
+
module Invision
|
8
|
+
module Resources
|
9
|
+
class Rank < T::Struct
|
10
|
+
include ValueObject
|
11
|
+
|
12
|
+
const :id, Integer
|
13
|
+
const :name, String
|
14
|
+
const :icon, String
|
15
|
+
const :points, Integer
|
16
|
+
|
17
|
+
class << self
|
18
|
+
extend T::Sig
|
19
|
+
|
20
|
+
sig { params(response: T::Hash[String, T.untyped]).returns(Rank) }
|
21
|
+
def from_response(response)
|
22
|
+
Rank.new(
|
23
|
+
id: response["id"],
|
24
|
+
name: response["name"],
|
25
|
+
icon: response["icon"],
|
26
|
+
points: response["points"],
|
27
|
+
)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -2,6 +2,9 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require "nexus/invision/value_object"
|
5
|
+
require "nexus/invision/resources/forum"
|
6
|
+
require "nexus/invision/resources/post"
|
7
|
+
require "nexus/invision/resources/poll"
|
5
8
|
require "sorbet-runtime"
|
6
9
|
|
7
10
|
module Nexus
|
@@ -12,6 +15,40 @@ module Nexus
|
|
12
15
|
|
13
16
|
const :id, Integer
|
14
17
|
const :title, String
|
18
|
+
# const :forum, Forum
|
19
|
+
# const :posts, Integer
|
20
|
+
# const :views, Integer
|
21
|
+
# const :prefix, String
|
22
|
+
# const :tags, T::Array[String]
|
23
|
+
const :first_post, T.nilable(Post), default: nil
|
24
|
+
const :last_post, T.nilable(Post), default: nil
|
25
|
+
# const :best_answer, T.nilable(Post)
|
26
|
+
# const :locked, T::Boolean
|
27
|
+
# const :hidden, T::Boolean
|
28
|
+
# const :pinned, T::Boolean
|
29
|
+
# const :featured, T::Boolean
|
30
|
+
# const :archived, T::Boolean
|
31
|
+
# const :poll, Poll
|
32
|
+
# const :url, String
|
33
|
+
# const :rating, Float
|
34
|
+
|
35
|
+
class << self
|
36
|
+
extend T::Sig
|
37
|
+
|
38
|
+
sig { params(response: T::Hash[String, T.untyped]).returns(Topic) }
|
39
|
+
def from_response(response)
|
40
|
+
Resources::Topic.new(
|
41
|
+
id: response["id"],
|
42
|
+
title: response["title"],
|
43
|
+
first_post: response["firstPost"]&.then do |fp|
|
44
|
+
Resources::Post.from_response(fp)
|
45
|
+
end,
|
46
|
+
last_post: response["lastPost"]&.then do |lp|
|
47
|
+
Resources::Post.from_response(lp)
|
48
|
+
end,
|
49
|
+
)
|
50
|
+
end
|
51
|
+
end
|
15
52
|
end
|
16
53
|
end
|
17
54
|
end
|
@@ -11,6 +11,17 @@ module Nexus
|
|
11
11
|
include ValueObject
|
12
12
|
|
13
13
|
const :id, Integer
|
14
|
+
|
15
|
+
class << self
|
16
|
+
extend T::Sig
|
17
|
+
|
18
|
+
sig { params(response: T::Hash[String, T.untyped]).returns(User) }
|
19
|
+
def from_response(response)
|
20
|
+
User.new(
|
21
|
+
id: Integer(response["id"]),
|
22
|
+
)
|
23
|
+
end
|
24
|
+
end
|
14
25
|
end
|
15
26
|
end
|
16
27
|
end
|