Class: Deliver::AppScreenshotValidator::ValidationError

Inherits:
Object
  • Object
show all
Defined in:
deliver/lib/deliver/app_screenshot_validator.rb

Overview

A simple structure that holds error information as well as formatted error messages consistently Set ‘to_skip` to `true` when just needing to skip uploading rather than causing a crash.

Constant Summary collapse

INVALID_SCREEN_SIZE =

Constants that can be given to ‘type` param

'Invalid screen size'.freeze
UNACCEPTABLE_DEVICE =
'Not an accepted App Store Connect device'.freeze
INVALID_FILE_EXTENSION =
'Invalid file extension'.freeze
FILE_EXTENSION_MISMATCH =
'File extension mismatches its image format'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type: nil, path: nil, debug_info: nil, to_skip: false) ⇒ ValidationError

Returns a new instance of ValidationError.



16
17
18
19
20
21
# File 'deliver/lib/deliver/app_screenshot_validator.rb', line 16

def initialize(type: nil, path: nil, debug_info: nil, to_skip: false)
  @type = type
  @path = path
  @debug_info = debug_info
  @to_skip = to_skip
end

Instance Attribute Details

#debug_infoObject (readonly)

Returns the value of attribute debug_info.



14
15
16
# File 'deliver/lib/deliver/app_screenshot_validator.rb', line 14

def debug_info
  @debug_info
end

#pathObject (readonly)

Returns the value of attribute path.



14
15
16
# File 'deliver/lib/deliver/app_screenshot_validator.rb', line 14

def path
  @path
end

#to_skipObject (readonly)

Returns the value of attribute to_skip.



14
15
16
# File 'deliver/lib/deliver/app_screenshot_validator.rb', line 14

def to_skip
  @to_skip
end

#typeObject (readonly)

Returns the value of attribute type.



14
15
16
# File 'deliver/lib/deliver/app_screenshot_validator.rb', line 14

def type
  @type
end

Instance Method Details

#inspectObject



27
28
29
# File 'deliver/lib/deliver/app_screenshot_validator.rb', line 27

def inspect
  "\"#{type}\""
end

#to_sObject



23
24
25
# File 'deliver/lib/deliver/app_screenshot_validator.rb', line 23

def to_s
  "#{to_skip ? '🏃 Skipping' : '🚫 Error'}: #{path} - #{type} (#{debug_info})"
end