Class: Tester::TestRstringEncoding
- Defined in:
- lib/tester/models/test_rstring_encoding.rb
Overview
TestRstringEncoding Model.
Instance Attribute Summary collapse
-
#field ⇒ String
TODO: Write general description for this method.
-
#name ⇒ String
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.
Instance Method Summary collapse
-
#initialize(field = nil, name = nil, additional_properties = {}) ⇒ TestRstringEncoding
constructor
A new instance of TestRstringEncoding.
Methods inherited from BaseModel
#method_missing, #respond_to_missing?, #to_hash, #to_json
Constructor Details
#initialize(field = nil, name = nil, additional_properties = {}) ⇒ TestRstringEncoding
Returns a new instance of TestRstringEncoding.
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/tester/models/test_rstring_encoding.rb', line 23 def initialize(field = nil, name = nil, additional_properties = {}) @field = field @name = name # Add additional model properties to the instance. additional_properties.each do |_name, value| instance_variable_set("@#{_name}", value) end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Tester::BaseModel
Instance Attribute Details
#field ⇒ String
TODO: Write general description for this method
9 10 11 |
# File 'lib/tester/models/test_rstring_encoding.rb', line 9 def field @field end |
#name ⇒ String
TODO: Write general description for this method
13 14 15 |
# File 'lib/tester/models/test_rstring_encoding.rb', line 13 def name @name end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/tester/models/test_rstring_encoding.rb', line 36 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. field = hash['field'] name = hash['name'] # Clean out expected properties from Hash. names.each_value { |k| hash.delete(k) } # Create object from extracted values. TestRstringEncoding.new(field, name, hash) end |
.names ⇒ Object
A mapping from model property names to API property names.
16 17 18 19 20 21 |
# File 'lib/tester/models/test_rstring_encoding.rb', line 16 def self.names @_hash = {} if @_hash.nil? @_hash['field'] = 'field' @_hash['name'] = 'name' @_hash end |