Class: TerraformEnterprise::API::Resource

Inherits:
Object
  • Object
show all
Defined in:
lib/terraform-enterprise/client/resource.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Resource

Returns a new instance of Resource.



5
6
7
8
9
10
11
12
# File 'lib/terraform-enterprise/client/resource.rb', line 5

def initialize(data)
  @id               = data['id']
  @type             = data['type']
  @attributes       = data['attributes'] || {}
  @relationships    = data['relationships'] || {}
  @links            = data['links'] || []
  @errors           = data['errors'] || []
end

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



4
5
6
# File 'lib/terraform-enterprise/client/resource.rb', line 4

def attributes
  @attributes
end

#errorsObject

Returns the value of attribute errors.



4
5
6
# File 'lib/terraform-enterprise/client/resource.rb', line 4

def errors
  @errors
end

#idObject

Returns the value of attribute id.



4
5
6
# File 'lib/terraform-enterprise/client/resource.rb', line 4

def id
  @id
end

Returns the value of attribute links.



4
5
6
# File 'lib/terraform-enterprise/client/resource.rb', line 4

def links
  @links
end

#relationshipsObject

Returns the value of attribute relationships.



4
5
6
# File 'lib/terraform-enterprise/client/resource.rb', line 4

def relationships
  @relationships
end

#successObject

Returns the value of attribute success.



4
5
6
# File 'lib/terraform-enterprise/client/resource.rb', line 4

def success
  @success
end

#typeObject

Returns the value of attribute type.



4
5
6
# File 'lib/terraform-enterprise/client/resource.rb', line 4

def type
  @type
end

Instance Method Details

#has_errors?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/terraform-enterprise/client/resource.rb', line 14

def has_errors?
  !@errors.empty?
end