Class: SDM::RequestableResource

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

Overview

RequestableResource is a resource that can be requested via an AccessRequestConfig

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(access: nil, authentication: nil, healthy: nil, id: nil, name: nil, tags: nil, type: nil) ⇒ RequestableResource

Returns a new instance of RequestableResource.



10854
10855
10856
10857
10858
10859
10860
10861
10862
10863
10864
10865
10866
10867
10868
10869
10870
# File 'lib/models/porcelain.rb', line 10854

def initialize(
  access: nil,
  authentication: nil,
  healthy: nil,
  id: nil,
  name: nil,
  tags: nil,
  type: nil
)
  @access = access == nil ? "" : access
  @authentication = authentication == nil ? "" : authentication
  @healthy = healthy == nil ? false : healthy
  @id = id == nil ? "" : id
  @name = name == nil ? "" : name
  @tags = tags == nil ? SDM::_porcelain_zero_value_tags() : tags
  @type = type == nil ? "" : type
end

Instance Attribute Details

#accessObject

The current state of the user's access to the resources



10840
10841
10842
# File 'lib/models/porcelain.rb', line 10840

def access
  @access
end

#authenticationObject

The type of authentication for the resource



10842
10843
10844
# File 'lib/models/porcelain.rb', line 10842

def authentication
  @authentication
end

#healthyObject

The health check status of the reasource



10844
10845
10846
# File 'lib/models/porcelain.rb', line 10844

def healthy
  @healthy
end

#idObject

The resource id.



10846
10847
10848
# File 'lib/models/porcelain.rb', line 10846

def id
  @id
end

#nameObject

The resource name.



10848
10849
10850
# File 'lib/models/porcelain.rb', line 10848

def name
  @name
end

#tagsObject

Any tags attached to this resource



10850
10851
10852
# File 'lib/models/porcelain.rb', line 10850

def tags
  @tags
end

#typeObject

The resource type



10852
10853
10854
# File 'lib/models/porcelain.rb', line 10852

def type
  @type
end

Instance Method Details

#to_json(options = {}) ⇒ Object



10872
10873
10874
10875
10876
10877
10878
# File 'lib/models/porcelain.rb', line 10872

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