Class: Optimizely::Variation

Inherits:
Object
  • Object
show all
Defined in:
lib/optimizely/variation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ Variation

Returns a new instance of Variation.



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/optimizely/variation.rb', line 7

def initialize(json)
  @json = json
  @is_paused = json['is_paused']
  @description = json['description']
  @weight = json['weight']
  @created = DateTime.parse(json['created'])
  @variation_id = json['variation_id']
  @section_id = json['section_id']
  @js_component = json['js_component']
  @experiment_id = json['experiment_id']
  @project_id = json['project_id']
  @id = json['id']
end

Instance Attribute Details

#createdObject (readonly)

Returns the value of attribute created.



4
5
6
# File 'lib/optimizely/variation.rb', line 4

def created
  @created
end

#descriptionObject (readonly)

Returns the value of attribute description.



4
5
6
# File 'lib/optimizely/variation.rb', line 4

def description
  @description
end

#experiment_idObject (readonly)

Returns the value of attribute experiment_id.



4
5
6
# File 'lib/optimizely/variation.rb', line 4

def experiment_id
  @experiment_id
end

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/optimizely/variation.rb', line 4

def id
  @id
end

#is_pausedObject (readonly)

Returns the value of attribute is_paused.



4
5
6
# File 'lib/optimizely/variation.rb', line 4

def is_paused
  @is_paused
end

#js_componentObject (readonly)

Returns the value of attribute js_component.



4
5
6
# File 'lib/optimizely/variation.rb', line 4

def js_component
  @js_component
end

#project_idObject (readonly)

Returns the value of attribute project_id.



4
5
6
# File 'lib/optimizely/variation.rb', line 4

def project_id
  @project_id
end

#section_idObject (readonly)

Returns the value of attribute section_id.



4
5
6
# File 'lib/optimizely/variation.rb', line 4

def section_id
  @section_id
end

#variation_idObject (readonly)

Returns the value of attribute variation_id.



4
5
6
# File 'lib/optimizely/variation.rb', line 4

def variation_id
  @variation_id
end

#weightObject (readonly)

Returns the value of attribute weight.



4
5
6
# File 'lib/optimizely/variation.rb', line 4

def weight
  @weight
end

Instance Method Details

#[](x) ⇒ Object



21
22
23
# File 'lib/optimizely/variation.rb', line 21

def [](x)
  return @json[x]
end