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.



8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
# File 'lib/models/porcelain.rb', line 8231

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



8217
8218
8219
# File 'lib/models/porcelain.rb', line 8217

def access
  @access
end

#authenticationObject

The type of authentication for the resource



8219
8220
8221
# File 'lib/models/porcelain.rb', line 8219

def authentication
  @authentication
end

#healthyObject

The health check status of the reasource



8221
8222
8223
# File 'lib/models/porcelain.rb', line 8221

def healthy
  @healthy
end

#idObject

The resource id.



8223
8224
8225
# File 'lib/models/porcelain.rb', line 8223

def id
  @id
end

#nameObject

The resource name.



8225
8226
8227
# File 'lib/models/porcelain.rb', line 8225

def name
  @name
end

#tagsObject

Any tags attached to this resource



8227
8228
8229
# File 'lib/models/porcelain.rb', line 8227

def tags
  @tags
end

#typeObject

The resource type



8229
8230
8231
# File 'lib/models/porcelain.rb', line 8229

def type
  @type
end

Instance Method Details

#to_json(options = {}) ⇒ Object



8249
8250
8251
8252
8253
8254
8255
# File 'lib/models/porcelain.rb', line 8249

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