Class: VerifIP::BatchResponse
- Inherits:
-
Object
- Object
- VerifIP::BatchResponse
- Defined in:
- lib/verifip/models.rb
Overview
Response from a batch IP check.
Instance Attribute Summary collapse
- #results ⇒ Array<CheckResponse> readonly
Class Method Summary collapse
-
.from_hash(hash) ⇒ BatchResponse
Build a BatchResponse from a parsed JSON hash.
Instance Method Summary collapse
-
#initialize(results = []) ⇒ BatchResponse
constructor
A new instance of BatchResponse.
- #inspect ⇒ Object
- #size ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(results = []) ⇒ BatchResponse
Returns a new instance of BatchResponse.
71 72 73 |
# File 'lib/verifip/models.rb', line 71 def initialize(results = []) @results = results.freeze end |
Instance Attribute Details
#results ⇒ Array<CheckResponse> (readonly)
69 70 71 |
# File 'lib/verifip/models.rb', line 69 def results @results end |
Class Method Details
.from_hash(hash) ⇒ BatchResponse
Build a BatchResponse from a parsed JSON hash.
79 80 81 82 83 84 |
# File 'lib/verifip/models.rb', line 79 def self.from_hash(hash) items = (hash["results"] || hash[:results] || []).map do |r| CheckResponse.from_hash(r) end new(items) end |
Instance Method Details
#inspect ⇒ Object
89 |
# File 'lib/verifip/models.rb', line 89 def inspect = to_s |
#size ⇒ Object
86 |
# File 'lib/verifip/models.rb', line 86 def size = @results.size |
#to_s ⇒ Object
88 |
# File 'lib/verifip/models.rb', line 88 def to_s = "BatchResponse(results=#{size})" |