Class: Io::Flow::V0::Models::SessionExperimentVariant

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 = {}) ⇒ SessionExperimentVariant

Returns a new instance of SessionExperimentVariant.



30252
30253
30254
30255
30256
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30252

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

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



30250
30251
30252
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30250

def key
  @key
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



30262
30263
30264
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30262

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

#to_hashObject



30266
30267
30268
30269
30270
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30266

def to_hash
  {
    :key => key
  }
end

#to_jsonObject



30258
30259
30260
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30258

def to_json
  JSON.dump(to_hash)
end