Class: RestPack::Core::Client::Application

Inherits:
Object
  • Object
show all
Defined in:
lib/restpack_core_client/models/application.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, channel) ⇒ Application

Returns a new instance of Application.



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/restpack_core_client/models/application.rb', line 5

def initialize(data, channel)
  @domains        = []
  @configurations = []

  @id = data[:id].to_i
  @name = data[:name]
  @href = data[:href]

  @channel = channel
  @channel.applications << self
end

Instance Attribute Details

#channelObject

Returns the value of attribute channel.



3
4
5
# File 'lib/restpack_core_client/models/application.rb', line 3

def channel
  @channel
end

#configurationsObject

Returns the value of attribute configurations.



3
4
5
# File 'lib/restpack_core_client/models/application.rb', line 3

def configurations
  @configurations
end

#domainsObject

Returns the value of attribute domains.



3
4
5
# File 'lib/restpack_core_client/models/application.rb', line 3

def domains
  @domains
end

#hrefObject

Returns the value of attribute href.



3
4
5
# File 'lib/restpack_core_client/models/application.rb', line 3

def href
  @href
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/restpack_core_client/models/application.rb', line 3

def id
  @id
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/restpack_core_client/models/application.rb', line 3

def name
  @name
end

Instance Method Details

#auth_domainObject



30
31
32
# File 'lib/restpack_core_client/models/application.rb', line 30

def auth_domain
  known_domain_names[:auth]
end

#get_configuration_by_key(key) ⇒ Object



17
18
19
# File 'lib/restpack_core_client/models/application.rb', line 17

def get_configuration_by_key(key)
  @configurations.find { |c| c.key == key.to_s }
end

#home_domainObject

TODO: GJ: dynamic



26
27
28
# File 'lib/restpack_core_client/models/application.rb', line 26

def home_domain #TODO: GJ: dynamic
  known_domain_names[:home]
end

#known_domain_namesObject



21
22
23
24
# File 'lib/restpack_core_client/models/application.rb', line 21

def known_domain_names
  configuration = get_configuration_by_key(:domains)
  configuration.nil? ? {} : configuration.value
end