Class: TestPack1::TurbineType

Inherits:
BaseModel show all
Defined in:
lib/test_pack_1/models/turbine_type.rb

Overview

Turbine-specific type information.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(turbine_type_id = nil, title = nil, manufacturer = nil, model = nil, controller = nil, rated_power = nil, max_rotor_speed = nil) ⇒ TurbineType

Returns a new instance of TurbineType.



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/test_pack_1/models/turbine_type.rb', line 50

def initialize(turbine_type_id = nil,
               title = nil,
               manufacturer = nil,
               model = nil,
               controller = nil,
               rated_power = nil,
               max_rotor_speed = nil)
  @turbine_type_id = turbine_type_id
  @title = title
  @manufacturer = manufacturer
  @model = model
  @controller = controller
  @rated_power = rated_power
  @max_rotor_speed = max_rotor_speed
end

Instance Attribute Details

#controllerString

The model of the turbine controller.

Returns:



27
28
29
# File 'lib/test_pack_1/models/turbine_type.rb', line 27

def controller
  @controller
end

#manufacturerString

TODO: Write general description for this method

Returns:



19
20
21
# File 'lib/test_pack_1/models/turbine_type.rb', line 19

def manufacturer
  @manufacturer
end

#max_rotor_speedFloat

The model of the turbine controller.

Returns:

  • (Float)


35
36
37
# File 'lib/test_pack_1/models/turbine_type.rb', line 35

def max_rotor_speed
  @max_rotor_speed
end

#modelString

TODO: Write general description for this method

Returns:



23
24
25
# File 'lib/test_pack_1/models/turbine_type.rb', line 23

def model
  @model
end

#rated_powerInteger

The model of the turbine controller.

Returns:

  • (Integer)


31
32
33
# File 'lib/test_pack_1/models/turbine_type.rb', line 31

def rated_power
  @rated_power
end

#titleString

TODO: Write general description for this method

Returns:



15
16
17
# File 'lib/test_pack_1/models/turbine_type.rb', line 15

def title
  @title
end

#turbine_type_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


11
12
13
# File 'lib/test_pack_1/models/turbine_type.rb', line 11

def turbine_type_id
  @turbine_type_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/test_pack_1/models/turbine_type.rb', line 67

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.

  turbine_type_id = hash['turbineTypeId']
  title = hash['title']
  manufacturer = hash['manufacturer']
  model = hash['model']
  controller = hash['controller']
  rated_power = hash['ratedPower']
  max_rotor_speed = hash['maxRotorSpeed']

  # Create object from extracted values.

  TurbineType.new(turbine_type_id,
                  title,
                  manufacturer,
                  model,
                  controller,
                  rated_power,
                  max_rotor_speed)
end

.namesObject

A mapping from model property names to API property names.



38
39
40
41
42
43
44
45
46
47
48
# File 'lib/test_pack_1/models/turbine_type.rb', line 38

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['turbine_type_id'] = 'turbineTypeId'
  @_hash['title'] = 'title'
  @_hash['manufacturer'] = 'manufacturer'
  @_hash['model'] = 'model'
  @_hash['controller'] = 'controller'
  @_hash['rated_power'] = 'ratedPower'
  @_hash['max_rotor_speed'] = 'maxRotorSpeed'
  @_hash
end