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.



46906
46907
46908
46909
46910
46911
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46906

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

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



46904
46905
46906
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46904

def key
  @key
end

#nameObject (readonly)

Returns the value of attribute name.



46904
46905
46906
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46904

def name
  @name
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



46917
46918
46919
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46917

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

#to_hashObject



46921
46922
46923
46924
46925
46926
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46921

def to_hash
  {
    :key => key,
    :name => name
  }
end

#to_jsonObject



46913
46914
46915
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46913

def to_json
  JSON.dump(to_hash)
end