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.
15770 15771 15772 15773 15774 15775 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15770 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.
15768 15769 15770 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15768 def id @id end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
15768 15769 15770 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15768 def key @key end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
15781 15782 15783 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15781 def copy(incoming={}) Experiment.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
15785 15786 15787 15788 15789 15790 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15785 def to_hash { :id => id, :key => key } end |
#to_json ⇒ Object
15777 15778 15779 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15777 def to_json JSON.dump(to_hash) end |