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.



46877
46878
46879
46880
46881
46882
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46877

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.



46875
46876
46877
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46875

def key
  @key
end

#variantObject (readonly)

Returns the value of attribute variant.



46875
46876
46877
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46875

def variant
  @variant
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



46888
46889
46890
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46888

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

#to_hashObject



46892
46893
46894
46895
46896
46897
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46892

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

#to_jsonObject



46884
46885
46886
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46884

def to_json
  JSON.dump(to_hash)
end