Class: PostHog::SendFeatureFlagsOptions

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

Overview

Options for configuring feature flag behavior in capture calls

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(only_evaluate_locally: nil, person_properties: nil, group_properties: nil) ⇒ SendFeatureFlagsOptions

Returns a new instance of SendFeatureFlagsOptions.



10
11
12
13
14
# File 'lib/posthog/send_feature_flags_options.rb', line 10

def initialize(only_evaluate_locally: nil, person_properties: nil, group_properties: nil)
  @only_evaluate_locally = only_evaluate_locally
  @person_properties = person_properties || {}
  @group_properties = group_properties || {}
end

Instance Attribute Details

#group_propertiesObject (readonly)

Returns the value of attribute group_properties.



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

def group_properties
  @group_properties
end

#only_evaluate_locallyObject (readonly)

Returns the value of attribute only_evaluate_locally.



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

def only_evaluate_locally
  @only_evaluate_locally
end

#person_propertiesObject (readonly)

Returns the value of attribute person_properties.



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

def person_properties
  @person_properties
end

Class Method Details

.from_hash(hash) ⇒ Object



24
25
26
27
28
29
30
31
32
# File 'lib/posthog/send_feature_flags_options.rb', line 24

def self.from_hash(hash)
  return nil unless hash.is_a?(Hash)

  new(
    only_evaluate_locally: PostHog::Utils.get_by_symbol_or_string_key(hash, :only_evaluate_locally),
    person_properties: PostHog::Utils.get_by_symbol_or_string_key(hash, :person_properties),
    group_properties: PostHog::Utils.get_by_symbol_or_string_key(hash, :group_properties)
  )
end

Instance Method Details

#to_hObject



16
17
18
19
20
21
22
# File 'lib/posthog/send_feature_flags_options.rb', line 16

def to_h
  {
    only_evaluate_locally: @only_evaluate_locally,
    person_properties: @person_properties,
    group_properties: @group_properties
  }
end