Class: Io::Flow::V0::Models::Experiment
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::Experiment
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Represents a single experiment / test (e.g. for an incremental rollout or AB Test)
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ Experiment
constructor
A new instance of Experiment.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ Experiment
Returns a new instance of Experiment.
13395 13396 13397 13398 13399 13400 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13395 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :key], 'Experiment') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String) end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
13393 13394 13395 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13393 def id @id end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
13393 13394 13395 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13393 def key @key end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
13406 13407 13408 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13406 def copy(incoming={}) Experiment.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
13410 13411 13412 13413 13414 13415 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13410 def to_hash { :id => id, :key => key } end |
#to_json ⇒ Object
13402 13403 13404 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13402 def to_json JSON.dump(to_hash) end |