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.



49050
49051
49052
49053
49054
49055
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49050

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.



49048
49049
49050
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49048

def key
  @key
end

#variantObject (readonly)

Returns the value of attribute variant.



49048
49049
49050
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49048

def variant
  @variant
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



49061
49062
49063
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49061

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

#to_hashObject



49065
49066
49067
49068
49069
49070
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49065

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

#to_jsonObject



49057
49058
49059
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49057

def to_json
  JSON.dump(to_hash)
end