Class: Tester::QueryParameter

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

Overview

Query parameter key value pair echoed back from the server.

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(key = nil, additional_properties = {}) ⇒ QueryParameter

Returns a new instance of QueryParameter.



18
19
20
21
22
23
24
25
26
# File 'lib/tester/models/query_parameter.rb', line 18

def initialize(key = nil,
               additional_properties = {})
  @key = key

  # 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

#keyString

TODO: Write general description for this method

Returns:



9
10
11
# File 'lib/tester/models/query_parameter.rb', line 9

def key
  @key
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/tester/models/query_parameter.rb', line 29

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  key = hash['key']

  # Clean out expected properties from Hash.
  names.each_value { |k| hash.delete(k) }

  # Create object from extracted values.
  QueryParameter.new(key,
                     hash)
end

.namesObject

A mapping from model property names to API property names.



12
13
14
15
16
# File 'lib/tester/models/query_parameter.rb', line 12

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['key'] = 'key'
  @_hash
end