nexus-invision 1.3.0 → 1.5.0

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: 9dfc03f743220a4f2ae8fb6b2fd755c63e49ea095df92cf474412bc9990ccf0f
4
- data.tar.gz: 2fe6a5cce6d8c3f85977e104c403fbb523f57be436bbe03e50987289d2bdaa59
3
+ metadata.gz: d42a3e042b3714f972c3679c1402e94b8477f957733860757d0a3959f72d3240
4
+ data.tar.gz: a3efee62a86c8782b8f71fe1b7846d19421a10dd3c93de8418b7db3790cfa05c
5
5
  SHA512:
6
- metadata.gz: cd77093c767ee079d39b39ca7afc108c2fb381ba0098d0d0268236ece92b0c1cd62bffec97210597704858f8a9f4c46ba70a7e454e426a1c7acfa1035da48c65
7
- data.tar.gz: 68693f8c5081158012e7bc89ccbf0764909a60779404c4fff2da5c965d5f32b0ab1a31f6000fba256df4448d274b1ce954c7e4f7b765cf6c9012ac9e1bd55a63
6
+ metadata.gz: 73452461fbe0ec1095c988a0ebe2d0bac16aa2dee9355edc25e77e57daebcd2cd74637fbb32e1d47115497b1be96ec736ca8b63c14534efd25dd61425859e78b
7
+ data.tar.gz: bc01042302951791c7232515e4ee9c38d597beccd957ddbb05b98ea120ae934b47d871bd50a537df5a5e3fc1514fab2acf8e809f054d6ae582242f4df78350af
@@ -8,11 +8,14 @@ require "nexus/invision/requests/add_member_to_secondary_group"
8
8
  require "nexus/invision/requests/create_forum_post"
9
9
  require "nexus/invision/requests/create_forum_topic"
10
10
  require "nexus/invision/requests/create_member_warning"
11
- require "nexus/invision/requests/list_forum_topics"
12
- require "nexus/invision/requests/remove_member_from_secondary_group"
13
11
  require "nexus/invision/requests/delete_member"
14
12
  require "nexus/invision/requests/edit_member"
13
+ require "nexus/invision/requests/list_forum_topics"
14
+ require "nexus/invision/requests/remove_member_from_secondary_group"
15
+ require "nexus/invision/requests/edit_member_primary_group"
16
+ require "nexus/invision/resources/group"
15
17
  require "nexus/invision/resources/login_link"
18
+ require "nexus/invision/resources/member"
16
19
  require "nexus/invision/resources/page"
17
20
  require "nexus/invision/resources/post"
18
21
  require "nexus/invision/resources/topic"
@@ -61,6 +64,14 @@ module Nexus
61
64
  end
62
65
  end
63
66
 
67
+ sig { params(post_id: Integer).void }
68
+ def delete_post(post_id)
69
+ request(
70
+ http_method: HTTPMethod::DELETE,
71
+ endpoint: URI("forums/posts/#{post_id}"),
72
+ )
73
+ end
74
+
64
75
  sig { params(request: Requests::ListForumTopics).returns(Resources::Page[Resources::Topic]) }
65
76
  def list_forum_topics(request)
66
77
  response = request(
@@ -112,6 +123,26 @@ module Nexus
112
123
  Resources::LoginLink.from_hash(response.body)
113
124
  end
114
125
 
126
+ sig { params(nexusmods_member_id: Integer).returns(Resources::Member) }
127
+ def get_member(nexusmods_member_id)
128
+ response = request(
129
+ http_method: HTTPMethod::GET,
130
+ endpoint: URI("core/members/#{nexusmods_member_id}"),
131
+ )
132
+
133
+ Resources::Member.from_hash(response.body)
134
+ end
135
+
136
+ sig { params(request: Requests::EditMemberPrimaryGroup).returns(Resources::Member) }
137
+ def edit_member_primary_group(request)
138
+ response = request(
139
+ http_method: HTTPMethod::POST,
140
+ endpoint: URI("core/members/#{request.member_id}"),
141
+ params: request.serialize.except("member_id"),
142
+ )
143
+ Resources::Member.from_hash(response.body)
144
+ end
145
+
115
146
  sig { params(request: Requests::AddMemberToSecondaryGroup).returns(Resources::User) }
116
147
  def add_member_to_secondary_group(request)
117
148
  response = request(
@@ -166,8 +197,7 @@ module Nexus
166
197
  sig { params(request: Requests::DeleteMember).void }
167
198
  def delete_member(request)
168
199
  # 1 is keep member name, 0 is anonymize content
169
- values = request.serialize.except("member_id")
170
- .merge({ "contentAnonymize" => request.keep_member_name ? 1 : 0 })
200
+ values = request.serialize.except("member_id").merge({ "contentAnonymize" => request.keep_member_name ? 1 : 0 })
171
201
  request(
172
202
  http_method: HTTPMethod::DELETE,
173
203
  endpoint: URI("core/members/#{request.member_id}"),
@@ -0,0 +1,18 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ require "nexus/invision/value_object"
5
+ require "sorbet-runtime"
6
+
7
+ module Nexus
8
+ module Invision
9
+ module Requests
10
+ class EditMemberPrimaryGroup < T::Struct
11
+ include ValueObject
12
+
13
+ const :member_id, Integer
14
+ const :group, Integer
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ require "nexus/invision/value_object"
5
+ require "sorbet-runtime"
6
+
7
+ module Nexus
8
+ module Invision
9
+ module Resources
10
+ class Group < T::Struct
11
+ include ValueObject
12
+
13
+ const :id, Integer
14
+ const :name, String
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,19 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ require "nexus/invision/value_object"
5
+ require "sorbet-runtime"
6
+
7
+ module Nexus
8
+ module Invision
9
+ module Resources
10
+ # Member is a User with additional information about their membership.
11
+ class Member < T::Struct
12
+ include ValueObject
13
+
14
+ const :id, Integer
15
+ const :primaryGroup, Group
16
+ end
17
+ end
18
+ end
19
+ end
@@ -3,7 +3,7 @@
3
3
 
4
4
  module Nexus
5
5
  module Invision
6
- # Leave this as 1.3.0 in order for CI process to replace with the tagged version.
7
- VERSION = "1.3.0"
6
+ # Leave this as 1.5.0 in order for CI process to replace with the tagged version.
7
+ VERSION = "1.5.0"
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nexus-invision
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jack Robertson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-14 00:00:00.000000000 Z
11
+ date: 2024-01-22 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
@@ -32,9 +32,12 @@ files:
32
32
  - lib/nexus/invision/requests/create_member_warning.rb
33
33
  - lib/nexus/invision/requests/delete_member.rb
34
34
  - lib/nexus/invision/requests/edit_member.rb
35
+ - lib/nexus/invision/requests/edit_member_primary_group.rb
35
36
  - lib/nexus/invision/requests/list_forum_topics.rb
36
37
  - lib/nexus/invision/requests/remove_member_from_secondary_group.rb
38
+ - lib/nexus/invision/resources/group.rb
37
39
  - lib/nexus/invision/resources/login_link.rb
40
+ - lib/nexus/invision/resources/member.rb
38
41
  - lib/nexus/invision/resources/page.rb
39
42
  - lib/nexus/invision/resources/post.rb
40
43
  - lib/nexus/invision/resources/topic.rb
@@ -105,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
108
  - !ruby/object:Gem::Version
106
109
  version: '0'
107
110
  requirements: []
108
- rubygems_version: 3.4.22
111
+ rubygems_version: 3.5.5
109
112
  signing_key:
110
113
  specification_version: 4
111
114
  summary: A client for the Invision Community REST API.