Class: Ravelin::App

Inherits:
RavelinObject show all
Defined in:
lib/ravelin/app.rb

Constant Summary collapse

PLATFORM_IOS =
'ios'
PLATFORM_ANDROID =
'android'
PLATFORM_WEB =
'web'
PLATFORM_MOBILE_WEB =
'mobile-web'
PLATFORM_VALUES =
[PLATFORM_IOS, PLATFORM_ANDROID, PLATFORM_WEB, PLATFORM_MOBILE_WEB]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from RavelinObject

attr_accessor, attr_required, #initialize, required_attributes, #serializable_hash

Constructor Details

This class inherits a constructor from Ravelin::RavelinObject

Instance Attribute Details

#domainObject

Returns the value of attribute domain.



3
4
5
# File 'lib/ravelin/app.rb', line 3

def domain
  @domain
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/ravelin/app.rb', line 3

def name
  @name
end

#platformObject

Returns the value of attribute platform.



3
4
5
# File 'lib/ravelin/app.rb', line 3

def platform
  @platform
end

Class Method Details

.valid_domain?(domain) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/ravelin/app.rb', line 22

def self.valid_domain?(domain)
  domain.nil? || /^[a-z0-9\-\\.]+$/.match(domain)
end

.valid_platform?(platform) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/ravelin/app.rb', line 18

def self.valid_platform?(platform)
  platform.nil? || PLATFORM_VALUES.include?(platform)
end

Instance Method Details

#validateObject

Raises:

  • (ArgumentError)


11
12
13
14
15
16
# File 'lib/ravelin/app.rb', line 11

def validate
  super

  raise ArgumentError, "Platform value be one of #{PLATFORM_VALUES.join(', ')}" unless App.valid_platform?(platform)
  raise ArgumentError, 'Domain is not valid' unless App.valid_domain?(domain)
end