Class: Mihari::Structs::Onyphe::Response

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/mihari/structs/onyphe.rb

Class Method Summary collapse

Class Method Details

.from_dynamic!(d) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/mihari/structs/onyphe.rb', line 33

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    count: d.fetch("count"),
    error: d.fetch("error"),
    max_page: d.fetch("max_page"),
    page: d.fetch("page").to_i,
    results: d.fetch("results").map { |x| Result.from_dynamic!(x) },
    status: d.fetch("status"),
    total: d.fetch("total")
  )
end