Class: Host

Inherits:
Object
  • Object
show all
Defined in:
lib/vipruby.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Host

Returns a new instance of Host.



103
104
105
# File 'lib/vipruby.rb', line 103

def initialize params = {}
  params.each { |key, value| send "#{key}=", value }
end

Instance Attribute Details

#discoverableObject

Returns the value of attribute discoverable.



101
102
103
# File 'lib/vipruby.rb', line 101

def discoverable
  @discoverable
end

#fqdnObject

Returns the value of attribute fqdn.



101
102
103
# File 'lib/vipruby.rb', line 101

def fqdn
  @fqdn
end

#initiator_nodeObject

Returns the value of attribute initiator_node.



101
102
103
# File 'lib/vipruby.rb', line 101

def initiator_node
  @initiator_node
end

#initiators_portObject

Returns the value of attribute initiators_port.



101
102
103
# File 'lib/vipruby.rb', line 101

def initiators_port
  @initiators_port
end

#ip_addressObject

Returns the value of attribute ip_address.



101
102
103
# File 'lib/vipruby.rb', line 101

def ip_address
  @ip_address
end

#nameObject

Returns the value of attribute name.



101
102
103
# File 'lib/vipruby.rb', line 101

def name
  @name
end

#protocolObject

Returns the value of attribute protocol.



101
102
103
# File 'lib/vipruby.rb', line 101

def protocol
  @protocol
end

#typeObject

Returns the value of attribute type.



101
102
103
# File 'lib/vipruby.rb', line 101

def type
  @type
end

Instance Method Details

#generate_initiators_jsonObject



116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/vipruby.rb', line 116

def generate_initiators_json
  initiator_json = []
  @initiators_port.each do |initiator|
    initiator_json <<
    {
      protocol: @protocol.upcase,
      initiator_port: initiator,
      initiator_node: @initiator_node
    }.to_json
  end
  initiator_json
end

#generate_jsonObject



107
108
109
110
111
112
113
114
# File 'lib/vipruby.rb', line 107

def generate_json
  {
    type: @type.capitalize,
    name: @name,
    host_name: @fqdn,
    discoverable: @discoverable.downcase
  }.to_json
end