lib_discord 0.1.1 → 0.1.2

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: e9cf44b776374fa1b6a60da79128df73f65b0ae8a5aa29902e1dbc7a2b276fa0
4
- data.tar.gz: a145257108e443b6daba18fef081d49f872dd6b0cb8be2c8864c13890bdeb85a
3
+ metadata.gz: ee336f29f9c16524420b8b087cd245de9cc80f35ee27c1d0036c0983b2042d18
4
+ data.tar.gz: bca8789409c439b82d3bec3b69122c992672b89f35318ee91a1e173fd3ce8589
5
5
  SHA512:
6
- metadata.gz: 913619b768f0414b963736e3ca1238e88f637ced1fd9bdf7361557e6caae487e81d62deacff0250e7bfb6a953a33b80b380add38eb9a5c93df11814f4a91ee25
7
- data.tar.gz: 448a47d8b9b033bb395a62ec22cbcf4059fe47538ba8fd8d7c96f969b01eaf25cd76bda4a36fa0f500282f76f6e66b8b69ae3cfdeafb637ac647bf349feb35ff
6
+ metadata.gz: 0d3c5d14694598880a30b2b061079dedba3ce3911bc64b1c58f340ab8812e97651d25bff73b62c358ad7501203d6d3c1d0394c89f939c3e6a50cd6fbf6db6da7
7
+ data.tar.gz: b4c989d2ded1f3a95bd037f7ca111cb3258e54df90eac9de3342d4d348546ca2ef63a503dc1c35895f63af382669d3eb967eb5a4db80a8659cdaa09f166d31ec
data/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## [0.1.2] - 2024-05-13
4
+
5
+ ### chore
6
+ - sort modules alphabetically
7
+ - unified error raising style
8
+ - bump version to 0.1.2
9
+
10
+ ### fix
11
+ - allow for loggers other than Logger descendants
12
+ - forgot how to raise errors :facepalm:
13
+ - arguments for ConstraintError
14
+ - use `#debug()` convenience method rather than `#add()`
15
+
3
16
  ## [0.1.1] - 2024-04-24
4
17
 
5
18
  ### chore
@@ -168,7 +168,7 @@ module LibDiscord
168
168
  Webhook.new(auth_header, base_url, user_agent, logger)
169
169
  end
170
170
  rescue Dry::Types::ConstraintError => e
171
- raise ConstraintError.new(e.message)
171
+ raise ConstraintError.new(e.result, e.input)
172
172
  end
173
173
 
174
174
  ##
@@ -113,11 +113,9 @@ module LibDiscord
113
113
  body_parsed = begin
114
114
  discord_response.parse
115
115
  rescue HTTP::Error
116
- @logger.add(
117
- Logger::DEBUG,
118
- "Could not parse HTTP response body with content-type #{discord_response.headers["Content-Type"]}.",
119
- "lib_discord"
120
- )
116
+ @logger.debug("lib_discord") do
117
+ "Could not parse response body with content-type `#{discord_response.headers["Content-Type"]}`."
118
+ end
121
119
 
122
120
  nil
123
121
  end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "dry/types"
4
- require "logger"
5
4
 
6
5
  module LibDiscord
7
6
  ##
@@ -14,8 +13,11 @@ module LibDiscord
14
13
  include Dry.Types()
15
14
 
16
15
  ##
17
- # Check for instance of, or decendant of Logger.
18
- Logger = Types.Instance(::Logger)
16
+ # Check for a +Logger+-compatible object. It must respond to +#debug()+,
17
+ # +#info()+, +#warn()+, +#error()+, and +#fatal()+.
18
+ Logger = Types.Interface(
19
+ :debug, :info, :warn, :error, :fatal
20
+ )
19
21
 
20
22
  ##
21
23
  # Check Discord response headers.
@@ -6,6 +6,6 @@ module LibDiscord
6
6
  #
7
7
  # @api private
8
8
  def self.version
9
- @version ||= Gem::Version.new("0.1.1")
9
+ @version ||= Gem::Version.new("0.1.2")
10
10
  end
11
11
  end
data/lib/lib_discord.rb CHANGED
@@ -4,5 +4,5 @@
4
4
  # Module to namespace all LibDiscord classes, constants, types, etc.
5
5
  module LibDiscord; end
6
6
 
7
- require "lib_discord/mappers"
8
7
  require "lib_discord/client"
8
+ require "lib_discord/mappers"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lib_discord
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Price
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-24 00:00:00.000000000 Z
11
+ date: 2024-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-container
@@ -170,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
170
170
  - !ruby/object:Gem::Version
171
171
  version: '0'
172
172
  requirements: []
173
- rubygems_version: 3.5.8
173
+ rubygems_version: 3.5.10
174
174
  signing_key:
175
175
  specification_version: 4
176
176
  summary: Unfancy Discord API Ruby-bindings