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

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#countInteger (readonly)



77
# File 'lib/mihari/structs/onyphe.rb', line 77

attribute :count, Types::Int

#errorInteger (readonly)



81
# File 'lib/mihari/structs/onyphe.rb', line 81

attribute :error, Types::Int

#max_pageInteger (readonly)



85
# File 'lib/mihari/structs/onyphe.rb', line 85

attribute :max_page, Types::Int

#pageInteger (readonly)



89
# File 'lib/mihari/structs/onyphe.rb', line 89

attribute :page, Types::Int

#resultsArray<Result> (readonly)



93
# File 'lib/mihari/structs/onyphe.rb', line 93

attribute :results, Types.Array(Result)

#statusString (readonly)



97
# File 'lib/mihari/structs/onyphe.rb', line 97

attribute :status, Types::String

#totalInteger (readonly)



101
# File 'lib/mihari/structs/onyphe.rb', line 101

attribute :total, Types::Int

Class Method Details

.from_dynamic!(d) ⇒ Object



114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/mihari/structs/onyphe.rb', line 114

def 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

Instance Method Details

#artifactsArray<Mihari::Models::Artifact>



106
107
108
# File 'lib/mihari/structs/onyphe.rb', line 106

def artifacts
  results.map(&:artifact)
end