Class: Rerout::Models::BatchCreateLinksResult
- Inherits:
-
Object
- Object
- Rerout::Models::BatchCreateLinksResult
- Defined in:
- lib/rerout/models.rb
Overview
Aggregate result of ‘links.create_batch` (`POST /v1/links/batch`).
Instance Attribute Summary collapse
-
#created ⇒ Object
readonly
Returns the value of attribute created.
-
#results ⇒ Object
readonly
Returns the value of attribute results.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(created:, total:, results:) ⇒ BatchCreateLinksResult
constructor
A new instance of BatchCreateLinksResult.
- #to_h ⇒ Object
Constructor Details
#initialize(created:, total:, results:) ⇒ BatchCreateLinksResult
Returns a new instance of BatchCreateLinksResult.
648 649 650 651 652 653 |
# File 'lib/rerout/models.rb', line 648 def initialize(created:, total:, results:) @created = created @total = total @results = results.freeze freeze end |
Instance Attribute Details
#created ⇒ Object (readonly)
Returns the value of attribute created.
646 647 648 |
# File 'lib/rerout/models.rb', line 646 def created @created end |
#results ⇒ Object (readonly)
Returns the value of attribute results.
646 647 648 |
# File 'lib/rerout/models.rb', line 646 def results @results end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
646 647 648 |
# File 'lib/rerout/models.rb', line 646 def total @total end |
Class Method Details
.from_hash(hash) ⇒ Object
655 656 657 658 659 660 661 |
# File 'lib/rerout/models.rb', line 655 def self.from_hash(hash) new( created: hash.fetch('created', 0), total: hash.fetch('total', 0), results: (hash['results'] || []).map { |r| BatchLinkResult.from_hash(r) } ) end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
667 668 669 |
# File 'lib/rerout/models.rb', line 667 def ==(other) other.is_a?(BatchCreateLinksResult) && other.to_h == to_h end |
#hash ⇒ Object
672 673 674 |
# File 'lib/rerout/models.rb', line 672 def hash to_h.hash end |
#to_h ⇒ Object
663 664 665 |
# File 'lib/rerout/models.rb', line 663 def to_h { created: created, total: total, results: results.map(&:to_h) } end |