Class: TentD::API::CoreProfileData

Inherits:
Hashie::Mash
  • Object
show all
Defined in:
lib/tentd/api/core_profile_data.rb

Instance Method Summary collapse

Instance Method Details

#entityObject



36
37
38
# File 'lib/tentd/api/core_profile_data.rb', line 36

def entity
  self[version_key][:entity]
end

#entity?(entity) ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/tentd/api/core_profile_data.rb', line 28

def entity?(entity)
  self[version_key][:entity] == entity
end

#expected_versionObject



6
7
8
9
10
# File 'lib/tentd/api/core_profile_data.rb', line 6

def expected_version
  v = TentVersion.from_uri(Model::ProfileInfo::TENT_PROFILE_TYPE_URI)
  v.parts = v.parts[0..-2] << 'x'
  v
end

#licensesObject



40
41
42
# File 'lib/tentd/api/core_profile_data.rb', line 40

def licenses
  self[version_key][:licenses]
end

#serversObject



32
33
34
# File 'lib/tentd/api/core_profile_data.rb', line 32

def servers
  self[version_key][:servers]
end

#versionObject



18
19
20
21
22
# File 'lib/tentd/api/core_profile_data.rb', line 18

def version
  versions.find do |v|
    v == expected_version
  end
end

#version_keyObject



24
25
26
# File 'lib/tentd/api/core_profile_data.rb', line 24

def version_key
  Model::ProfileInfo::TENT_PROFILE_TYPE_URI.sub(%r|/v.*?$|, '/v' << version.to_s)
end

#versionsObject



12
13
14
15
16
# File 'lib/tentd/api/core_profile_data.rb', line 12

def versions
  keys.select { |key|
    key =~ %r|^#{Model::ProfileInfo::TENT_PROFILE_TYPE_URI.sub(/\/v.*?$/, '')}|
  }.map { |key| TentVersion.from_uri(key) }.sort
end