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.



9230
9231
9232
9233
9234
9235
9236
9237
9238
9239
9240
9241
9242
9243
9244
9245
9246
# File 'lib/models/porcelain.rb', line 9230

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



9216
9217
9218
# File 'lib/models/porcelain.rb', line 9216

def access
  @access
end

#authenticationObject

The type of authentication for the resource



9218
9219
9220
# File 'lib/models/porcelain.rb', line 9218

def authentication
  @authentication
end

#healthyObject

The health check status of the reasource



9220
9221
9222
# File 'lib/models/porcelain.rb', line 9220

def healthy
  @healthy
end

#idObject

The resource id.



9222
9223
9224
# File 'lib/models/porcelain.rb', line 9222

def id
  @id
end

#nameObject

The resource name.



9224
9225
9226
# File 'lib/models/porcelain.rb', line 9224

def name
  @name
end

#tagsObject

Any tags attached to this resource



9226
9227
9228
# File 'lib/models/porcelain.rb', line 9226

def tags
  @tags
end

#typeObject

The resource type



9228
9229
9230
# File 'lib/models/porcelain.rb', line 9228

def type
  @type
end

Instance Method Details

#to_json(options = {}) ⇒ Object



9248
9249
9250
9251
9252
9253
9254
# File 'lib/models/porcelain.rb', line 9248

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