Class: DevCycle::PlatformData

Inherits:
Object
  • Object
show all
Defined in:
lib/devcycle-ruby-server-sdk/localbucketing/platform_data.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sdk_type = nil, sdk_version = nil, platform_version = nil, device_model = nil, platform = nil, hostname = nil) ⇒ PlatformData

Returns a new instance of PlatformData.



10
11
12
13
14
15
16
17
# File 'lib/devcycle-ruby-server-sdk/localbucketing/platform_data.rb', line 10

def initialize(sdk_type = nil, sdk_version = nil, platform_version = nil, device_model = nil, platform = nil, hostname = nil)
  @sdkType = sdk_type
  @sdkVersion = sdk_version
  @platformVersion = platform_version
  @deviceModel = device_model
  @platform = platform
  @hostname = hostname
end

Instance Attribute Details

#deviceModelObject

Returns the value of attribute deviceModel.



8
9
10
# File 'lib/devcycle-ruby-server-sdk/localbucketing/platform_data.rb', line 8

def deviceModel
  @deviceModel
end

#hostnameObject

Returns the value of attribute hostname.



8
9
10
# File 'lib/devcycle-ruby-server-sdk/localbucketing/platform_data.rb', line 8

def hostname
  @hostname
end

#platformObject

Returns the value of attribute platform.



8
9
10
# File 'lib/devcycle-ruby-server-sdk/localbucketing/platform_data.rb', line 8

def platform
  @platform
end

#platformVersionObject

Returns the value of attribute platformVersion.



8
9
10
# File 'lib/devcycle-ruby-server-sdk/localbucketing/platform_data.rb', line 8

def platformVersion
  @platformVersion
end

#sdkTypeObject

Returns the value of attribute sdkType.



8
9
10
# File 'lib/devcycle-ruby-server-sdk/localbucketing/platform_data.rb', line 8

def sdkType
  @sdkType
end

#sdkVersionObject

Returns the value of attribute sdkVersion.



8
9
10
# File 'lib/devcycle-ruby-server-sdk/localbucketing/platform_data.rb', line 8

def sdkVersion
  @sdkVersion
end

Instance Method Details

#defaultObject



19
20
21
22
23
24
25
26
27
# File 'lib/devcycle-ruby-server-sdk/localbucketing/platform_data.rb', line 19

def default
  @sdkType = 'server'
  @sdkVersion = VERSION
  @platformVersion = RUBY_VERSION
  @deviceModel = nil
  @platform = 'Ruby'
  @hostname = Socket.gethostname
  self
end

#to_hashObject



29
30
31
32
33
34
35
36
37
38
# File 'lib/devcycle-ruby-server-sdk/localbucketing/platform_data.rb', line 29

def to_hash
  {
    sdkType: @sdkType,
    sdkVersion: @sdkVersion,
    platformVersion: @platformVersion,
    deviceModel: @deviceModel,
    platform: @platform,
    hostname: @hostname
  }
end

#to_jsonObject



40
41
42
# File 'lib/devcycle-ruby-server-sdk/localbucketing/platform_data.rb', line 40

def to_json
  Oj.dump(to_hash, mode: :json)
end