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.



8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
# File 'lib/models/porcelain.rb', line 8102

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



8088
8089
8090
# File 'lib/models/porcelain.rb', line 8088

def access
  @access
end

#authenticationObject

The type of authentication for the resource



8090
8091
8092
# File 'lib/models/porcelain.rb', line 8090

def authentication
  @authentication
end

#healthyObject

The health check status of the reasource



8092
8093
8094
# File 'lib/models/porcelain.rb', line 8092

def healthy
  @healthy
end

#idObject

The resource id.



8094
8095
8096
# File 'lib/models/porcelain.rb', line 8094

def id
  @id
end

#nameObject

The resource name.



8096
8097
8098
# File 'lib/models/porcelain.rb', line 8096

def name
  @name
end

#tagsObject

Any tags attached to this resource



8098
8099
8100
# File 'lib/models/porcelain.rb', line 8098

def tags
  @tags
end

#typeObject

The resource type



8100
8101
8102
# File 'lib/models/porcelain.rb', line 8100

def type
  @type
end

Instance Method Details

#to_json(options = {}) ⇒ Object



8120
8121
8122
8123
8124
8125
8126
# File 'lib/models/porcelain.rb', line 8120

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