Class: StickyIoRestfulApiV2025731::Header

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/sticky_io_restful_api_v2025731/models/header.rb

Overview

Header Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(id:, postback_id:, key:, value:, created_by:, updated_by:, created_at:, updated_at:, deleted_at:, additional_properties: nil) ⇒ Header

Returns a new instance of Header.



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/sticky_io_restful_api_v2025731/models/header.rb', line 75

def initialize(id:, postback_id:, key:, value:, created_by:, updated_by:,
               created_at:, updated_at:, deleted_at:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @id = id
  @postback_id = postback_id
  @key = key
  @value = value
  @created_by = created_by
  @updated_by = updated_by
  @created_at = created_at
  @updated_at = updated_at
  @deleted_at = deleted_at
  @additional_properties = additional_properties
end

Instance Attribute Details

#created_atString

TODO: Write general description for this method

Returns:

  • (String)


38
39
40
# File 'lib/sticky_io_restful_api_v2025731/models/header.rb', line 38

def created_at
  @created_at
end

#created_byInteger

TODO: Write general description for this method

Returns:

  • (Integer)


30
31
32
# File 'lib/sticky_io_restful_api_v2025731/models/header.rb', line 30

def created_by
  @created_by
end

#deleted_atString

TODO: Write general description for this method

Returns:

  • (String)


46
47
48
# File 'lib/sticky_io_restful_api_v2025731/models/header.rb', line 46

def deleted_at
  @deleted_at
end

#idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


14
15
16
# File 'lib/sticky_io_restful_api_v2025731/models/header.rb', line 14

def id
  @id
end

#keyString

TODO: Write general description for this method

Returns:

  • (String)


22
23
24
# File 'lib/sticky_io_restful_api_v2025731/models/header.rb', line 22

def key
  @key
end

#postback_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


18
19
20
# File 'lib/sticky_io_restful_api_v2025731/models/header.rb', line 18

def postback_id
  @postback_id
end

#updated_atString

TODO: Write general description for this method

Returns:

  • (String)


42
43
44
# File 'lib/sticky_io_restful_api_v2025731/models/header.rb', line 42

def updated_at
  @updated_at
end

#updated_byInteger

TODO: Write general description for this method

Returns:

  • (Integer)


34
35
36
# File 'lib/sticky_io_restful_api_v2025731/models/header.rb', line 34

def updated_by
  @updated_by
end

#valueString

TODO: Write general description for this method

Returns:

  • (String)


26
27
28
# File 'lib/sticky_io_restful_api_v2025731/models/header.rb', line 26

def value
  @value
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/sticky_io_restful_api_v2025731/models/header.rb', line 94

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : nil
  postback_id = hash.key?('postback_id') ? hash['postback_id'] : nil
  key = hash.key?('key') ? hash['key'] : nil
  value = hash.key?('value') ? hash['value'] : nil
  created_by = hash.key?('created_by') ? hash['created_by'] : nil
  updated_by = hash.key?('updated_by') ? hash['updated_by'] : nil
  created_at = hash.key?('created_at') ? hash['created_at'] : nil
  updated_at = hash.key?('updated_at') ? hash['updated_at'] : nil
  deleted_at = hash.key?('deleted_at') ? hash['deleted_at'] : nil

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  Header.new(id: id,
             postback_id: postback_id,
             key: key,
             value: value,
             created_by: created_by,
             updated_by: updated_by,
             created_at: created_at,
             updated_at: updated_at,
             deleted_at: deleted_at,
             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/sticky_io_restful_api_v2025731/models/header.rb', line 49

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['postback_id'] = 'postback_id'
  @_hash['key'] = 'key'
  @_hash['value'] = 'value'
  @_hash['created_by'] = 'created_by'
  @_hash['updated_by'] = 'updated_by'
  @_hash['created_at'] = 'created_at'
  @_hash['updated_at'] = 'updated_at'
  @_hash['deleted_at'] = 'deleted_at'
  @_hash
end

.nullablesObject

An array for nullable fields



69
70
71
72
73
# File 'lib/sticky_io_restful_api_v2025731/models/header.rb', line 69

def self.nullables
  %w[
    deleted_at
  ]
end

.optionalsObject

An array for optional fields



64
65
66
# File 'lib/sticky_io_restful_api_v2025731/models/header.rb', line 64

def self.optionals
  []
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:

  • The (Header | Hash)

    value against the validation is performed.



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/sticky_io_restful_api_v2025731/models/header.rb', line 130

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.id,
                            ->(val) { val.instance_of? Integer }) and
        APIHelper.valid_type?(value.postback_id,
                              ->(val) { val.instance_of? Integer }) and
        APIHelper.valid_type?(value.key,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.value,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.created_by,
                              ->(val) { val.instance_of? Integer }) and
        APIHelper.valid_type?(value.updated_by,
                              ->(val) { val.instance_of? Integer }) and
        APIHelper.valid_type?(value.created_at,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.updated_at,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.deleted_at,
                              ->(val) { val.instance_of? String })
    )
  end

  return false unless value.instance_of? Hash

  (
    APIHelper.valid_type?(value['id'],
                          ->(val) { val.instance_of? Integer }) and
      APIHelper.valid_type?(value['postback_id'],
                            ->(val) { val.instance_of? Integer }) and
      APIHelper.valid_type?(value['key'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['value'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['created_by'],
                            ->(val) { val.instance_of? Integer }) and
      APIHelper.valid_type?(value['updated_by'],
                            ->(val) { val.instance_of? Integer }) and
      APIHelper.valid_type?(value['created_at'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['updated_at'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['deleted_at'],
                            ->(val) { val.instance_of? String })
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



188
189
190
191
192
193
194
195
# File 'lib/sticky_io_restful_api_v2025731/models/header.rb', line 188

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id.inspect}, postback_id: #{@postback_id.inspect}, key:"\
  " #{@key.inspect}, value: #{@value.inspect}, created_by: #{@created_by.inspect}, updated_by:"\
  " #{@updated_by.inspect}, created_at: #{@created_at.inspect}, updated_at:"\
  " #{@updated_at.inspect}, deleted_at: #{@deleted_at.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



179
180
181
182
183
184
185
# File 'lib/sticky_io_restful_api_v2025731/models/header.rb', line 179

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id}, postback_id: #{@postback_id}, key: #{@key}, value: #{@value},"\
  " created_by: #{@created_by}, updated_by: #{@updated_by}, created_at: #{@created_at},"\
  " updated_at: #{@updated_at}, deleted_at: #{@deleted_at}, additional_properties:"\
  " #{@additional_properties}>"
end