Class: CtdDocumentation::SlimInsight

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/ctd_documentation/models/slim_insight.rb

Overview

SlimInsight Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(comment = SKIP, cve_id = SKIP, cvss = SKIP, identified_on = SKIP, last_updated = SKIP, modified = SKIP, published = SKIP, status = SKIP, title = SKIP) ⇒ SlimInsight

Returns a new instance of SlimInsight.



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/ctd_documentation/models/slim_insight.rb', line 92

def initialize(comment = SKIP,
               cve_id = SKIP,
               cvss = SKIP,
               identified_on = SKIP,
               last_updated = SKIP,
               modified = SKIP,
               published = SKIP,
               status = SKIP,
               title = SKIP)
  @comment = comment unless comment == SKIP
  @cve_id = cve_id unless cve_id == SKIP
  @cvss = cvss unless cvss == SKIP
  @identified_on = identified_on unless identified_on == SKIP
  @last_updated = last_updated unless last_updated == SKIP
  @modified = modified unless modified == SKIP
  @published = published unless published == SKIP
  @status = status unless status == SKIP
  @title = title unless title == SKIP
end

Instance Attribute Details

#commentString

Last comment provided by user

Returns:

  • (String)


14
15
16
# File 'lib/ctd_documentation/models/slim_insight.rb', line 14

def comment
  @comment
end

#cve_idString

The CVE’s ID

Returns:

  • (String)


18
19
20
# File 'lib/ctd_documentation/models/slim_insight.rb', line 18

def cve_id
  @cve_id
end

#cvssObject

The CVE’s score

Returns:



22
23
24
# File 'lib/ctd_documentation/models/slim_insight.rb', line 22

def cvss
  @cvss
end

#identified_onString

The timestamp when the CVE was identified. Format: YYYY-MM-DDTHH:MM:SS (in UTC)

Returns:

  • (String)


27
28
29
# File 'lib/ctd_documentation/models/slim_insight.rb', line 27

def identified_on
  @identified_on
end

#last_updatedString

The timestamp when the latest change on the CVE was made in the EMC. Format: YYYY-MM-DDTHH:MM:SS+00:00 (in UTC)

Returns:

  • (String)


32
33
34
# File 'lib/ctd_documentation/models/slim_insight.rb', line 32

def last_updated
  @last_updated
end

#modifiedString

The full date of the latest modification was made on the CVE by the global provider. Format: YYYY-MM-DD

Returns:

  • (String)


38
39
40
# File 'lib/ctd_documentation/models/slim_insight.rb', line 38

def modified
  @modified
end

#publishedString

The full date when the CVE’s was published at. Format: YYYY-MM-DD

Returns:

  • (String)


43
44
45
# File 'lib/ctd_documentation/models/slim_insight.rb', line 43

def published
  @published
end

#statusInteger

A number that represents the CVE’s status. Options: 0 - Open 1 - Hidden 2 - Completed

Returns:

  • (Integer)


51
52
53
# File 'lib/ctd_documentation/models/slim_insight.rb', line 51

def status
  @status
end

#titleString

The CVE’s title

Returns:

  • (String)


55
56
57
# File 'lib/ctd_documentation/models/slim_insight.rb', line 55

def title
  @title
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/ctd_documentation/models/slim_insight.rb', line 113

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  comment = hash.key?('comment') ? hash['comment'] : SKIP
  cve_id = hash.key?('cve_id') ? hash['cve_id'] : SKIP
  cvss = Object.from_hash(hash['cvss']) if hash['cvss']
  identified_on = hash.key?('identified_on') ? hash['identified_on'] : SKIP
  last_updated = hash.key?('last_updated') ? hash['last_updated'] : SKIP
  modified = hash.key?('modified') ? hash['modified'] : SKIP
  published = hash.key?('published') ? hash['published'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP
  title = hash.key?('title') ? hash['title'] : SKIP

  # Create object from extracted values.
  SlimInsight.new(comment,
                  cve_id,
                  cvss,
                  identified_on,
                  last_updated,
                  modified,
                  published,
                  status,
                  title)
end

.namesObject

A mapping from model property names to API property names.



58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/ctd_documentation/models/slim_insight.rb', line 58

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['comment'] = 'comment'
  @_hash['cve_id'] = 'cve_id'
  @_hash['cvss'] = 'cvss'
  @_hash['identified_on'] = 'identified_on'
  @_hash['last_updated'] = 'last_updated'
  @_hash['modified'] = 'modified'
  @_hash['published'] = 'published'
  @_hash['status'] = 'status'
  @_hash['title'] = 'title'
  @_hash
end

.nullablesObject

An array for nullable fields



88
89
90
# File 'lib/ctd_documentation/models/slim_insight.rb', line 88

def self.nullables
  []
end

.optionalsObject

An array for optional fields



73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/ctd_documentation/models/slim_insight.rb', line 73

def self.optionals
  %w[
    comment
    cve_id
    cvss
    identified_on
    last_updated
    modified
    published
    status
    title
  ]
end