Class: Rerout::Models::BatchLinkResult
- Inherits:
-
Object
- Object
- Rerout::Models::BatchLinkResult
- Defined in:
- lib/rerout/models.rb
Overview
Outcome of one link in a ‘links.create_batch` call. `index` is the input position; `ok` is true on success (then `code` is set), false on failure (then `error` carries the reason).
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#ok ⇒ Object
readonly
Returns the value of attribute ok.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(index:, ok:, code: nil, error: nil) ⇒ BatchLinkResult
constructor
A new instance of BatchLinkResult.
- #to_h ⇒ Object
Constructor Details
#initialize(index:, ok:, code: nil, error: nil) ⇒ BatchLinkResult
Returns a new instance of BatchLinkResult.
613 614 615 616 617 618 619 |
# File 'lib/rerout/models.rb', line 613 def initialize(index:, ok:, code: nil, error: nil) @index = index @ok = ok @code = code @error = error freeze end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
611 612 613 |
# File 'lib/rerout/models.rb', line 611 def code @code end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
611 612 613 |
# File 'lib/rerout/models.rb', line 611 def error @error end |
#index ⇒ Object (readonly)
Returns the value of attribute index.
611 612 613 |
# File 'lib/rerout/models.rb', line 611 def index @index end |
#ok ⇒ Object (readonly)
Returns the value of attribute ok.
611 612 613 |
# File 'lib/rerout/models.rb', line 611 def ok @ok end |
Class Method Details
.from_hash(hash) ⇒ Object
621 622 623 624 625 626 627 628 |
# File 'lib/rerout/models.rb', line 621 def self.from_hash(hash) new( index: hash['index'], ok: hash['ok'], code: hash['code'], error: hash['error'] ) end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
634 635 636 |
# File 'lib/rerout/models.rb', line 634 def ==(other) other.is_a?(BatchLinkResult) && other.to_h == to_h end |
#hash ⇒ Object
639 640 641 |
# File 'lib/rerout/models.rb', line 639 def hash to_h.hash end |
#to_h ⇒ Object
630 631 632 |
# File 'lib/rerout/models.rb', line 630 def to_h { index: index, ok: ok, code: code, error: error } end |