class Censys::Document
Public Class Methods
new(attributes)
click to toggle source
Initializes the document.
@param [Hash{String => Object}] attributes
# File lib/censys/document.rb, line 10 def initialize(attributes) @attributes = attributes end
Public Instance Methods
[](name)
click to toggle source
Provides arbitrary access to the attributes
@param [String] name
The dot-separated field name.
@return [Object]
# File lib/censys/document.rb, line 22 def [](name) keys = name.split(".") dig(*keys) end
dig(*keys)
click to toggle source
Dig attributes
@param [Array<String>] keys
@return [Object]
# File lib/censys/document.rb, line 34 def dig(*keys) @attributes.dig(*keys) end
metadata()
click to toggle source
Additional document metadata.
@return [Hash{String => Object}]
# File lib/censys/document.rb, line 61 def metadata @attributes['metadata'] end
updated_at()
click to toggle source
Time last updated at.
@return [Time]
# File lib/censys/document.rb, line 52 def updated_at @updated_at ||= Time.parse(@attributes['updated_at']) end