Class: Tenable::Models::Asset

Inherits:
Data
  • Object
show all
Defined in:
lib/tenable/models/asset.rb

Overview

Represents an asset (host/device) from the Tenable.io API.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#fqdnObject (readonly)

Returns the value of attribute fqdn

Returns:

  • (Object)

    the current value of fqdn



6
7
8
# File 'lib/tenable/models/asset.rb', line 6

def fqdn
  @fqdn
end

#hostnameObject (readonly)

Returns the value of attribute hostname

Returns:

  • (Object)

    the current value of hostname



6
7
8
# File 'lib/tenable/models/asset.rb', line 6

def hostname
  @hostname
end

#ipv4Object (readonly)

Returns the value of attribute ipv4

Returns:

  • (Object)

    the current value of ipv4



6
7
8
# File 'lib/tenable/models/asset.rb', line 6

def ipv4
  @ipv4
end

#netbios_nameObject (readonly)

Returns the value of attribute netbios_name

Returns:

  • (Object)

    the current value of netbios_name



6
7
8
# File 'lib/tenable/models/asset.rb', line 6

def netbios_name
  @netbios_name
end

#operating_systemObject (readonly)

Returns the value of attribute operating_system

Returns:

  • (Object)

    the current value of operating_system



6
7
8
# File 'lib/tenable/models/asset.rb', line 6

def operating_system
  @operating_system
end

#uuidObject (readonly)

Returns the value of attribute uuid

Returns:

  • (Object)

    the current value of uuid



6
7
8
# File 'lib/tenable/models/asset.rb', line 6

def uuid
  @uuid
end

Class Method Details

.from_api(data) ⇒ Asset

Builds an Asset from a raw API response hash.

Parameters:

  • data (Hash)

    raw API response hash with string keys

Returns:



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/tenable/models/asset.rb', line 11

def self.from_api(data)
  data = data.transform_keys(&:to_sym)
  new(
    uuid: data[:uuid],
    hostname: data[:hostname],
    ipv4: data[:ipv4],
    operating_system: data[:operating_system] || [],
    fqdn: data[:fqdn] || [],
    netbios_name: data[:netbios_name]
  )
end