Class: Tester::ServerResponse
- Defined in:
- lib/tester/models/server_response.rb
Overview
ServerResponse Model.
Instance Attribute Summary collapse
-
#input ⇒ Array<String, Object>
TODO: Write general description for this method.
-
#message ⇒ String
TODO: Write general description for this method.
-
#passed ⇒ Boolean
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(passed = nil, message = nil, input = nil, additional_properties = {}) ⇒ ServerResponse
constructor
A new instance of ServerResponse.
Methods inherited from BaseModel
#method_missing, #respond_to_missing?, #to_hash, #to_json
Constructor Details
#initialize(passed = nil, message = nil, input = nil, additional_properties = {}) ⇒ ServerResponse
Returns a new instance of ServerResponse.
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/tester/models/server_response.rb', line 28 def initialize(passed = nil, = nil, input = nil, additional_properties = {}) @passed = passed @message = @input = input # 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
#input ⇒ Array<String, Object>
TODO: Write general description for this method
17 18 19 |
# File 'lib/tester/models/server_response.rb', line 17 def input @input end |
#message ⇒ String
TODO: Write general description for this method
13 14 15 |
# File 'lib/tester/models/server_response.rb', line 13 def @message end |
#passed ⇒ Boolean
TODO: Write general description for this method
9 10 11 |
# File 'lib/tester/models/server_response.rb', line 9 def passed @passed end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/tester/models/server_response.rb', line 43 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. passed = hash['passed'] = hash['Message'] input = hash['input'] # Clean out expected properties from Hash. names.each_value { |k| hash.delete(k) } # Create object from extracted values. ServerResponse.new(passed, , input, hash) end |
.names ⇒ Object
A mapping from model property names to API property names.
20 21 22 23 24 25 26 |
# File 'lib/tester/models/server_response.rb', line 20 def self.names @_hash = {} if @_hash.nil? @_hash['passed'] = 'passed' @_hash['message'] = 'Message' @_hash['input'] = 'input' @_hash end |