Class: Rox::Core::DeviceProperties

Inherits:
Object
  • Object
show all
Defined in:
lib/rox/core/client/device_properties.rb

Direct Known Subclasses

Server::ServerProperties

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sdk_settings, rox_options) ⇒ DeviceProperties

Returns a new instance of DeviceProperties.



9
10
11
12
# File 'lib/rox/core/client/device_properties.rb', line 9

def initialize(sdk_settings, rox_options)
  @sdk_settings = sdk_settings
  @rox_options = rox_options
end

Instance Attribute Details

#rox_optionsObject (readonly)

Returns the value of attribute rox_options.



7
8
9
# File 'lib/rox/core/client/device_properties.rb', line 7

def rox_options
  @rox_options
end

Instance Method Details

#all_propertiesObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/rox/core/client/device_properties.rb', line 18

def all_properties
  {
    PropertyType::PACKAGE_NAME.name => @rox_options.version,
    PropertyType::VERSION_NAME.name => @rox_options.version,
    PropertyType::LIB_VERSION.name => lib_version,
    PropertyType::ROLLOUT_BUILD.name => '50',
    PropertyType::API_VERSION.name => Build::API_VERSION,
    PropertyType::APP_VERSION.name => @rox_options.version,
    PropertyType::APP_RELEASE.name => @rox_options.version,
    PropertyType::DISTINCT_ID.name => distinct_id,
    PropertyType::APP_KEY.name => @sdk_settings.api_key,
    PropertyType::PLATFORM.name => Build::PLATFORM
  }
end

#distinct_idObject



46
47
48
# File 'lib/rox/core/client/device_properties.rb', line 46

def distinct_id
  'stam'
end

#get(property) ⇒ Object



14
15
16
# File 'lib/rox/core/client/device_properties.rb', line 14

def get(property)
  all_properties[property.name]
end

#lib_versionObject



38
39
40
# File 'lib/rox/core/client/device_properties.rb', line 38

def lib_version
  '1.0.0'
end

#rollout_environmentObject



33
34
35
36
# File 'lib/rox/core/client/device_properties.rb', line 33

def rollout_environment
  env = ENV['ROLLOUT_MODE']
  %w[QA LOCAL].include?(env) ? env : 'PRODUCTION'
end

#rollout_keyObject



42
43
44
# File 'lib/rox/core/client/device_properties.rb', line 42

def rollout_key
  all_properties[PropertyType::APP_KEY.name]
end