rock_rms 9.4.0 → 9.5.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: 00e545d57a7d7a7e938e4ae3a4d970d9e064f24eff3cc3758d14dde42721f5a5
4
- data.tar.gz: 2a8d4cba35f6e596e36234eed56c7623d90b1ebca0dc8ab0c68c7dbe60c9e99b
3
+ metadata.gz: 290a1e9489236ab8bf4d3b938d118abec555927314236ca96022f335d35f5a46
4
+ data.tar.gz: 35d09f4b4b6bf271600e751d6d65d5953d8dfdcfcabd2000fbfe656cfd69cdf6
5
5
  SHA512:
6
- metadata.gz: 784bebf22ee911423278d8cf61b3edfa85d72847f4dc382e766dfe670f2d92581beb45a3d90e8eff5a8ac3d3f291c8f2c9fd154f1523354188a25ede77a786b7
7
- data.tar.gz: e2fb4f706393c503724e687076edb6794ec6e56fa9488512438697ba41680ccea7859ae2f9129292fd4e0e68ea990e6d11827d9c4d6bbe684dcd88b71ce88e3d
6
+ metadata.gz: c3d8a12350735b09eb5054a5316de7d178d01f15105efae76c5230ba98507c3534ea711df2e70693a79adafb6a04a034ac49ec01b968344359975b1c3c4ead98
7
+ data.tar.gz: c3bd70d6d4fd2e36e87a507da5d0010b15ab9dff36dc3831f9fa0841183e3a448f020f3913fb7f92b3bb1190c087f63400ec6f269111ce95471d8f0fcaac1178
@@ -46,17 +46,23 @@ module FaradayMiddleware
46
46
  private
47
47
 
48
48
  def html_body?(body)
49
- body.lstrip.start_with?('<!DOCTYPE html>')
49
+ /(<!DOCTYPE html>)|(<html>)/ =~ body
50
50
  end
51
51
 
52
52
  def check_html_error(env)
53
53
  return unless html_body?(env[:body])
54
54
 
55
- return unless /An error has occurred while processing your request/ =~ env[:body]
55
+ if /An error has occurred while processing your request/ =~ env[:body]
56
+ raise RockRMS::InternalServerError, error_message(
57
+ status: 500, url: env[:url], body: 'Unknown API error.'
58
+ )
59
+ end
56
60
 
57
- raise RockRMS::InternalServerError, error_message(
58
- status: 500, url: env[:url], body: 'Unknown API error.'
59
- )
61
+ if /Page Not Found/ =~ env[:body]
62
+ raise RockRMS::NotFound, error_message(
63
+ status: 404, url: env[:url], body: 'Page not found.'
64
+ )
65
+ end
60
66
  end
61
67
 
62
68
  def error_message(env)
@@ -15,7 +15,7 @@ module FaradayMiddleware
15
15
  private
16
16
 
17
17
  def html_body?(body)
18
- body.start_with?('<!DOCTYPE html>')
18
+ /(<!DOCTYPE html>)|(<html>)/ =~ body
19
19
  end
20
20
 
21
21
  def empty_body?(body)
@@ -1,3 +1,3 @@
1
1
  module RockRMS
2
- VERSION = '9.4.0'.freeze
2
+ VERSION = '9.5.0'.freeze
3
3
  end
@@ -75,10 +75,16 @@ RSpec.describe RockRMS::Error do
75
75
  end
76
76
 
77
77
  context 'html error responses' do
78
- it 'raises exception for html error' do
79
- body = File.read('spec/rock_rms/fixtures/html_error.html')
78
+ it 'raises exception for internal error' do
79
+ body = File.read('spec/rock_rms/fixtures/internal_error.html')
80
80
  stub(200, body)
81
81
  expect_failure(500, 'Unknown API error.')
82
82
  end
83
+
84
+ it 'raises exception for not found error' do
85
+ body = File.read('spec/rock_rms/fixtures/not_found_error.html')
86
+ stub(200, body)
87
+ expect_failure(404, 'Page not found.')
88
+ end
83
89
  end
84
90
  end
@@ -0,0 +1,79 @@
1
+ <html>
2
+ <head>
3
+ <title>Object moved</title>
4
+ </head>
5
+ <body>
6
+ <h2>Object moved to <a href="/page/123">here</a>.</h2>
7
+ </body>
8
+ </html>
9
+
10
+ <!DOCTYPE html>
11
+
12
+ <html xmlns="http://www.w3.org/1999/xhtml">
13
+ <head>
14
+ <title>Rock - Page Not Found</title>
15
+
16
+ <link rel="stylesheet" href="/Themes/Rock/Styles/bootstrap.css" />
17
+ <link rel="stylesheet" href="/Themes/Rock/Styles/theme.css" />
18
+
19
+ <!-- Icons -->
20
+ <link rel="shortcut icon" href="/Assets/Icons/favicon.ico" />
21
+ <link
22
+ rel="apple-touch-icon-precomposed"
23
+ sizes="144x144"
24
+ href="/Assets/Icons/touch-icon-ipad-retina.png"
25
+ />
26
+ <link
27
+ rel="apple-touch-icon-precomposed"
28
+ sizes="114x114"
29
+ href="/Assets/Icons/touch-icon-iphone-retina.png"
30
+ />
31
+ <link
32
+ rel="apple-touch-icon-precomposed"
33
+ sizes="72x72"
34
+ href="/Assets/Icons/touch-icon-ipad.png"
35
+ />
36
+ <link
37
+ rel="apple-touch-icon-precomposed"
38
+ href="/Assets/Icons/touch-icon-iphone.png"
39
+ />
40
+
41
+ <script src="/Scripts/Bundles/RockJQueryLatest?v=RWC4egkRBNjCo9_aBrw2jUeb13vsJBPHaIryUym02aM1"></script>
42
+ </head>
43
+ <body id="splash" class="error">
44
+ <form method="post" action="/" id="form1">
45
+ <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="" />
46
+
47
+ <input
48
+ type="hidden"
49
+ name="__VIEWSTATEGENERATOR"
50
+ id="__VIEWSTATEGENERATOR"
51
+ value=""
52
+ />
53
+
54
+ <div id="content">
55
+ <div id="logo"></div>
56
+
57
+ <div id="content-box">
58
+ <div class="row">
59
+ <div class="col-md-12">
60
+ <div class="error-wrap">
61
+ <h1>We Can't Find That Page</h1>
62
+
63
+ <p class="error-icon info">
64
+ <i class="fa fa-question-circle"></i>
65
+ </p>
66
+
67
+ <p>
68
+ Sorry, but the page you are looking for can not be found.
69
+ Check the address of the page and see your administrator if
70
+ you still need assistance.
71
+ </p>
72
+ </div>
73
+ </div>
74
+ </div>
75
+ </div>
76
+ </div>
77
+ </form>
78
+ </body>
79
+ </html>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rock_rms
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.4.0
4
+ version: 9.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taylor Brooks
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-20 00:00:00.000000000 Z
11
+ date: 2024-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -265,7 +265,8 @@ files:
265
265
  - rock_rms.gemspec
266
266
  - spec/rock_rms/client_spec.rb
267
267
  - spec/rock_rms/error_spec.rb
268
- - spec/rock_rms/fixtures/html_error.html
268
+ - spec/rock_rms/fixtures/internal_error.html
269
+ - spec/rock_rms/fixtures/not_found_error.html
269
270
  - spec/rock_rms/resources/attribute_spec.rb
270
271
  - spec/rock_rms/resources/attribute_values_spec.rb
271
272
  - spec/rock_rms/resources/batch_spec.rb