truenorth 0.2.5 → 0.2.6

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: 63c9a467b51f61d550f8c48a37109dbc647d5b599044beffc55333f0bade9e48
4
- data.tar.gz: 12211afbaf407921821f41c2cddcc9c9581ad9e6f8e1ffef20ef83a8ec6df91e
3
+ metadata.gz: 77aa3d893615956dc5dad5e8adc512bbdeb436aa99f6b04be100d246ca3d59f7
4
+ data.tar.gz: '0009efe2c7af6f8425018ebcbcf44b6d7c0295c83f08e90b00368358edd39205'
5
5
  SHA512:
6
- metadata.gz: 2c0538cf12be2ff1a20f5950206b381537683bf3e5cfe87ee9895e7fe677154bebbd636df6837ed3ad0a136018060f982f697d875d456e1402cc4ef4d57e161a
7
- data.tar.gz: 7874967a9ce9b6a7342e82ca8a5346dbd1fc0ccfe87a099dbeda0ac0201e9765ea9a8fbe3a36f8e9eff1eece1fb4ac12719f8ff5eb9777da2bef98560dfd7be4
6
+ metadata.gz: 53c557e2417576cfaf637ada5e8057e15ff6fda7db6cc898efb9b99d8620c0b09e15fd2dcf3a8dadb8c31fec3e038b0aa0c7db434bd7382532aea7970fba3f90
7
+ data.tar.gz: acc45f0794fb39ec448ba78abb8834568b0b8a050a91fd371fd55f1967a161bd1b2884f371329db24f1220454ddc00d9ecc7074ba48e42e5eae728741d97fed0
data/lib/truenorth/cli.rb CHANGED
@@ -145,8 +145,9 @@ module Truenorth
145
145
  desc 'cancel INDEX', 'Cancel a reservation by index (from reservations list)'
146
146
  option :dry_run, type: :boolean, aliases: '-n', desc: 'Test without actually canceling'
147
147
  option :all, type: :boolean, aliases: '-a', desc: 'Cancel from full list (use with --all view)'
148
+ option :debug, type: :boolean, desc: 'Show debug output'
148
149
  def cancel(index)
149
- client = Client.new
150
+ client = Client.new(debug: options[:debug])
150
151
 
151
152
  say 'Fetching reservations...', :cyan
152
153
  results = client.reservations
@@ -302,14 +302,46 @@ module Truenorth
302
302
  response = post_ajax(ajax_url, form_data)
303
303
 
304
304
  if response.is_a?(Net::HTTPSuccess)
305
- # Check for success indicators in response
306
305
  body = response.body
307
- if body.include?('success') || body.include?('cancel') || body.length < 1000
308
- log 'Cancellation successful'
306
+
307
+ # Log response for debugging
308
+ log "Response length: #{body.length}"
309
+ log "Response preview: #{body[0..500]}"
310
+
311
+ # Check for specific PrimeFaces success indicators
312
+ # Look for actual cancellation confirmation messages
313
+ success_indicators = [
314
+ /cancelled.*successfully/i,
315
+ /reservation.*cancelled/i,
316
+ /successfully.*cancelled/i,
317
+ /<update.*id=".*growl"/i # PrimeFaces growl messages usually indicate success/error
318
+ ]
319
+
320
+ # Check for error indicators
321
+ error_indicators = [
322
+ /error/i,
323
+ /failed/i,
324
+ /unable/i,
325
+ /cannot.*cancel/i
326
+ ]
327
+
328
+ has_error = error_indicators.any? { |pattern| body =~ pattern }
329
+ has_success = success_indicators.any? { |pattern| body =~ pattern }
330
+
331
+ if has_error
332
+ # Extract error message if present
333
+ error_msg = body[/error[^<]*|failed[^<]*/i] || 'Cancellation may have failed'
334
+ log "Error detected: #{error_msg}"
335
+ { success: false, error: error_msg }
336
+ elsif has_success || body.length < 500
337
+ # Very short response likely means success (no error message)
338
+ log 'Cancellation appears successful'
309
339
  { success: true, message: 'Reservation cancelled' }
310
340
  else
311
- log "Unexpected response: #{body[0..200]}"
312
- { success: false, error: 'Unexpected response from server' }
341
+ # Ambiguous - log full response for analysis
342
+ log "Ambiguous response (#{body.length} bytes)"
343
+ log "Full response: #{body}"
344
+ { success: false, error: 'Uncertain if cancellation succeeded - please verify' }
313
345
  end
314
346
  else
315
347
  { success: false, error: "HTTP #{response.code}" }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Truenorth
4
- VERSION = '0.2.5'
4
+ VERSION = '0.2.6'
5
5
  end
data/truenorth.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'truenorth'
5
- spec.version = '0.2.5'
5
+ spec.version = '0.2.6'
6
6
  spec.authors = ['usiegj00']
7
7
  spec.email = ['112138+usiegj00@users.noreply.github.com']
8
8
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: truenorth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - usiegj00