Class: RIPE::Attribute

Inherits:
Object
  • Object
show all
Defined in:
lib/ripe/attribute.rb

Instance Method Summary collapse

Constructor Details

#initialize(client, attribute) ⇒ Attribute

Returns a new instance of Attribute.



4
5
6
7
# File 'lib/ripe/attribute.rb', line 4

def initialize(client, attribute)
  @client = client
  @attribute = attribute
end

Instance Method Details

#nameObject



9
10
11
# File 'lib/ripe/attribute.rb', line 9

def name
  @attribute['name']
end

#referenced_objectObject Also known as: object



21
22
23
# File 'lib/ripe/attribute.rb', line 21

def referenced_object
  @referenced_object ||= referenced_type ?  @client.find(self.referenced_type, self.value) : nil
end

#referenced_typeObject



17
18
19
# File 'lib/ripe/attribute.rb', line 17

def referenced_type
  @attribute['referenced-type']
end

#to_api_hashObject



26
27
28
29
30
31
# File 'lib/ripe/attribute.rb', line 26

def to_api_hash
  {
    'name' => @attribute['name'],
    'value' => @attribute['value']
  }
end

#valueObject



13
14
15
# File 'lib/ripe/attribute.rb', line 13

def value
  @attribute['value']
end