Class: Tester::DeleteBody

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

Overview

DeleteBody 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(field = nil, name = nil, additional_properties = {}) ⇒ DeleteBody

Returns a new instance of DeleteBody.



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/tester/models/delete_body.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

#fieldString

TODO: Write general description for this method

Returns:



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

def field
  @field
end

#nameString

TODO: Write general description for this method

Returns:



13
14
15
# File 'lib/tester/models/delete_body.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/delete_body.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.
  DeleteBody.new(field,
                 name,
                 hash)
end

.namesObject

A mapping from model property names to API property names.



16
17
18
19
20
21
# File 'lib/tester/models/delete_body.rb', line 16

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