pliny 1.1.0 → 1.3.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: 0737c4e1c61ecef9881625ff6bb0d2afeacc63977f239b7e2562d4aec3c3609a
4
- data.tar.gz: f8db4293037c673ff3e33e025c75e86664f19cd207f3e36a2934e47eb981e942
3
+ metadata.gz: 251c0162450bf5e3ec77d7d3328d98cfb95c5c2b5350dc0a45da0ed67f5a7480
4
+ data.tar.gz: 78f0fba0ae08d2c57c7b5ec66701a2fecb01017ee7f8708cd6c85bf9e07bb6b5
5
5
  SHA512:
6
- metadata.gz: bad71b767121811048ca67857644d74d6b7e565461e96cc6f52fa3b8207a41cb6f5fa8b4d32d14fc49894709a7959c55ddd7a6c8972f1555f6d5b6108c160978
7
- data.tar.gz: d0e2adac5319670b3c12344f6b4d40a989e74770f4ffdbffdbf7082941ed7f2590802babf478966a63c475638f4736961855a449cf9629779baf696f98f2eb28
6
+ metadata.gz: bc7ebe625e643356c66ea27a0f90e60c47ab726962f5391cc3b40ba13455fd70623566431d4e195a093d1481d610085a98521c6dca1781d62fc7867113eded8d
7
+ data.tar.gz: 41ceaae8f87a12916eca172429b023010a0d8d415cfc2d6e0ed7f87a3e9788764ee8670c1765b6e164eaca363f3b882fe723b98e0ab22ba2c8e7401d69cbaba5
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pliny
4
+ module ErrorReporters
5
+ class Sentry
6
+ def notify(exception, context:, rack_env:)
7
+ ::Sentry.with_scope do |scope|
8
+ configure_scope(scope, context: context, rack_env: rack_env)
9
+ ::Sentry.capture_exception(exception)
10
+ end
11
+ rescue Exception => e # rubocop:disable Lint/RescueException
12
+ ::Sentry.capture_exception(e)
13
+ raise
14
+ end
15
+
16
+ private
17
+
18
+ def configure_scope(scope, context:, rack_env:)
19
+ scope.set_context("custom", context)
20
+
21
+ begin
22
+ person_data = extract_person_data_from_controller(rack_env)
23
+ if person_data && !person_data.empty?
24
+ scope.set_user(
25
+ id: person_data[:id],
26
+ email: person_data[:email],
27
+ username: person_data[:username],
28
+ )
29
+ end
30
+ rescue => e
31
+ ::Sentry.capture_exception(e)
32
+ end
33
+ end
34
+
35
+ def extract_person_data_from_controller(env)
36
+ env["sentry.person_data"] || {}
37
+ end
38
+ end
39
+ end
40
+ end
data/lib/pliny/errors.rb CHANGED
@@ -6,7 +6,7 @@ module Pliny
6
6
  def self.render(error)
7
7
  headers = { "content-type" => "application/json; charset=utf-8" }
8
8
  data = { id: error.id, message: error.message }
9
- [error.status, headers, [MultiJson.encode(data)]]
9
+ [error.status, headers, [JSON.generate(data)]]
10
10
  end
11
11
 
12
12
  def initialize(message, id)
@@ -2,7 +2,11 @@ module Pliny::Helpers
2
2
  module Encode
3
3
  def encode(object)
4
4
  content_type :json, charset: 'utf-8'
5
- MultiJson.encode(object, pretty: params[:pretty] == 'true' || Config.pretty_json)
5
+ if params[:pretty] == 'true' || Config.pretty_json
6
+ JSON.pretty_generate(object)
7
+ else
8
+ JSON.generate(object)
9
+ end
6
10
  end
7
11
  end
8
12
  end
@@ -9,8 +9,8 @@ module Pliny::Helpers
9
9
  def parse_body_params
10
10
  if request.media_type == "application/json"
11
11
  begin
12
- decoded = MultiJson.decode(request.body.read)
13
- rescue MultiJson::ParseError => e
12
+ decoded = JSON.parse(request.body.read)
13
+ rescue JSON::ParserError => e
14
14
  raise Pliny::Errors::BadRequest, e.message
15
15
  end
16
16
  request.body.rewind
@@ -27,7 +27,7 @@ module Pliny::Middleware
27
27
  Please specify a version along with the MIME type. For example, `Accept: application/vnd.#{@app_name}+json; version=1`.
28
28
  eos
29
29
  return [400, { "content-type" => "application/json; charset=utf-8" },
30
- [MultiJson.encode(error)]]
30
+ [JSON.generate(error)]]
31
31
  end
32
32
 
33
33
  unless version
@@ -23,7 +23,7 @@ RSpec.describe Endpoints::<%= plural_class_name %> do
23
23
  describe 'POST <%= url_path %>' do
24
24
  it 'returns correct status code and conforms to schema' do
25
25
  header "Content-Type", "application/json"
26
- post '<%= url_path %>', MultiJson.encode({})
26
+ post '<%= url_path %>', JSON.generate({})
27
27
  assert_equal 201, last_response.status
28
28
  assert_schema_conform
29
29
  end
@@ -40,7 +40,7 @@ RSpec.describe Endpoints::<%= plural_class_name %> do
40
40
  describe 'PATCH <%= url_path %>/:id' do
41
41
  it 'returns correct status code and conforms to schema' do
42
42
  header "Content-Type", "application/json"
43
- patch '<%= url_path %>/123', MultiJson.encode({})
43
+ patch '<%= url_path %>/123', JSON.generate({})
44
44
  assert_equal 200, last_response.status
45
45
  assert_schema_conform
46
46
  end
@@ -32,7 +32,7 @@ RSpec.describe Endpoints::<%= plural_class_name %> do
32
32
  describe 'POST <%= url_path %>' do
33
33
  it 'returns correct status code and conforms to schema' do
34
34
  header "Content-Type", "application/json"
35
- post '<%= url_path %>', MultiJson.encode({})
35
+ post '<%= url_path %>', JSON.generate({})
36
36
  assert_equal 201, last_response.status
37
37
  assert_schema_conform
38
38
  end
@@ -50,7 +50,7 @@ RSpec.describe Endpoints::<%= plural_class_name %> do
50
50
  describe 'PATCH <%= url_path %>/:id' do
51
51
  it 'returns correct status code and conforms to schema' do
52
52
  header "Content-Type", "application/json"
53
- patch "<%= url_path %>/#{@<%= field_name %>.id}", MultiJson.encode({})
53
+ patch "<%= url_path %>/#{@<%= field_name %>.id}", JSON.generate({})
54
54
  assert_equal 200, last_response.status
55
55
  assert_schema_conform
56
56
  end
data/lib/pliny/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pliny
2
- VERSION = "1.1.0"
2
+ VERSION = "1.3.0"
3
3
  end
data/lib/pliny.rb CHANGED
@@ -1,4 +1,4 @@
1
- require "multi_json"
1
+ require "json"
2
2
  require "sinatra/base"
3
3
 
4
4
  require_relative "pliny/version"
data/lib/template/Gemfile CHANGED
@@ -1,8 +1,6 @@
1
1
  source "https://rubygems.org"
2
2
  ruby "2.4.0"
3
3
 
4
- gem "multi_json"
5
- gem "oj"
6
4
  gem "pg"
7
5
  gem "pliny", "~> 0.32"
8
6
  gem "pry"
@@ -11,6 +9,7 @@ gem "rack-ssl"
11
9
  gem "rack-timeout", "~> 0.6"
12
10
  gem "rake"
13
11
  gem "rollbar"
12
+ gem "sentry-ruby"
14
13
  gem "sequel", "~> 5.73"
15
14
  gem "sequel-paranoid"
16
15
  gem "sequel_pg", "~> 1.17", require: "sequel"
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "pliny/error_reporters/sentry"
4
+
5
+ Pliny::ErrorReporters.error_reporters << Pliny::ErrorReporters::Sentry
6
+
7
+ Sentry.init do |config|
8
+ config.dsn = ENV["SENTRY_DSN"]
9
+ config.environment = ENV["SENTRY_ENV"] || ENV["RACK_ENV"]
10
+ config.enabled_environments = ENV["SENTRY_ENABLED_ENVIRONMENTS"]&.split(",") || %w[production staging]
11
+ config.traces_sample_rate = ENV["SENTRY_TRACES_SAMPLE_RATE"]&.to_f || 0.1
12
+ end
13
+
14
+ Pliny.use Sentry::Rack::CaptureExceptions
@@ -13,7 +13,7 @@ RSpec.describe Endpoints::Health do
13
13
  assert_equal(200, last_response.status)
14
14
  assert_equal("application/json;charset=utf-8", last_response.headers["Content-Type"])
15
15
  assert_equal(2, last_response.headers["Content-Length"].to_i)
16
- assert_equal({}, MultiJson.decode(last_response.body))
16
+ assert_equal({}, JSON.parse(last_response.body))
17
17
  end
18
18
  end
19
19
 
@@ -49,7 +49,7 @@ RSpec.describe Endpoints::Health do
49
49
  assert_equal(200, last_response.status)
50
50
  assert_equal("application/json;charset=utf-8", last_response.headers["Content-Type"])
51
51
  assert_equal(2, last_response.headers["Content-Length"].to_i)
52
- assert_equal({}, MultiJson.decode(last_response.body))
52
+ assert_equal({}, JSON.parse(last_response.body))
53
53
  end
54
54
  end
55
55
  end
@@ -26,31 +26,31 @@ describe Pliny::Commands::Generator::Endpoint do
26
26
  it "defines a stub GET /" do
27
27
  get "/artists"
28
28
  assert_equal 200, last_response.status
29
- assert_equal [], MultiJson.decode(last_response.body)
29
+ assert_equal [], JSON.parse(last_response.body)
30
30
  end
31
31
 
32
32
  it "defines a stub POST /" do
33
33
  post "/artists"
34
34
  assert_equal 201, last_response.status
35
- assert_equal Hash.new, MultiJson.decode(last_response.body)
35
+ assert_equal Hash.new, JSON.parse(last_response.body)
36
36
  end
37
37
 
38
38
  it "defines a stub GET /:id" do
39
39
  get "/artists/123"
40
40
  assert_equal 200, last_response.status
41
- assert_equal Hash.new, MultiJson.decode(last_response.body)
41
+ assert_equal Hash.new, JSON.parse(last_response.body)
42
42
  end
43
43
 
44
44
  it "defines a stub PATCH /:id" do
45
45
  patch "/artists/123"
46
46
  assert_equal 200, last_response.status
47
- assert_equal Hash.new, MultiJson.decode(last_response.body)
47
+ assert_equal Hash.new, JSON.parse(last_response.body)
48
48
  end
49
49
 
50
50
  it "defines a stub DELETE /:id" do
51
51
  delete "/artists/123"
52
52
  assert_equal 200, last_response.status
53
- assert_equal Hash.new, MultiJson.decode(last_response.body)
53
+ assert_equal Hash.new, JSON.parse(last_response.body)
54
54
  end
55
55
 
56
56
  end
@@ -0,0 +1,83 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "spec_helper"
4
+ require "sentry-ruby"
5
+ require "pliny/error_reporters/sentry"
6
+
7
+ describe Pliny::ErrorReporters::Sentry do
8
+ subject(:reporter) { described_class.new }
9
+
10
+ describe "#notify" do
11
+ let(:exception) { StandardError.new("Something went wrong") }
12
+ let(:context) { { step: :foo } }
13
+ let(:rack_env) { { "rack.input" => StringIO.new } }
14
+
15
+ subject(:notify) do
16
+ reporter.notify(exception, context: context, rack_env: rack_env)
17
+ end
18
+
19
+ before do
20
+ allow(::Sentry).to receive(:with_scope).and_yield(scope)
21
+ allow(::Sentry).to receive(:capture_exception)
22
+ end
23
+
24
+ let(:scope) { instance_double("Sentry::Scope") }
25
+
26
+ before do
27
+ allow(scope).to receive(:set_context)
28
+ allow(scope).to receive(:set_user)
29
+ end
30
+
31
+ it "creates a sentry scope" do
32
+ notify
33
+ expect(::Sentry).to have_received(:with_scope).once
34
+ end
35
+
36
+ it "sets custom context" do
37
+ notify
38
+ expect(scope).to have_received(:set_context).with("custom", { step: :foo })
39
+ end
40
+
41
+ it "captures the exception" do
42
+ notify
43
+ expect(::Sentry).to have_received(:capture_exception).with(exception)
44
+ end
45
+
46
+ context "given a rack_env with sentry.person_data" do
47
+ let(:rack_env) { { "sentry.person_data" => { id: 123, email: "test@example.com", username: "testuser" }, "rack.input" => StringIO.new } }
48
+
49
+ it "sets user context from sentry.person_data" do
50
+ notify
51
+ expect(scope).to have_received(:set_user).with(id: 123, email: "test@example.com", username: "testuser")
52
+ end
53
+ end
54
+
55
+ context "given a rack_env with empty sentry.person_data" do
56
+ let(:rack_env) { { "sentry.person_data" => {}, "rack.input" => StringIO.new } }
57
+
58
+ it "does not set user context" do
59
+ notify
60
+ expect(scope).not_to have_received(:set_user)
61
+ end
62
+ end
63
+
64
+ context "given an empty rack_env" do
65
+ let(:rack_env) { {} }
66
+
67
+ it "expects rack_env to be a hash" do
68
+ assert_kind_of(Hash, rack_env)
69
+ end
70
+
71
+ it "sets only custom context" do
72
+ notify
73
+ expect(scope).to have_received(:set_context).once.with("custom", { step: :foo })
74
+ expect(scope).not_to have_received(:set_user)
75
+ end
76
+
77
+ it "captures the exception" do
78
+ notify
79
+ expect(::Sentry).to have_received(:capture_exception).with(exception)
80
+ end
81
+ end
82
+ end
83
+ end
@@ -23,19 +23,19 @@ describe Pliny::Helpers::Encode do
23
23
  it "encodes as json" do
24
24
  payload = { "foo" => "bar" }
25
25
  post "/", payload
26
- assert_equal MultiJson.encode(payload), last_response.body
26
+ assert_equal JSON.generate(payload), last_response.body
27
27
  end
28
28
 
29
29
  it "encodes in pretty mode when pretty=true" do
30
30
  payload = { "foo" => "bar", "pretty" => "true" }
31
31
  post "/", payload
32
- assert_equal MultiJson.encode(payload, pretty: true), last_response.body
32
+ assert_equal JSON.pretty_generate(payload), last_response.body
33
33
  end
34
34
 
35
35
  it "encodes in pretty mode when set by config" do
36
36
  allow(Config).to receive(:pretty_json) { true }
37
37
  payload = { "foo" => "bar" }
38
38
  post "/", payload
39
- assert_equal MultiJson.encode(payload, pretty: true), last_response.body
39
+ assert_equal JSON.pretty_generate(payload), last_response.body
40
40
  end
41
41
  end
@@ -7,7 +7,7 @@ describe Pliny::Helpers::Serialize do
7
7
  register Pliny::Helpers::Serialize
8
8
 
9
9
  get "/" do
10
- MultiJson.encode(serialize([]))
10
+ JSON.generate(serialize([]))
11
11
  end
12
12
  end
13
13
  end
@@ -34,11 +34,11 @@ describe Pliny::Helpers::Serialize do
34
34
  serializer Serializer
35
35
 
36
36
  get "/" do
37
- MultiJson.encode(serialize([]))
37
+ JSON.generate(serialize([]))
38
38
  end
39
39
 
40
40
  get "/env" do
41
- MultiJson.encode(serialize(env))
41
+ JSON.generate(serialize(env))
42
42
  end
43
43
  end
44
44
  end
@@ -46,13 +46,13 @@ describe Pliny::Helpers::Serialize do
46
46
  it "encodes as json" do
47
47
  get "/"
48
48
  assert_equal 200, last_response.status
49
- assert_equal MultiJson.encode([]), last_response.body
49
+ assert_equal JSON.generate([]), last_response.body
50
50
  end
51
51
 
52
52
  it "emits information for canonical log lines" do
53
53
  get "/env"
54
54
  assert_equal 200, last_response.status
55
- body = MultiJson.decode(last_response.body)
55
+ body = JSON.parse(last_response.body)
56
56
  assert body["pliny.serializer_arity"] > 1
57
57
  assert body["pliny.serializer_timing"] > 0
58
58
  end
@@ -21,7 +21,7 @@ describe Pliny::Middleware::RescueErrors do
21
21
  @app = new_rack_app
22
22
  get "/api-error"
23
23
  assert_equal 503, last_response.status
24
- error_json = MultiJson.decode(last_response.body)
24
+ error_json = JSON.parse(last_response.body)
25
25
  assert_equal "service_unavailable", error_json["id"]
26
26
  assert_equal "Service unavailable.", error_json["message"]
27
27
  end
@@ -31,7 +31,7 @@ describe Pliny::Middleware::RescueErrors do
31
31
  expect(Pliny::ErrorReporters).to receive(:notify)
32
32
  get "/"
33
33
  assert_equal 500, last_response.status
34
- error_json = MultiJson.decode(last_response.body)
34
+ error_json = JSON.parse(last_response.body)
35
35
  assert_equal "internal_server_error", error_json["id"]
36
36
  assert_equal "Internal server error.", error_json["message"]
37
37
  end
@@ -48,7 +48,7 @@ describe Pliny::Middleware::RescueErrors do
48
48
  allow(Pliny::ErrorReporters).to receive(:notify)
49
49
  get "/"
50
50
  assert_equal 500, last_response.status
51
- error_json = MultiJson.decode(last_response.body)
51
+ error_json = JSON.parse(last_response.body)
52
52
  assert_equal "internal_server_error", error_json["id"]
53
53
  assert_equal "Please stand by", error_json["message"]
54
54
  end
@@ -13,7 +13,7 @@ describe Pliny::Middleware::Versioning do
13
13
  use Pliny::Middleware::Versioning, default: '2', app_name: 'pliny'
14
14
  run Sinatra.new {
15
15
  get "/" do
16
- MultiJson.encode env
16
+ JSON.generate env
17
17
  end
18
18
  }
19
19
  end
@@ -21,7 +21,7 @@ describe Pliny::Middleware::Versioning do
21
21
 
22
22
  it "produces default version on application/json" do
23
23
  get '/', {}, {'HTTP_ACCEPT' => 'application/json'}
24
- json = MultiJson.decode(last_response.body)
24
+ json = JSON.parse(last_response.body)
25
25
  assert_equal 'application/json', json['HTTP_ACCEPT']
26
26
  assert_equal '2', json['HTTP_X_API_VERSION']
27
27
  end
@@ -33,19 +33,19 @@ Please specify a version along with the MIME type. For example, `Accept: applica
33
33
  eos
34
34
 
35
35
  assert_equal 400, last_response.status
36
- assert_equal MultiJson.encode(error), last_response.body
36
+ assert_equal JSON.generate(error), last_response.body
37
37
  end
38
38
 
39
39
  it "ignores a wrong app name" do
40
40
  get '/', {}, {'HTTP_ACCEPT' => 'application/vnd.chuck_norris+json'}
41
- json = MultiJson.decode(last_response.body)
41
+ json = JSON.parse(last_response.body)
42
42
  assert_equal 'application/vnd.chuck_norris+json', json['HTTP_ACCEPT']
43
43
  assert_equal '2', json['HTTP_X_API_VERSION']
44
44
  end
45
45
 
46
46
  it "produces a version on application/vnd.pliny+json; version=3" do
47
47
  get '/', {}, {'HTTP_ACCEPT' => 'application/vnd.pliny+json; version=3'}
48
- json = MultiJson.decode(last_response.body)
48
+ json = JSON.parse(last_response.body)
49
49
  assert_equal 'application/json', json['HTTP_ACCEPT']
50
50
  assert_equal '3', json['HTTP_X_API_VERSION']
51
51
  end
@@ -53,14 +53,14 @@ Please specify a version along with the MIME type. For example, `Accept: applica
53
53
  # this behavior is pretty sketchy, but a pretty extreme edge case
54
54
  it "handles multiple MIME types" do
55
55
  get '/', {}, {'HTTP_ACCEPT' => 'application/vnd.pliny+json; version=3; q=0.5, text/xml'}
56
- json = MultiJson.decode(last_response.body)
56
+ json = JSON.parse(last_response.body)
57
57
  assert_equal 'text/xml, application/json; q=0.5', json['HTTP_ACCEPT']
58
58
  assert_equal '3', json['HTTP_X_API_VERSION']
59
59
  end
60
60
 
61
61
  it "produces the priority version on multiple types" do
62
62
  get '/', {}, {'HTTP_ACCEPT' => 'application/vnd.pliny+json; version=4; q=0.5, application/vnd.pliny+json; version=3'}
63
- json = MultiJson.decode(last_response.body)
63
+ json = JSON.parse(last_response.body)
64
64
  assert_equal 'application/json, application/json; q=0.5', json['HTTP_ACCEPT']
65
65
  assert_equal '3', json['HTTP_X_API_VERSION']
66
66
  end
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pliny
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandur Leach
8
8
  - Pedro Belo
9
- autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2024-02-13 00:00:00.000000000 Z
11
+ date: 1980-01-02 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: activesupport
@@ -17,40 +16,20 @@ dependencies:
17
16
  requirements:
18
17
  - - ">="
19
18
  - !ruby/object:Gem::Version
20
- version: '6.0'
19
+ version: '7.0'
21
20
  - - "<"
22
21
  - !ruby/object:Gem::Version
23
- version: '8.0'
22
+ version: '9.0'
24
23
  type: :runtime
25
24
  prerelease: false
26
25
  version_requirements: !ruby/object:Gem::Requirement
27
26
  requirements:
28
27
  - - ">="
29
28
  - !ruby/object:Gem::Version
30
- version: '6.0'
29
+ version: '7.0'
31
30
  - - "<"
32
31
  - !ruby/object:Gem::Version
33
- version: '8.0'
34
- - !ruby/object:Gem::Dependency
35
- name: multi_json
36
- requirement: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '1.9'
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- version: 1.9.3
44
- type: :runtime
45
- prerelease: false
46
- version_requirements: !ruby/object:Gem::Requirement
47
- requirements:
48
- - - "~>"
49
- - !ruby/object:Gem::Version
50
- version: '1.9'
51
- - - ">="
52
- - !ruby/object:Gem::Version
53
- version: 1.9.3
32
+ version: '9.0'
54
33
  - !ruby/object:Gem::Dependency
55
34
  name: prmd
56
35
  requirement: !ruby/object:Gem::Requirement
@@ -152,95 +131,77 @@ dependencies:
152
131
  - !ruby/object:Gem::Version
153
132
  version: '2.0'
154
133
  - !ruby/object:Gem::Dependency
155
- name: rake
134
+ name: pry
156
135
  requirement: !ruby/object:Gem::Requirement
157
136
  requirements:
158
- - - "~>"
137
+ - - ">="
159
138
  - !ruby/object:Gem::Version
160
- version: '13.0'
139
+ version: '0'
161
140
  type: :development
162
141
  prerelease: false
163
142
  version_requirements: !ruby/object:Gem::Requirement
164
143
  requirements:
165
- - - "~>"
144
+ - - ">="
166
145
  - !ruby/object:Gem::Version
167
- version: '13.0'
146
+ version: '0'
168
147
  - !ruby/object:Gem::Dependency
169
- name: rack-test
148
+ name: pry-byebug
170
149
  requirement: !ruby/object:Gem::Requirement
171
150
  requirements:
172
- - - "~>"
151
+ - - ">="
173
152
  - !ruby/object:Gem::Version
174
- version: '2'
153
+ version: '0'
175
154
  type: :development
176
155
  prerelease: false
177
156
  version_requirements: !ruby/object:Gem::Requirement
178
157
  requirements:
179
- - - "~>"
158
+ - - ">="
180
159
  - !ruby/object:Gem::Version
181
- version: '2'
160
+ version: '0'
182
161
  - !ruby/object:Gem::Dependency
183
- name: rspec
162
+ name: rack-test
184
163
  requirement: !ruby/object:Gem::Requirement
185
164
  requirements:
186
- - - "~>"
187
- - !ruby/object:Gem::Version
188
- version: '3.1'
189
165
  - - ">="
190
166
  - !ruby/object:Gem::Version
191
- version: 3.1.0
167
+ version: '0'
192
168
  type: :development
193
169
  prerelease: false
194
170
  version_requirements: !ruby/object:Gem::Requirement
195
171
  requirements:
196
- - - "~>"
197
- - !ruby/object:Gem::Version
198
- version: '3.1'
199
172
  - - ">="
200
173
  - !ruby/object:Gem::Version
201
- version: 3.1.0
174
+ version: '0'
202
175
  - !ruby/object:Gem::Dependency
203
- name: sinatra-contrib
176
+ name: rake
204
177
  requirement: !ruby/object:Gem::Requirement
205
178
  requirements:
206
179
  - - ">="
207
180
  - !ruby/object:Gem::Version
208
- version: '2.0'
209
- - - "<"
210
- - !ruby/object:Gem::Version
211
- version: '5.0'
181
+ version: '0'
212
182
  type: :development
213
183
  prerelease: false
214
184
  version_requirements: !ruby/object:Gem::Requirement
215
185
  requirements:
216
186
  - - ">="
217
187
  - !ruby/object:Gem::Version
218
- version: '2.0'
219
- - - "<"
220
- - !ruby/object:Gem::Version
221
- version: '5.0'
188
+ version: '0'
222
189
  - !ruby/object:Gem::Dependency
223
- name: timecop
190
+ name: rollbar
224
191
  requirement: !ruby/object:Gem::Requirement
225
192
  requirements:
226
- - - "~>"
227
- - !ruby/object:Gem::Version
228
- version: '0.7'
229
193
  - - ">="
230
194
  - !ruby/object:Gem::Version
231
- version: 0.7.1
195
+ version: '0'
232
196
  type: :development
233
197
  prerelease: false
234
198
  version_requirements: !ruby/object:Gem::Requirement
235
199
  requirements:
236
- - - "~>"
237
- - !ruby/object:Gem::Version
238
- version: '0.7'
239
200
  - - ">="
240
201
  - !ruby/object:Gem::Version
241
- version: 0.7.1
202
+ version: '0'
242
203
  - !ruby/object:Gem::Dependency
243
- name: pry
204
+ name: rspec
244
205
  requirement: !ruby/object:Gem::Requirement
245
206
  requirements:
246
207
  - - ">="
@@ -254,7 +215,7 @@ dependencies:
254
215
  - !ruby/object:Gem::Version
255
216
  version: '0'
256
217
  - !ruby/object:Gem::Dependency
257
- name: pry-byebug
218
+ name: rubocop
258
219
  requirement: !ruby/object:Gem::Requirement
259
220
  requirements:
260
221
  - - ">="
@@ -268,79 +229,61 @@ dependencies:
268
229
  - !ruby/object:Gem::Version
269
230
  version: '0'
270
231
  - !ruby/object:Gem::Dependency
271
- name: pg
232
+ name: sentry-ruby
272
233
  requirement: !ruby/object:Gem::Requirement
273
234
  requirements:
274
- - - "~>"
275
- - !ruby/object:Gem::Version
276
- version: '1.0'
277
- - - "<"
235
+ - - ">="
278
236
  - !ruby/object:Gem::Version
279
- version: '2.0'
237
+ version: '0'
280
238
  type: :development
281
239
  prerelease: false
282
240
  version_requirements: !ruby/object:Gem::Requirement
283
241
  requirements:
284
- - - "~>"
285
- - !ruby/object:Gem::Version
286
- version: '1.0'
287
- - - "<"
242
+ - - ">="
288
243
  - !ruby/object:Gem::Version
289
- version: '2.0'
244
+ version: '0'
290
245
  - !ruby/object:Gem::Dependency
291
- name: rollbar
246
+ name: sequel
292
247
  requirement: !ruby/object:Gem::Requirement
293
248
  requirements:
294
- - - "~>"
249
+ - - ">="
295
250
  - !ruby/object:Gem::Version
296
- version: '3.2'
251
+ version: '0'
297
252
  type: :development
298
253
  prerelease: false
299
254
  version_requirements: !ruby/object:Gem::Requirement
300
255
  requirements:
301
- - - "~>"
256
+ - - ">="
302
257
  - !ruby/object:Gem::Version
303
- version: '3.2'
258
+ version: '0'
304
259
  - !ruby/object:Gem::Dependency
305
- name: sequel
260
+ name: sinatra-contrib
306
261
  requirement: !ruby/object:Gem::Requirement
307
262
  requirements:
308
- - - "~>"
309
- - !ruby/object:Gem::Version
310
- version: '5.4'
311
- - - "<"
263
+ - - ">="
312
264
  - !ruby/object:Gem::Version
313
- version: '6.0'
265
+ version: '0'
314
266
  type: :development
315
267
  prerelease: false
316
268
  version_requirements: !ruby/object:Gem::Requirement
317
269
  requirements:
318
- - - "~>"
319
- - !ruby/object:Gem::Version
320
- version: '5.4'
321
- - - "<"
270
+ - - ">="
322
271
  - !ruby/object:Gem::Version
323
- version: '6.0'
272
+ version: '0'
324
273
  - !ruby/object:Gem::Dependency
325
- name: rubocop
274
+ name: timecop
326
275
  requirement: !ruby/object:Gem::Requirement
327
276
  requirements:
328
- - - "~>"
329
- - !ruby/object:Gem::Version
330
- version: '0.52'
331
277
  - - ">="
332
278
  - !ruby/object:Gem::Version
333
- version: 0.52.1
279
+ version: '0'
334
280
  type: :development
335
281
  prerelease: false
336
282
  version_requirements: !ruby/object:Gem::Requirement
337
283
  requirements:
338
- - - "~>"
339
- - !ruby/object:Gem::Version
340
- version: '0.52'
341
284
  - - ">="
342
285
  - !ruby/object:Gem::Version
343
- version: 0.52.1
286
+ version: '0'
344
287
  description: Pliny is a set of base classes and helpers to help developers write excellent
345
288
  APIs in Sinatra
346
289
  email:
@@ -373,6 +316,7 @@ files:
373
316
  - lib/pliny/db_support.rb
374
317
  - lib/pliny/error_reporters.rb
375
318
  - lib/pliny/error_reporters/rollbar.rb
319
+ - lib/pliny/error_reporters/sentry.rb
376
320
  - lib/pliny/errors.rb
377
321
  - lib/pliny/helpers/encode.rb
378
322
  - lib/pliny/helpers/params.rb
@@ -431,7 +375,7 @@ files:
431
375
  - lib/template/config/initializers/database.rb
432
376
  - lib/template/config/initializers/log.rb
433
377
  - lib/template/config/initializers/metrics.rb
434
- - lib/template/config/initializers/rollbar.rb
378
+ - lib/template/config/initializers/sentry.rb
435
379
  - lib/template/config/puma.rb
436
380
  - lib/template/db/schema.sql
437
381
  - lib/template/db/seeds.rb
@@ -468,6 +412,7 @@ files:
468
412
  - spec/config_helpers_spec.rb
469
413
  - spec/db_support_spec.rb
470
414
  - spec/error_reporters/rollbar_spec.rb
415
+ - spec/error_reporters/sentry_spec.rb
471
416
  - spec/error_reporters_spec.rb
472
417
  - spec/errors_spec.rb
473
418
  - spec/helpers/encode_spec.rb
@@ -497,7 +442,6 @@ homepage: https://github.com/interagent/pliny
497
442
  licenses:
498
443
  - MIT
499
444
  metadata: {}
500
- post_install_message:
501
445
  rdoc_options: []
502
446
  require_paths:
503
447
  - lib
@@ -505,15 +449,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
505
449
  requirements:
506
450
  - - ">="
507
451
  - !ruby/object:Gem::Version
508
- version: '0'
452
+ version: '3.2'
509
453
  required_rubygems_version: !ruby/object:Gem::Requirement
510
454
  requirements:
511
455
  - - ">="
512
456
  - !ruby/object:Gem::Version
513
457
  version: '0'
514
458
  requirements: []
515
- rubygems_version: 3.5.3
516
- signing_key:
459
+ rubygems_version: 3.6.7
517
460
  specification_version: 4
518
461
  summary: Basic tooling to support API apps in Sinatra
519
462
  test_files: []
@@ -1,12 +0,0 @@
1
- require "pliny/error_reporters/rollbar"
2
-
3
- Pliny::ErrorReporters.error_reporters << Pliny::ErrorReporters::Rollbar
4
-
5
- Rollbar.configure do |config|
6
- config.enabled = ENV.key?("ROLLBAR_ACCESS_TOKEN")
7
- config.disable_rack_monkey_patch = true
8
- config.access_token = ENV["ROLLBAR_ACCESS_TOKEN"]
9
- config.environment = ENV["ROLLBAR_ENV"]
10
- config.logger = Pliny::RollbarLogger.new
11
- config.use_sucker_punch
12
- end