Class: Copyleaks::CopyleaksStartRequestModel
- Inherits:
-
Object
- Object
- Copyleaks::CopyleaksStartRequestModel
- Defined in:
- lib/copyleaks/models/start_request_model.rb
Instance Attribute Summary collapse
-
#errorHandling ⇒ Object
readonly
Returns the value of attribute errorHandling.
-
#trigger ⇒ Object
readonly
Returns the value of attribute trigger.
Instance Method Summary collapse
- #as_json(*_args) ⇒ Object
-
#initialize(trigger, errorHandling = CopyleaksStartErrorHandlings::IGNORE) ⇒ CopyleaksStartRequestModel
constructor
A new instance of CopyleaksStartRequestModel.
- #to_json(*options) ⇒ Object
Constructor Details
#initialize(trigger, errorHandling = CopyleaksStartErrorHandlings::IGNORE) ⇒ CopyleaksStartRequestModel
Returns a new instance of CopyleaksStartRequestModel.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/copyleaks/models/start_request_model.rb', line 30 def initialize(trigger, errorHandling = CopyleaksStartErrorHandlings::IGNORE) trigger.each do |item| unless item.instance_of?(String) raise 'Copyleaks::CopyleaksStartRequestModel - trigger - entity must be of type String' end end unless [0, 1].include? errorHandling raise 'Copyleaks::CopyleaksStartRequestModel - errorHandling - errorHandling must be of type Copyleaks::CopyleaksStartErrorHandlings Consts' end @trigger = trigger @errorHandling = errorHandling end |
Instance Attribute Details
#errorHandling ⇒ Object (readonly)
Returns the value of attribute errorHandling.
26 27 28 |
# File 'lib/copyleaks/models/start_request_model.rb', line 26 def errorHandling @errorHandling end |
#trigger ⇒ Object (readonly)
Returns the value of attribute trigger.
26 27 28 |
# File 'lib/copyleaks/models/start_request_model.rb', line 26 def trigger @trigger end |
Instance Method Details
#as_json(*_args) ⇒ Object
45 46 47 48 49 50 |
# File 'lib/copyleaks/models/start_request_model.rb', line 45 def as_json(*_args) { trigger: @trigger, errorHandling: @errorHandling }.select { |_k, v| !v.nil? } end |
#to_json(*options) ⇒ Object
52 53 54 |
# File 'lib/copyleaks/models/start_request_model.rb', line 52 def to_json(*) as_json(*).to_json(*) end |