Class: Statsig::APIConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/api_config.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#default_valueObject

Returns the value of attribute default_value.



8
9
10
# File 'lib/api_config.rb', line 8

def default_value
  @default_value
end

#enabledObject

Returns the value of attribute enabled.



8
9
10
# File 'lib/api_config.rb', line 8

def enabled
  @enabled
end

#entityObject

Returns the value of attribute entity.



8
9
10
# File 'lib/api_config.rb', line 8

def entity
  @entity
end

#explicit_parametersObject

Returns the value of attribute explicit_parameters.



8
9
10
# File 'lib/api_config.rb', line 8

def explicit_parameters
  @explicit_parameters
end

#has_shared_paramsObject

Returns the value of attribute has_shared_params.



8
9
10
# File 'lib/api_config.rb', line 8

def has_shared_params
  @has_shared_params
end

#id_typeObject

Returns the value of attribute id_type.



8
9
10
# File 'lib/api_config.rb', line 8

def id_type
  @id_type
end

#is_activeObject

Returns the value of attribute is_active.



8
9
10
# File 'lib/api_config.rb', line 8

def is_active
  @is_active
end

#nameObject

Returns the value of attribute name.



8
9
10
# File 'lib/api_config.rb', line 8

def name
  @name
end

#rulesObject

Returns the value of attribute rules.



8
9
10
# File 'lib/api_config.rb', line 8

def rules
  @rules
end

#saltObject

Returns the value of attribute salt.



8
9
10
# File 'lib/api_config.rb', line 8

def salt
  @salt
end

#target_app_idsObject

Returns the value of attribute target_app_ids.



8
9
10
# File 'lib/api_config.rb', line 8

def target_app_ids
  @target_app_ids
end

#typeObject

Returns the value of attribute type.



8
9
10
# File 'lib/api_config.rb', line 8

def type
  @type
end

Class Method Details

.from_json(json) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/api_config.rb', line 11

def self.from_json(json)
  new(
    name: json[:name],
    type: json[:type],
    is_active: json[:isActive],
    salt: json[:salt],
    default_value: json[:defaultValue] || {},
    enabled: json[:enabled],
    rules: json[:rules]&.map do |rule|
      APIRule.from_json(rule)
    end,
    id_type: json[:idType],
    entity: json[:entity],
    explicit_parameters: json[:explicitParameters],
    has_shared_params: json[:hasSharedParams],
    target_app_ids: json[:targetAppIDs]
  )
end