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.



10162
10163
10164
10165
10166
10167
10168
10169
10170
10171
10172
10173
10174
10175
10176
10177
10178
# File 'lib/models/porcelain.rb', line 10162

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



10148
10149
10150
# File 'lib/models/porcelain.rb', line 10148

def access
  @access
end

#authenticationObject

The type of authentication for the resource



10150
10151
10152
# File 'lib/models/porcelain.rb', line 10150

def authentication
  @authentication
end

#healthyObject

The health check status of the reasource



10152
10153
10154
# File 'lib/models/porcelain.rb', line 10152

def healthy
  @healthy
end

#idObject

The resource id.



10154
10155
10156
# File 'lib/models/porcelain.rb', line 10154

def id
  @id
end

#nameObject

The resource name.



10156
10157
10158
# File 'lib/models/porcelain.rb', line 10156

def name
  @name
end

#tagsObject

Any tags attached to this resource



10158
10159
10160
# File 'lib/models/porcelain.rb', line 10158

def tags
  @tags
end

#typeObject

The resource type



10160
10161
10162
# File 'lib/models/porcelain.rb', line 10160

def type
  @type
end

Instance Method Details

#to_json(options = {}) ⇒ Object



10180
10181
10182
10183
10184
10185
10186
# File 'lib/models/porcelain.rb', line 10180

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