Class: RisenexaLeads::BatchResult
- Inherits:
-
Object
- Object
- RisenexaLeads::BatchResult
- Defined in:
- lib/risenexa/leads.rb
Instance Attribute Summary collapse
-
#created ⇒ Object
readonly
Returns the value of attribute created.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#failed ⇒ Object
readonly
Returns the value of attribute failed.
Class Method Summary collapse
Instance Method Summary collapse
- #failure? ⇒ Boolean
-
#initialize(created: 0, failed: 0, errors: [], error: nil) ⇒ BatchResult
constructor
A new instance of BatchResult.
- #partial_success? ⇒ Boolean
- #success? ⇒ Boolean
Constructor Details
#initialize(created: 0, failed: 0, errors: [], error: nil) ⇒ BatchResult
Returns a new instance of BatchResult.
237 238 239 240 241 242 |
# File 'lib/risenexa/leads.rb', line 237 def initialize(created: 0, failed: 0, errors: [], error: nil) @created = created @failed = failed @errors = errors @error = error end |
Instance Attribute Details
#created ⇒ Object (readonly)
Returns the value of attribute created.
235 236 237 |
# File 'lib/risenexa/leads.rb', line 235 def created @created end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
235 236 237 |
# File 'lib/risenexa/leads.rb', line 235 def error @error end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
235 236 237 |
# File 'lib/risenexa/leads.rb', line 235 def errors @errors end |
#failed ⇒ Object (readonly)
Returns the value of attribute failed.
235 236 237 |
# File 'lib/risenexa/leads.rb', line 235 def failed @failed end |
Class Method Details
.failure(error_message) ⇒ Object
257 258 259 |
# File 'lib/risenexa/leads.rb', line 257 def failure() new(error: ) end |
Instance Method Details
#failure? ⇒ Boolean
252 253 254 |
# File 'lib/risenexa/leads.rb', line 252 def failure? @error.present? || (@created.zero? && @errors.any?) end |
#partial_success? ⇒ Boolean
248 249 250 |
# File 'lib/risenexa/leads.rb', line 248 def partial_success? @error.nil? && @created.positive? && @errors.any? end |
#success? ⇒ Boolean
244 245 246 |
# File 'lib/risenexa/leads.rb', line 244 def success? @error.nil? && @errors.empty? end |