Class: Prismic::Experiment

Inherits:
Object
  • Object
show all
Defined in:
lib/prismic/experiments.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, google_id, name, variations) ⇒ Experiment

Returns a new instance of Experiment.



64
65
66
67
68
69
# File 'lib/prismic/experiments.rb', line 64

def initialize(id, google_id, name, variations)
  @id = id
  @google_id = google_id
  @name = name
  @variations = variations
end

Instance Attribute Details

#google_idString (readonly)

Returns:

  • (String)


58
59
60
# File 'lib/prismic/experiments.rb', line 58

def google_id
  @google_id
end

#idString (readonly)

Returns:

  • (String)


56
57
58
# File 'lib/prismic/experiments.rb', line 56

def id
  @id
end

#nameString (readonly)

Returns:

  • (String)


60
61
62
# File 'lib/prismic/experiments.rb', line 60

def name
  @name
end

#variationsArray<Variation> (readonly)

Returns:



62
63
64
# File 'lib/prismic/experiments.rb', line 62

def variations
  @variations
end

Class Method Details

.parse(data) ⇒ Experiment

Returns:



72
73
74
75
76
# File 'lib/prismic/experiments.rb', line 72

def self.parse(data)
  new(data['id'], data['googleId'], data['name'], data['variations'].map { |variation|
    Variation.parse(variation)
  })
end