Class: Io::Flow::V0::Models::SessionExperimentForm

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ SessionExperimentForm

Returns a new instance of SessionExperimentForm.



43827
43828
43829
43830
43831
43832
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43827

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:key], 'SessionExperimentForm')
  @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::SessionExperimentVariantForm) ? x : ::Io::Flow::V0::Models::SessionExperimentVariantForm.new(x)))
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



43825
43826
43827
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43825

def key
  @key
end

#variantObject (readonly)

Returns the value of attribute variant.



43825
43826
43827
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43825

def variant
  @variant
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



43838
43839
43840
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43838

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

#to_hashObject



43842
43843
43844
43845
43846
43847
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43842

def to_hash
  {
    :key => key,
    :variant => variant.nil? ? nil : variant.to_hash
  }
end

#to_jsonObject



43834
43835
43836
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43834

def to_json
  JSON.dump(to_hash)
end