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.



32960
32961
32962
32963
32964
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32960

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.



32958
32959
32960
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32958

def key
  @key
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



32970
32971
32972
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32970

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

#to_hashObject



32974
32975
32976
32977
32978
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32974

def to_hash
  {
    :key => key
  }
end

#to_jsonObject



32966
32967
32968
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32966

def to_json
  JSON.dump(to_hash)
end