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.



58114
58115
58116
58117
58118
58119
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58114

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.



58112
58113
58114
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58112

def key
  @key
end

#variantObject (readonly)

Returns the value of attribute variant.



58112
58113
58114
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58112

def variant
  @variant
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



58125
58126
58127
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58125

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

#to_hashObject



58129
58130
58131
58132
58133
58134
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58129

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

#to_jsonObject



58121
58122
58123
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58121

def to_json
  JSON.dump(to_hash)
end