Class: Tester::ServerResponse

Inherits:
BaseModel show all
Defined in:
lib/tester/models/server_response.rb

Overview

ServerResponse Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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,
               message = nil,
               input = nil,
               additional_properties = {})
  @passed = passed
  @message = 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

#inputArray<String, Object>

TODO: Write general description for this method

Returns:



17
18
19
# File 'lib/tester/models/server_response.rb', line 17

def input
  @input
end

#messageString

TODO: Write general description for this method

Returns:



13
14
15
# File 'lib/tester/models/server_response.rb', line 13

def message
  @message
end

#passedBoolean

TODO: Write general description for this method

Returns:

  • (Boolean)


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']
  message = 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,
                     message,
                     input,
                     hash)
end

.namesObject

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