Class: Io::Flow::V0::Models::SessionExperiment
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::SessionExperiment
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Experiment for A/B testing
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#variant ⇒ Object
readonly
Returns the value of attribute variant.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ SessionExperiment
constructor
A new instance of SessionExperiment.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ SessionExperiment
Returns a new instance of SessionExperiment.
38042 38043 38044 38045 38046 38047 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38042 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:key], 'SessionExperiment') @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String) @variant = (x = opts.delete(:variant); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::SessionExperimentVariant) ? x : ::Io::Flow::V0::Models::SessionExperimentVariant.new(x))) end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
38040 38041 38042 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38040 def key @key end |
#variant ⇒ Object (readonly)
Returns the value of attribute variant.
38040 38041 38042 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38040 def variant @variant end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
38053 38054 38055 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38053 def copy(incoming={}) SessionExperiment.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
38057 38058 38059 38060 38061 38062 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38057 def to_hash { :key => key, :variant => variant.nil? ? nil : variant.to_hash } end |
#to_json ⇒ Object
38049 38050 38051 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38049 def to_json JSON.dump(to_hash) end |