Class: CtdDocumentation::Indicators

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

Overview

Indicators Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(id = SKIP, alert_id = SKIP, indicator_id = SKIP, indicator_result = SKIP, parent_indicator_id = SKIP, site_id = SKIP, indicator_info = SKIP, icon = SKIP) ⇒ Indicators

Returns a new instance of Indicators.



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/ctd_documentation/models/indicators.rb', line 77

def initialize(id = SKIP,
               alert_id = SKIP,
               indicator_id = SKIP,
               indicator_result = SKIP,
               parent_indicator_id = SKIP,
               site_id = SKIP,
               indicator_info = SKIP,
               icon = SKIP)
  @id = id unless id == SKIP
  @alert_id = alert_id unless alert_id == SKIP
  @indicator_id = indicator_id unless indicator_id == SKIP
  @indicator_result = indicator_result unless indicator_result == SKIP
  @parent_indicator_id = parent_indicator_id unless parent_indicator_id == SKIP
  @site_id = site_id unless site_id == SKIP
  @indicator_info = indicator_info unless indicator_info == SKIP
  @icon = icon unless icon == SKIP
end

Instance Attribute Details

#alert_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def alert_id
  @alert_id
end

#iconString

TODO: Write general description for this method

Returns:

  • (String)


42
43
44
# File 'lib/ctd_documentation/models/indicators.rb', line 42

def icon
  @icon
end

#idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def id
  @id
end

#indicator_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def indicator_id
  @indicator_id
end

#indicator_infoIndicatorInfo

TODO: Write general description for this method

Returns:



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

def indicator_info
  @indicator_info
end

#indicator_resultTrueClass|FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass|FalseClass)


26
27
28
# File 'lib/ctd_documentation/models/indicators.rb', line 26

def indicator_result
  @indicator_result
end

#parent_indicator_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


30
31
32
# File 'lib/ctd_documentation/models/indicators.rb', line 30

def parent_indicator_id
  @parent_indicator_id
end

#site_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


34
35
36
# File 'lib/ctd_documentation/models/indicators.rb', line 34

def site_id
  @site_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/ctd_documentation/models/indicators.rb', line 96

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.

  id = hash.key?('id') ? hash['id'] : SKIP
  alert_id = hash.key?('alert_id') ? hash['alert_id'] : SKIP
  indicator_id = hash.key?('indicator_id') ? hash['indicator_id'] : SKIP
  indicator_result =
    hash.key?('indicator_result') ? hash['indicator_result'] : SKIP
  parent_indicator_id =
    hash.key?('parent_indicator_id') ? hash['parent_indicator_id'] : SKIP
  site_id = hash.key?('site_id') ? hash['site_id'] : SKIP
  indicator_info = IndicatorInfo.from_hash(hash['indicator_info']) if hash['indicator_info']
  icon = hash.key?('icon') ? hash['icon'] : SKIP

  # Create object from extracted values.

  Indicators.new(id,
                 alert_id,
                 indicator_id,
                 indicator_result,
                 parent_indicator_id,
                 site_id,
                 indicator_info,
                 icon)
end

.namesObject

A mapping from model property names to API property names.



45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/ctd_documentation/models/indicators.rb', line 45

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['alert_id'] = 'alert_id'
  @_hash['indicator_id'] = 'indicator_id'
  @_hash['indicator_result'] = 'indicator_result'
  @_hash['parent_indicator_id'] = 'parent_indicator_id'
  @_hash['site_id'] = 'site_id'
  @_hash['indicator_info'] = 'indicator_info'
  @_hash['icon'] = 'icon'
  @_hash
end

.nullablesObject

An array for nullable fields



73
74
75
# File 'lib/ctd_documentation/models/indicators.rb', line 73

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    id
    alert_id
    indicator_id
    indicator_result
    parent_indicator_id
    site_id
    indicator_info
    icon
  ]
end