Class: Itly::Plugin::Iteratively
- Inherits:
-
Itly::Plugin
- Object
- Itly::Plugin
- Itly::Plugin::Iteratively
- Defined in:
- lib/itly/plugin/iteratively/iteratively.rb,
lib/itly/plugin/iteratively/client.rb,
lib/itly/plugin/iteratively/options.rb,
lib/itly/plugin/iteratively/version.rb,
lib/itly/plugin/iteratively/track_type.rb,
lib/itly/plugin/iteratively/track_model.rb
Overview
Iteratively plugin class for Itly SDK
Automatically loaded at runtime in any new Itly
object
Defined Under Namespace
Modules: TrackType Classes: Client, Options, TrackModel
Constant Summary collapse
- VERSION =
'0.1.1'
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#disabled ⇒ Object
readonly
Returns the value of attribute disabled.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #flush ⇒ Object
-
#id ⇒ String
Get the plugin ID.
-
#initialize(api_key:, options:) ⇒ Iteratively
constructor
Instantiate a new Plugin::Iteratively.
-
#load(options:) ⇒ Object
Initialize IterativelyApi client.
- #post_group(user_id:, group_id:, properties:, validation_results:) ⇒ Object
- #post_identify(user_id:, properties:, validation_results:) ⇒ Object
- #post_track(user_id:, event:, validation_results:) ⇒ Object
- #shutdown(force: false) ⇒ Object
Constructor Details
#initialize(api_key:, options:) ⇒ Iteratively
Instantiate a new Plugin::Iteratively
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/itly/plugin/iteratively/iteratively.rb', line 21 def initialize(api_key:, options:) super() @api_key = api_key @url = .url @disabled = .disabled @client_options = { flush_queue_size: .flush_queue_size, batch_size: .batch_size, flush_interval_ms: .flush_interval_ms, max_retries: .max_retries, retry_delay_min: .retry_delay_min, retry_delay_max: .retry_delay_max, omit_values: .omit_values, branch: .branch, version: .version } end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
13 14 15 |
# File 'lib/itly/plugin/iteratively/iteratively.rb', line 13 def api_key @api_key end |
#client ⇒ Object (readonly)
Returns the value of attribute client.
13 14 15 |
# File 'lib/itly/plugin/iteratively/iteratively.rb', line 13 def client @client end |
#disabled ⇒ Object (readonly)
Returns the value of attribute disabled.
13 14 15 |
# File 'lib/itly/plugin/iteratively/iteratively.rb', line 13 def disabled @disabled end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
13 14 15 |
# File 'lib/itly/plugin/iteratively/iteratively.rb', line 13 def logger @logger end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
13 14 15 |
# File 'lib/itly/plugin/iteratively/iteratively.rb', line 13 def url @url end |
Instance Method Details
#flush ⇒ Object
103 104 105 |
# File 'lib/itly/plugin/iteratively/iteratively.rb', line 103 def flush @client.flush end |
#id ⇒ String
Get the plugin ID
116 117 118 |
# File 'lib/itly/plugin/iteratively/iteratively.rb', line 116 def id 'iteratively' end |
#load(options:) ⇒ Object
Initialize IterativelyApi client
The plugin is automatically disabled in Production
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/itly/plugin/iteratively/iteratively.rb', line 47 def load(options:) super # Get options @logger = .logger # Log logger&.info "#{id}: load()" # Disabled @disabled = .environment == Itly::Options::Environment::PRODUCTION if @disabled.nil? if @disabled logger&.info "#{id}: plugin is disabled!" return end # Client @client_options.merge! url: @url, api_key: @api_key, logger: @logger @client = Itly::Plugin::Iteratively::Client.new(**@client_options) end |
#post_group(user_id:, group_id:, properties:, validation_results:) ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/itly/plugin/iteratively/iteratively.rb', line 79 def post_group(user_id:, group_id:, properties:, validation_results:) super return unless enabled? # Log log = Itly::Loggers.vars_to_log( user_id: user_id, group_id: group_id, properties: properties, validation_results: validation_results ) logger&.info "#{id}: post_group(#{log})" client_track Itly::Plugin::Iteratively::TrackType::GROUP, properties, validation_results end |
#post_identify(user_id:, properties:, validation_results:) ⇒ Object
68 69 70 71 72 73 74 75 76 77 |
# File 'lib/itly/plugin/iteratively/iteratively.rb', line 68 def post_identify(user_id:, properties:, validation_results:) super return unless enabled? # Log log = Itly::Loggers.vars_to_log user_id: user_id, properties: properties, validation_results: validation_results logger&.info "#{id}: post_identify(#{log})" client_track Itly::Plugin::Iteratively::TrackType::IDENTIFY, properties, validation_results end |
#post_track(user_id:, event:, validation_results:) ⇒ Object
92 93 94 95 96 97 98 99 100 101 |
# File 'lib/itly/plugin/iteratively/iteratively.rb', line 92 def post_track(user_id:, event:, validation_results:) super return unless enabled? # Log log = Itly::Loggers.vars_to_log user_id: user_id, event: event, validation_results: validation_results logger&.info "#{id}: post_track(#{log})" client_track Itly::Plugin::Iteratively::TrackType::TRACK, event, validation_results end |
#shutdown(force: false) ⇒ Object
107 108 109 |
# File 'lib/itly/plugin/iteratively/iteratively.rb', line 107 def shutdown(force: false) @client.shutdown force: force end |