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.



32409
32410
32411
32412
32413
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32409

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.



32407
32408
32409
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32407

def key
  @key
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



32419
32420
32421
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32419

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

#to_hashObject



32423
32424
32425
32426
32427
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32423

def to_hash
  {
    :key => key
  }
end

#to_jsonObject



32415
32416
32417
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32415

def to_json
  JSON.dump(to_hash)
end