Class: NewStoreApi::Experiment
- Defined in:
- lib/new_store_api/models/experiment.rb
Overview
Experiment Model.
Instance Attribute Summary collapse
-
#combine ⇒ CombineEnum
TODO: Write general description for this method.
-
#meta_data ⇒ MetaData
TODO: Write general description for this method.
-
#rules ⇒ Rules
TODO: Write general description for this method.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(combine = CombineEnum::AND, rules = nil, meta_data = SKIP) ⇒ Experiment
constructor
A new instance of Experiment.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(combine = CombineEnum::AND, rules = nil, meta_data = SKIP) ⇒ Experiment
Returns a new instance of Experiment.
45 46 47 48 49 |
# File 'lib/new_store_api/models/experiment.rb', line 45 def initialize(combine = CombineEnum::AND, rules = nil, = SKIP) @combine = combine @meta_data = unless == SKIP @rules = rules end |
Instance Attribute Details
#combine ⇒ CombineEnum
TODO: Write general description for this method
14 15 16 |
# File 'lib/new_store_api/models/experiment.rb', line 14 def combine @combine end |
#meta_data ⇒ MetaData
TODO: Write general description for this method
18 19 20 |
# File 'lib/new_store_api/models/experiment.rb', line 18 def @meta_data end |
#rules ⇒ Rules
TODO: Write general description for this method
22 23 24 |
# File 'lib/new_store_api/models/experiment.rb', line 22 def rules @rules end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/new_store_api/models/experiment.rb', line 52 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. combine = hash['combine'] ||= CombineEnum::AND rules = Rules.from_hash(hash['rules']) if hash['rules'] = MetaData.from_hash(hash['metaData']) if hash['metaData'] # Create object from extracted values. Experiment.new(combine, rules, ) end |
.names ⇒ Object
A mapping from model property names to API property names.
25 26 27 28 29 30 31 |
# File 'lib/new_store_api/models/experiment.rb', line 25 def self.names @_hash = {} if @_hash.nil? @_hash['combine'] = 'combine' @_hash['meta_data'] = 'metaData' @_hash['rules'] = 'rules' @_hash end |
.nullables ⇒ Object
An array for nullable fields
41 42 43 |
# File 'lib/new_store_api/models/experiment.rb', line 41 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
34 35 36 37 38 |
# File 'lib/new_store_api/models/experiment.rb', line 34 def self.optionals %w[ meta_data ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
73 74 75 76 77 |
# File 'lib/new_store_api/models/experiment.rb', line 73 def inspect class_name = self.class.name.split('::').last "<#{class_name} combine: #{@combine.inspect}, meta_data: #{@meta_data.inspect}, rules:"\ " #{@rules.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
67 68 69 70 |
# File 'lib/new_store_api/models/experiment.rb', line 67 def to_s class_name = self.class.name.split('::').last "<#{class_name} combine: #{@combine}, meta_data: #{@meta_data}, rules: #{@rules}>" end |