Class: Ravelin::App
- Inherits:
-
RavelinObject
- Object
- RavelinObject
- Ravelin::App
- 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
-
#domain ⇒ Object
Returns the value of attribute domain.
-
#name ⇒ Object
Returns the value of attribute name.
-
#platform ⇒ Object
Returns the value of attribute platform.
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
#domain ⇒ Object
Returns the value of attribute domain.
3 4 5 |
# File 'lib/ravelin/app.rb', line 3 def domain @domain end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/ravelin/app.rb', line 3 def name @name end |
#platform ⇒ Object
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
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
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
#validate ⇒ Object
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 |