Class: SDM::Druid

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id: nil, name: nil, healthy: nil, hostname: nil, port_override: nil, username: nil, password: nil, port: nil) ⇒ Druid

Returns a new instance of Druid.



848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
# File 'lib/models/porcelain.rb', line 848

def initialize(
  id: nil,
  name: nil,
  healthy: nil,
  hostname: nil,
  port_override: nil,
  username: nil,
  password: nil,
  port: nil
)
  if id != nil
    @id = id
  end
  if name != nil
    @name = name
  end
  if healthy != nil
    @healthy = healthy
  end
  if hostname != nil
    @hostname = hostname
  end
  if port_override != nil
    @port_override = port_override
  end
  if username != nil
    @username = username
  end
  if password != nil
    @password = password
  end
  if port != nil
    @port = port
  end
end

Instance Attribute Details

#healthyObject

True if the datasource is reachable and the credentials are valid.



836
837
838
# File 'lib/models/porcelain.rb', line 836

def healthy
  @healthy
end

#hostnameObject

Returns the value of attribute hostname.



838
839
840
# File 'lib/models/porcelain.rb', line 838

def hostname
  @hostname
end

#idObject

Unique identifier of the Resource.



832
833
834
# File 'lib/models/porcelain.rb', line 832

def id
  @id
end

#nameObject

Unique human-readable name of the Resource.



834
835
836
# File 'lib/models/porcelain.rb', line 834

def name
  @name
end

#passwordObject

Returns the value of attribute password.



844
845
846
# File 'lib/models/porcelain.rb', line 844

def password
  @password
end

#portObject

Returns the value of attribute port.



846
847
848
# File 'lib/models/porcelain.rb', line 846

def port
  @port
end

#port_overrideObject

Returns the value of attribute port_override.



840
841
842
# File 'lib/models/porcelain.rb', line 840

def port_override
  @port_override
end

#usernameObject

Returns the value of attribute username.



842
843
844
# File 'lib/models/porcelain.rb', line 842

def username
  @username
end

Instance Method Details

#to_json(options = {}) ⇒ Object



884
885
886
887
888
889
890
# File 'lib/models/porcelain.rb', line 884

def to_json(options = {})
  hash = {}
  self.instance_variables.each do |var|
    hash[var.id2name.delete_prefix("@")] = self.instance_variable_get var
  end
  hash.to_json
end