class Rox::Core::PropertyFactory

Consolidates creation of all the internal properties

Public Class Methods

new(server_properties) click to toggle source
# File lib/rox/core/properties/property_factory.rb, line 14
def initialize(server_properties)
  @server_properties = server_properties
end

Public Instance Methods

all_properties() click to toggle source

rubocop:disable Metrics/MethodLength

# File lib/rox/core/properties/property_factory.rb, line 117
def all_properties
  [
    platform,
    app_release,
    distinct_id,
    internal_real_platform,
    internal_custom_platform,
    internal_app_key,
    internal_distinct_id,
    internal_lib_version,
    internal_api_version
  ]
end
app_release() click to toggle source
# File lib/rox/core/properties/property_factory.rb, line 29
def app_release
  property = Rox::Core::PropertyType::APP_RELEASE
  type = Rox::Core::CustomPropertyType::SEMVER

  Rox::Core::DeviceProperty.new(
    property.name,
    type,
    @server_properties.get(property)
  )
end
distinct_id() click to toggle source
# File lib/rox/core/properties/property_factory.rb, line 40
def distinct_id
  property = Rox::Core::PropertyType::DISTINCT_ID
  type = Rox::Core::CustomPropertyType::STRING

  Rox::Core::DeviceProperty.new(
    property.name,
    type
  ) do |_|
    SecureRandom.uuid
  end
end
internal_api_version() click to toggle source
# File lib/rox/core/properties/property_factory.rb, line 105
def internal_api_version
  property = Rox::Core::PropertyType::API_VERSION
  type = Rox::Core::CustomPropertyType::SEMVER

  Rox::Core::DeviceProperty.new(
    'internal.api_version',
    type,
    property
  )
end
internal_app_key() click to toggle source
# File lib/rox/core/properties/property_factory.rb, line 74
def internal_app_key
  type = Rox::Core::CustomPropertyType::STRING

  Rox::Core::DeviceProperty.new(
    'internal.appKey',
    type,
    @server_properties.rollout_key
  )
end
internal_custom_platform() click to toggle source
# File lib/rox/core/properties/property_factory.rb, line 63
def internal_custom_platform
  property = Rox::Core::PropertyType::PLATFORM
  type = Rox::Core::CustomPropertyType::STRING

  Rox::Core::DeviceProperty.new(
    'internal.customPlatform',
    type,
    @server_properties.get(property)
  )
end
internal_distinct_id() click to toggle source
# File lib/rox/core/properties/property_factory.rb, line 84
def internal_distinct_id
  type = Rox::Core::CustomPropertyType::STRING

  Rox::Core::DeviceProperty.new(
    "internal.#{Rox::Core::PropertyType::DISTINCT_ID.name}",
    type
  ) do
    SecureRandom.uuid
  end
end
internal_lib_version() click to toggle source
# File lib/rox/core/properties/property_factory.rb, line 95
def internal_lib_version
  type = Rox::Core::CustomPropertyType::SEMVER

  Rox::Core::DeviceProperty.new(
    'internal.lib_version',
    type,
    @server_properties.lib_version
  )
end
internal_real_platform() click to toggle source
# File lib/rox/core/properties/property_factory.rb, line 52
def internal_real_platform
  property = Rox::Core::PropertyType::PLATFORM
  type = Rox::Core::CustomPropertyType::STRING

  Rox::Core::DeviceProperty.new(
    'internal.realPlatform',
    type,
    @server_properties.get(property)
  )
end
platform() click to toggle source
# File lib/rox/core/properties/property_factory.rb, line 18
def platform
  property = Rox::Core::PropertyType::PLATFORM
  type = Rox::Core::CustomPropertyType::STRING

  Rox::Core::DeviceProperty.new(
    property.name,
    type,
    @server_properties.get(property)
  )
end