Class: DevCycle::Options
- Inherits:
-
Object
- Object
- DevCycle::Options
- Defined in:
- lib/devcycle-ruby-server-sdk/localbucketing/options.rb
Instance Attribute Summary collapse
-
#bucketing_api_uri ⇒ Object
readonly
Returns the value of attribute bucketing_api_uri.
-
#config_cdn_uri ⇒ Object
readonly
Returns the value of attribute config_cdn_uri.
-
#config_polling_interval_ms ⇒ Object
readonly
Returns the value of attribute config_polling_interval_ms.
-
#disable_realtime_updates ⇒ Object
readonly
Returns the value of attribute disable_realtime_updates.
-
#enable_beta_realtime_updates ⇒ Object
readonly
Returns the value of attribute enable_beta_realtime_updates.
-
#enable_cloud_bucketing ⇒ Object
readonly
Returns the value of attribute enable_cloud_bucketing.
-
#enable_edge_db ⇒ Object
readonly
Returns the value of attribute enable_edge_db.
-
#events_api_uri ⇒ Object
readonly
Returns the value of attribute events_api_uri.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
- #event_queue_options ⇒ Object
-
#initialize(enable_cloud_bucketing: false, event_flush_interval_ms: 10_000, disable_custom_event_logging: false, disable_automatic_event_logging: false, config_polling_interval_ms: 10_000, enable_beta_realtime_updates: false, disable_realtime_updates: false, request_timeout_ms: 5_000, max_event_queue_size: 2_000, flush_event_queue_size: 1_000, event_request_chunk_size: 100, logger: nil, config_cdn_uri: 'https://config-cdn.devcycle.com', events_api_uri: 'https://events.devcycle.com', enable_edge_db: false) ⇒ Options
constructor
A new instance of Options.
Constructor Details
#initialize(enable_cloud_bucketing: false, event_flush_interval_ms: 10_000, disable_custom_event_logging: false, disable_automatic_event_logging: false, config_polling_interval_ms: 10_000, enable_beta_realtime_updates: false, disable_realtime_updates: false, request_timeout_ms: 5_000, max_event_queue_size: 2_000, flush_event_queue_size: 1_000, event_request_chunk_size: 100, logger: nil, config_cdn_uri: 'https://config-cdn.devcycle.com', events_api_uri: 'https://events.devcycle.com', enable_edge_db: false) ⇒ Options
Returns a new instance of Options.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/devcycle-ruby-server-sdk/localbucketing/options.rb', line 13 def initialize( enable_cloud_bucketing: false, event_flush_interval_ms: 10_000, disable_custom_event_logging: false, disable_automatic_event_logging: false, config_polling_interval_ms: 10_000, enable_beta_realtime_updates: false, disable_realtime_updates: false, request_timeout_ms: 5_000, max_event_queue_size: 2_000, flush_event_queue_size: 1_000, event_request_chunk_size: 100, logger: nil, config_cdn_uri: 'https://config-cdn.devcycle.com', events_api_uri: 'https://events.devcycle.com', enable_edge_db: false ) @logger = logger || defined?(Rails) ? Rails.logger : Logger.new(STDOUT) @enable_cloud_bucketing = enable_cloud_bucketing @enable_edge_db = enable_edge_db if !@enable_cloud_bucketing && @enable_edge_db raise ArgumentError.new('Cannot enable edgedb without enabling cloud bucketing.') end if config_polling_interval_ms < 1000 raise ArgumentError.new('config_polling_interval cannot be less than 1000ms') end @config_polling_interval_ms = config_polling_interval_ms if request_timeout_ms <= 5000 request_timeout_ms = 5000 end @request_timeout_ms = request_timeout_ms if event_flush_interval_ms < 500 || event_flush_interval_ms > (60 * 1000) raise ArgumentError.new('event_flush_interval_ms must be between 500ms and 1 minute') end @event_flush_interval_ms = event_flush_interval_ms if flush_event_queue_size >= max_event_queue_size raise ArgumentError.new( "flush_event_queue_size: #{flush_event_queue_size} must be " + "smaller than max_event_queue_size: #{@max_event_queue_size}" ) elsif flush_event_queue_size < event_request_chunk_size || max_event_queue_size < event_request_chunk_size throw ArgumentError.new( "flush_event_queue_size: #{flush_event_queue_size} and " + "max_event_queue_size: #{max_event_queue_size} " + "must be larger than event_request_chunk_size: #{event_request_chunk_size}" ) elsif flush_event_queue_size > 20000 || max_event_queue_size > 20000 raise ArgumentError.new( "flush_event_queue_size: #{flush_event_queue_size} or " + "max_event_queue_size: #{max_event_queue_size} must be smaller than 20,000" ) end @flush_event_queue_size = flush_event_queue_size @max_event_queue_size = max_event_queue_size @event_request_chunk_size = event_request_chunk_size @disable_custom_event_logging = disable_custom_event_logging @disable_automatic_event_logging = disable_automatic_event_logging if enable_beta_realtime_updates warn '[DEPRECATION] `enable_beta_realtime_updates` is deprecated and will be removed in a future release.' end @enable_beta_realtime_updates = enable_beta_realtime_updates @disable_realtime_updates = disable_realtime_updates @config_cdn_uri = config_cdn_uri @events_api_uri = events_api_uri @bucketing_api_uri = "https://bucketing-api.devcyle.com" end |
Instance Attribute Details
#bucketing_api_uri ⇒ Object (readonly)
Returns the value of attribute bucketing_api_uri.
10 11 12 |
# File 'lib/devcycle-ruby-server-sdk/localbucketing/options.rb', line 10 def bucketing_api_uri @bucketing_api_uri end |
#config_cdn_uri ⇒ Object (readonly)
Returns the value of attribute config_cdn_uri.
8 9 10 |
# File 'lib/devcycle-ruby-server-sdk/localbucketing/options.rb', line 8 def config_cdn_uri @config_cdn_uri end |
#config_polling_interval_ms ⇒ Object (readonly)
Returns the value of attribute config_polling_interval_ms.
3 4 5 |
# File 'lib/devcycle-ruby-server-sdk/localbucketing/options.rb', line 3 def config_polling_interval_ms @config_polling_interval_ms end |
#disable_realtime_updates ⇒ Object (readonly)
Returns the value of attribute disable_realtime_updates.
7 8 9 |
# File 'lib/devcycle-ruby-server-sdk/localbucketing/options.rb', line 7 def disable_realtime_updates @disable_realtime_updates end |
#enable_beta_realtime_updates ⇒ Object (readonly)
Returns the value of attribute enable_beta_realtime_updates.
6 7 8 |
# File 'lib/devcycle-ruby-server-sdk/localbucketing/options.rb', line 6 def enable_beta_realtime_updates @enable_beta_realtime_updates end |
#enable_cloud_bucketing ⇒ Object (readonly)
Returns the value of attribute enable_cloud_bucketing.
5 6 7 |
# File 'lib/devcycle-ruby-server-sdk/localbucketing/options.rb', line 5 def enable_cloud_bucketing @enable_cloud_bucketing end |
#enable_edge_db ⇒ Object (readonly)
Returns the value of attribute enable_edge_db.
4 5 6 |
# File 'lib/devcycle-ruby-server-sdk/localbucketing/options.rb', line 4 def enable_edge_db @enable_edge_db end |
#events_api_uri ⇒ Object (readonly)
Returns the value of attribute events_api_uri.
9 10 11 |
# File 'lib/devcycle-ruby-server-sdk/localbucketing/options.rb', line 9 def events_api_uri @events_api_uri end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
11 12 13 |
# File 'lib/devcycle-ruby-server-sdk/localbucketing/options.rb', line 11 def logger @logger end |
Instance Method Details
#event_queue_options ⇒ Object
89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/devcycle-ruby-server-sdk/localbucketing/options.rb', line 89 def EventQueueOptions.new( @event_flush_interval_ms, @disable_automatic_event_logging, @disable_custom_event_logging, @max_event_queue_size, @flush_event_queue_size, @events_api_uri, @event_request_chunk_size, @logger ) end |