Class: Io::Flow::V0::Models::ExperimentVariant

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

Experiment variant. Control or variant

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ ExperimentVariant

Returns a new instance of ExperimentVariant.



32360
32361
32362
32363
32364
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32360

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:key], 'ExperimentVariant')
  @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



32358
32359
32360
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32358

def key
  @key
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



32370
32371
32372
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32370

def copy(incoming={})
  ExperimentVariant.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



32374
32375
32376
32377
32378
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32374

def to_hash
  {
    :key => key
  }
end

#to_jsonObject



32366
32367
32368
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32366

def to_json
  JSON.dump(to_hash)
end