Class: VersionOne::Meta

Inherits:
Object
  • Object
show all
Defined in:
lib/version-one/meta.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ Meta

Returns a new instance of Meta.



10
11
12
# File 'lib/version-one/meta.rb', line 10

def initialize(xml)
  parse_xml(xml)
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



8
9
10
# File 'lib/version-one/meta.rb', line 8

def attributes
  @attributes
end

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/version-one/meta.rb', line 7

def name
  @name
end

Class Method Details

.get(asset_type, client = nil) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/version-one/meta.rb', line 14

def self.get(asset_type, client=nil)
  client ||= VersionOne::Client.new

  xml = client.get('/meta.v1/' + asset_type, cache: {
      key: "VersionOne/meta/#{asset_type}",
      options: {
        expires_in: 60 * 60 * 24,
        race_condition_ttl: 5
      }
  })

  new(xml)
end

Instance Method Details

#[](name) ⇒ Object



28
29
30
# File 'lib/version-one/meta.rb', line 28

def [](name)
  @named_attributes[name]
end

#inspectObject



32
33
34
# File 'lib/version-one/meta.rb', line 32

def inspect
  '#<Meta:%s>' % [self.name]
end