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.



47581
47582
47583
47584
47585
47586
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47581

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.



47579
47580
47581
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47579

def key
  @key
end

#variantObject (readonly)

Returns the value of attribute variant.



47579
47580
47581
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47579

def variant
  @variant
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



47592
47593
47594
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47592

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

#to_hashObject



47596
47597
47598
47599
47600
47601
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47596

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

#to_jsonObject



47588
47589
47590
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47588

def to_json
  JSON.dump(to_hash)
end