Sha256: 080ef66f95a315ef1a87175d189cf8ff011fd93a6589fc8751e6048c1929e766

Contents?: true

Size: 1.11 KB

Versions: 8

Compression:

Stored size: 1.11 KB

Contents

# frozen_string_literal: true

class ClientConfig
  attr_accessor :endpoint, :api_key, :environment, :application, :deserializer,
                :serializer, :executor

  def self.create
    ClientConfig.new
  end

  def self.create_from_properties(properties, prefix)
    properties = properties.transform_keys(&:to_sym)
    client_config = create
    client_config.endpoint = properties["#{prefix}endpoint".to_sym]
    client_config.environment = properties["#{prefix}environment".to_sym]
    client_config.application = properties["#{prefix}application".to_sym]
    client_config.api_key = properties["#{prefix}apikey".to_sym]
    client_config
  end

  def initialize(endpoint: nil, environment: nil, application: nil, api_key: nil)
    @endpoint = endpoint
    @environment = environment
    @application = application
    @api_key = api_key
  end

  def context_data_deserializer
    @deserializer
  end

  def context_data_deserializer=(deserializer)
    @deserializer = deserializer
  end

  def context_event_serializer
    @serializer
  end

  def context_event_serializer=(serializer)
    @serializer = serializer
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
absmartly-sdk-1.1.2 lib/client_config.rb
absmartly-sdk-1.1.1 lib/client_config.rb
absmartly-sdk-1.1.0 lib/client_config.rb
absmartly-sdk-1.0.8 lib/client_config.rb
absmartly-sdk-1.0.7 lib/client_config.rb
absmartly-sdk-1.0.6 lib/client_config.rb
absmartly-sdk-1.0.5 lib/client_config.rb
absmartly-sdk-0.1.2 lib/client_config.rb