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
# File 'lib/restpack-core-client/models/application.rb', line 5

def initialize(data, channel)
  @domains        = []
  @configurations = []
  
  @id = data[:id]
  @name = data[:name]
  
  @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

#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



29
30
31
# File 'lib/restpack-core-client/models/application.rb', line 29

def auth_domain
  known_domain_names[:auth]
end

#get_configuration_by_key(key) ⇒ Object



16
17
18
# File 'lib/restpack-core-client/models/application.rb', line 16

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

#home_domainObject

TODO: GJ: dynamic



25
26
27
# File 'lib/restpack-core-client/models/application.rb', line 25

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

#known_domain_namesObject



20
21
22
23
# File 'lib/restpack-core-client/models/application.rb', line 20

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