Class: Io::Flow::V0::Models::ExperienceClone

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

Overview

Represents a request to clone an experience.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ ExperienceClone

Returns a new instance of ExperienceClone.



41533
41534
41535
41536
41537
41538
41539
41540
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41533

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :source_experience, :status], 'ExperienceClone')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @source_experience = (x = opts.delete(:source_experience); x.is_a?(::Io::Flow::V0::Models::ExperienceReference) ? x : ::Io::Flow::V0::Models::ExperienceReference.new(x))
  @cloned_experience = (x = opts.delete(:cloned_experience); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ExperienceReference) ? x : ::Io::Flow::V0::Models::ExperienceReference.new(x)))
  @status = (x = opts.delete(:status); x.is_a?(::Io::Flow::V0::Models::ExperienceCloneStatus) ? x : ::Io::Flow::V0::Models::ExperienceCloneStatus.apply(x))
end

Instance Attribute Details

#cloned_experienceObject (readonly)

Returns the value of attribute cloned_experience.



41531
41532
41533
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41531

def cloned_experience
  @cloned_experience
end

#idObject (readonly)

Returns the value of attribute id.



41531
41532
41533
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41531

def id
  @id
end

#source_experienceObject (readonly)

Returns the value of attribute source_experience.



41531
41532
41533
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41531

def source_experience
  @source_experience
end

#statusObject (readonly)

Returns the value of attribute status.



41531
41532
41533
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41531

def status
  @status
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



41546
41547
41548
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41546

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

#to_hashObject



41550
41551
41552
41553
41554
41555
41556
41557
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41550

def to_hash
  {
    :id => id,
    :source_experience => source_experience.to_hash,
    :cloned_experience => cloned_experience.nil? ? nil : cloned_experience.to_hash,
    :status => status.value
  }
end

#to_jsonObject



41542
41543
41544
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41542

def to_json
  JSON.dump(to_hash)
end