logsnag-ruby 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2eb210e03e0edf0515ee3f9c44863c2b41d4e8120b153bd2d11f70687088785f
4
- data.tar.gz: d3ab2983435c75534214bf18f23ffee40e8a6aedae82c95f67d482931ef32ff7
3
+ metadata.gz: '08a757173a28ae4dd7526530a3d556a550f063f6f7abb15b14c582e041a08221'
4
+ data.tar.gz: 8a71ba4b2441402bf93e3a34b05479a7812cf2887e9ae448c5a6603fa62c9a77
5
5
  SHA512:
6
- metadata.gz: adf67775a738012d6bf4819c5022d4adcc5402c5b6e1eb00f2416eaae28624ed8b68b3b1fd26925bf22c8386515c4ca9b49ff1abade0843d81a636e2a0ef2c89
7
- data.tar.gz: 4f76c037c1f733bb3b546579933997fca4758604688df5235d8d4740c9f60540631930647e1ee40b50e4d00f90dca5201e78bd7efca5a701b5f4134fb7c2abb5
6
+ metadata.gz: defcc554de6957ed3f791011499ea275036b0e0a58c59b847357da3a02f1385f5bf1c491a714fb1eb5785f04be3e0eeb9d64cf2fa2ec9c58fb7205793d8200f9
7
+ data.tar.gz: ce7477ca23df46a57ea92cbc7991d455a7153f87071d67904b84ae3192e27dadfef88b971a37c41e4b89755a138966ca33bfd9f7bbfd7e16e00df1e0a19e8339
data/.rubocop.yml CHANGED
@@ -6,7 +6,7 @@ AllCops:
6
6
  SuggestExtensions: false
7
7
  TargetRubyVersion: 2.6
8
8
 
9
- GemSpec/RequireMFA:
9
+ Gemspec/RequireMFA:
10
10
  Enabled: false
11
11
 
12
12
  Layout/LineLength:
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.0](https://github.com/damonbauer/logsnag-ruby/compare/v0.1.2...v0.2.0) (2026-04-01)
4
+
5
+
6
+ ### Features
7
+
8
+ * add enabled option to disable event sending ([2614f09](https://github.com/damonbauer/logsnag-ruby/commit/2614f093f28a6f228e1afe788e5c4713b2b7216b)), closes [#20](https://github.com/damonbauer/logsnag-ruby/issues/20)
9
+
3
10
  ## [0.1.2](https://github.com/damonbauer/logsnag-ruby/compare/v0.1.1...v0.1.2) (2026-03-17)
4
11
 
5
12
 
@@ -5,6 +5,14 @@ module LogSnag
5
5
  class Configuration
6
6
  attr_accessor :logger
7
7
  attr_reader :api_token, :project
8
+ attr_writer :enabled
9
+
10
+ def enabled
11
+ return @enabled unless @enabled.nil?
12
+ return false if ENV["LOGSNAG_ENABLED"]&.downcase == "false"
13
+
14
+ true
15
+ end
8
16
 
9
17
  def api_token=(token)
10
18
  raise ArgumentError, "API token cannot be nil" if token.nil? || token.empty?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LogSnag
4
- VERSION = "0.1.2"
4
+ VERSION = "0.2.0"
5
5
  end
data/lib/logsnag.rb CHANGED
@@ -117,6 +117,8 @@ module LogSnag
117
117
  # @param body [LogSnag::Log,LogSnag::Identify,LogSnag::Insight] The body of the request.
118
118
  # @return [LogSnag::Result] The formatted result from the request.
119
119
  def execute_post(path, body)
120
+ return Result.new(success: true, data: nil, status_code: nil, error_message: nil) unless config.enabled
121
+
120
122
  response = post(
121
123
  path,
122
124
  body: body.to_json,
@@ -133,6 +135,8 @@ module LogSnag
133
135
  # @param body [LogSnag::Insight] The body of the request.
134
136
  # @return [LogSnag::Result] The formatted result from the request.
135
137
  def execute_patch(path, body)
138
+ return Result.new(success: true, data: nil, status_code: nil, error_message: nil) unless config.enabled
139
+
136
140
  response = patch(
137
141
  path,
138
142
  body: {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logsnag-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Damon Bauer
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-03-17 00:00:00.000000000 Z
11
+ date: 2026-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty