Class: Io::Flow::V0::Models::ExperimentStatus

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

Represents a single instance of an experiment (e.g. page request) resulting in a decision as to the status of a given experiment

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ ExperimentStatus

Returns a new instance of ExperimentStatus.



14636
14637
14638
14639
14640
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14636

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:enabled], 'ExperimentStatus')
  @enabled = HttpClient::Preconditions.assert_boolean('enabled', opts.delete(:enabled))
end

Instance Attribute Details

#enabledObject (readonly)

Returns the value of attribute enabled.



14634
14635
14636
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14634

def enabled
  @enabled
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



14646
14647
14648
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14646

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

#to_hashObject



14650
14651
14652
14653
14654
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14650

def to_hash
  {
    :enabled => enabled
  }
end

#to_jsonObject



14642
14643
14644
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14642

def to_json
  JSON.dump(to_hash)
end