Class: Shipeasy::Configuration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/shipeasy/config.rb', line 42

def initialize
  @base_url             = "https://edge.shipeasy.dev"
  @attributes           = nil

  @profile              = "default"
  @default_chunk        = "index"
  @cdn_base_url         = "https://cdn.i18n.shipeasy.ai"
  @loader_url           = "https://cdn.i18n.shipeasy.ai/loader.js"
  @manifest_cache_ttl   = 60
  @label_file_cache_ttl = 3600
  @http_timeout         = 1
end

Instance Attribute Details

#api_keyObject

—- experimentation / SDK —-



23
24
25
# File 'lib/shipeasy/config.rb', line 23

def api_key
  @api_key
end

#attributesObject

Optional transform from YOUR user object (any shape) to the Shipeasy attribute hash every flag/experiment evaluation uses. A callable (lambda/proc or anything responding to #call). Default = identity (the user object is assumed to already BE the attribute hash). Runs once, in the Shipeasy::Client constructor.

Shipeasy.configure do |c|
  c.api_key    = ENV["SHIPEASY_SERVER_KEY"]
  c.attributes = ->(u) { { "user_id" => u.id, "plan" => u.plan } }
end


35
36
37
# File 'lib/shipeasy/config.rb', line 35

def attributes
  @attributes
end

#base_urlObject

—- experimentation / SDK —-



23
24
25
# File 'lib/shipeasy/config.rb', line 23

def base_url
  @base_url
end

#cdn_base_urlObject

—- i18n / string manager —-



38
39
40
# File 'lib/shipeasy/config.rb', line 38

def cdn_base_url
  @cdn_base_url
end

#default_chunkObject

—- i18n / string manager —-



38
39
40
# File 'lib/shipeasy/config.rb', line 38

def default_chunk
  @default_chunk
end

#http_timeoutObject

—- i18n / string manager —-



38
39
40
# File 'lib/shipeasy/config.rb', line 38

def http_timeout
  @http_timeout
end

#label_file_cache_ttlObject

—- i18n / string manager —-



38
39
40
# File 'lib/shipeasy/config.rb', line 38

def label_file_cache_ttl
  @label_file_cache_ttl
end

#loader_urlObject

—- i18n / string manager —-



38
39
40
# File 'lib/shipeasy/config.rb', line 38

def loader_url
  @loader_url
end

#manifest_cache_ttlObject

—- i18n / string manager —-



38
39
40
# File 'lib/shipeasy/config.rb', line 38

def manifest_cache_ttl
  @manifest_cache_ttl
end

#profileObject

—- i18n / string manager —-



38
39
40
# File 'lib/shipeasy/config.rb', line 38

def profile
  @profile
end

#public_keyObject

—- i18n / string manager —-



38
39
40
# File 'lib/shipeasy/config.rb', line 38

def public_key
  @public_key
end