discord_api 0.1.0 → 0.1.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: a993b6022f4e54a0a926ca4df2dd83a8cdf9e1e40c04644d8aa57bfdcc783117
4
- data.tar.gz: 6bf9e38ff1fe30475706f9ce1afe30cf7455360d92b709e66ee42a969040555d
3
+ metadata.gz: f5b44836b278c5d28cd0a2c6fe4009eae2957b0c6bc803fa9cfcc277b7eb794b
4
+ data.tar.gz: 6b7b1de20d49ba721cdd56409e06ce854973951d0dec7a1e38ca44046dd52da3
5
5
  SHA512:
6
- metadata.gz: f1c7448fc44c27fcf7e26f2beb4a8de74fbdc33225cf4831c2f1df5f2f3c1e33af8a88f732ae7ca1d5968a4551d61fdc6b04d3bcc6bfddea9d348983963dc814
7
- data.tar.gz: 67289c6d49b1eb6f701c03d90c79164cdaaae17ddf162ef85906dae140579a8cf1e3a73d093a6b10be1b325fa815d70f5fc946199543aa012d77357e637d22b4
6
+ metadata.gz: 5f32b3a7c6103ceedf3455e10ee7ec02d89522b34031c5d8fe546bf31d02103e3afdbf422f9c5876a0d9735f5ae005876015b033e24e448826caa1e004950cb5
7
+ data.tar.gz: 3f14957f832318e5a7c590830fbc0e7ac7f45a32c1299db78d70d8f98a9e764f614410896f41bb5eaa5de6fac8ee2fc5891300b8efda6f8b6386bb8a3bf80f5f
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Discord API
2
2
 
3
- This is a Ruby wrapper for the Discord HTTP API. **Currently in development**
3
+ This is a Ruby library for the Discord HTTP API. **Currently in development**
4
4
 
5
5
  ## Installation
6
6
 
@@ -75,3 +75,32 @@ These endpoints are only accessible using a bot token.
75
75
  # Bulk delete messages
76
76
  @client.messages.bulk_delete(channel_id: 123123, ids: [123123, 321321])
77
77
  ```
78
+
79
+ ### Guilds/Servers
80
+
81
+ These endpoints are only accessible using a bot token.
82
+
83
+ ```ruby
84
+ # Retrieve a Guild's details
85
+ @client.guilds.retrieve(id: 123123)
86
+
87
+ # Update a Guild's details
88
+ # https://discord.com/developers/docs/resources/guild#modify-guild
89
+ @client.guilds.update(id: 123123, name: "new-guild-name")
90
+
91
+ # Retrieve a list of a Guild's channels
92
+ @client.guilds.channels(guild: 123123)
93
+
94
+ # Create a Guild channel
95
+ # https://discord.com/developers/docs/resources/guild#create-guild-channel
96
+ @client.guilds.create_channel(guild: 123123, name: "new-channel-name")
97
+ ```
98
+
99
+ ## Contributing
100
+
101
+ Bug reports and pull requests are welcome on GitHub at https://github.com/deanpcmad/discord_api.
102
+
103
+ ## License
104
+
105
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
106
+
@@ -14,6 +14,10 @@ module Discord
14
14
  UsersResource.new(self)
15
15
  end
16
16
 
17
+ def guilds
18
+ GuildsResource.new(self)
19
+ end
20
+
17
21
  def channels
18
22
  ChannelsResource.new(self)
19
23
  end
@@ -0,0 +1,24 @@
1
+ module Discord
2
+ class GuildsResource < Resource
3
+
4
+ def retrieve(id:)
5
+ Guild.new get_request("guilds/#{id}").body
6
+ end
7
+
8
+ def update(id:, **params)
9
+ response = patch_request("guilds/#{id}", body: params)
10
+ Guild.new response.body
11
+ end
12
+
13
+ def channels(guild:)
14
+ response = get_request("guilds/#{guild}/channels")
15
+ Collection.from_response(response, type: Channel)
16
+ end
17
+
18
+ def create_channel(guild:, **params)
19
+ response = post_request("guilds/#{guild}/channels", body: params)
20
+ Channel.new response.body
21
+ end
22
+
23
+ end
24
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Discord
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
data/lib/discord.rb CHANGED
@@ -13,6 +13,7 @@ module Discord
13
13
  autoload :UsersResource, "discord/resources/users"
14
14
  autoload :ChannelsResource, "discord/resources/channels"
15
15
  autoload :MessagesResource, "discord/resources/messages"
16
+ autoload :GuildsResource, "discord/resources/guilds"
16
17
 
17
18
  autoload :User, "discord/objects/user"
18
19
  autoload :Guild, "discord/objects/guild"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: discord_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dean Perry
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-01 00:00:00.000000000 Z
11
+ date: 2023-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -47,6 +47,7 @@ files:
47
47
  - lib/discord/objects/user.rb
48
48
  - lib/discord/resource.rb
49
49
  - lib/discord/resources/channels.rb
50
+ - lib/discord/resources/guilds.rb
50
51
  - lib/discord/resources/messages.rb
51
52
  - lib/discord/resources/users.rb
52
53
  - lib/discord/version.rb
@@ -73,8 +74,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
74
  - !ruby/object:Gem::Version
74
75
  version: '0'
75
76
  requirements: []
76
- rubygems_version: 3.4.10
77
+ rubygems_version: 3.4.20
77
78
  signing_key:
78
79
  specification_version: 4
79
- summary: Ruby wrapper for the Discord HTTP API
80
+ summary: Ruby library for the Discord HTTP API
80
81
  test_files: []