Class: StickyIoRestfulApiV2025731::PostbackProfile

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

Overview

PostbackProfile 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:, name:, type_id:, url:, is_active:, is_global:, created_at:, updated_at:, http_method:, type:, headers:, campaigns:, triggers:, trigger_type_id:, creator:, updator:, additional_properties: nil) ⇒ PostbackProfile

Returns a new instance of PostbackProfile.



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/sticky_io_restful_api_v2025731/models/postback_profile.rb', line 111

def initialize(id:, name:, type_id:, url:, is_active:, is_global:,
               created_at:, updated_at:, http_method:, type:, headers:,
               campaigns:, triggers:, trigger_type_id:, creator:, updator:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @id = id
  @name = name
  @type_id = type_id
  @url = url
  @is_active = is_active
  @is_global = is_global
  @created_at = created_at
  @updated_at = updated_at
  @http_method = http_method
  @type = type
  @headers = headers
  @campaigns = campaigns
  @triggers = triggers
  @trigger_type_id = trigger_type_id
  @creator = creator
  @updator = updator
  @additional_properties = additional_properties
end

Instance Attribute Details

#campaignsArray[Object]

TODO: Write general description for this method

Returns:

  • (Array[Object])


58
59
60
# File 'lib/sticky_io_restful_api_v2025731/models/postback_profile.rb', line 58

def campaigns
  @campaigns
end

#created_atString

TODO: Write general description for this method

Returns:

  • (String)


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

def created_at
  @created_at
end

#creatorCreator

TODO: Write general description for this method

Returns:



70
71
72
# File 'lib/sticky_io_restful_api_v2025731/models/postback_profile.rb', line 70

def creator
  @creator
end

#headersArray[Header]

TODO: Write general description for this method

Returns:



54
55
56
# File 'lib/sticky_io_restful_api_v2025731/models/postback_profile.rb', line 54

def headers
  @headers
end

#http_methodString

TODO: Write general description for this method

Returns:

  • (String)


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

def http_method
  @http_method
end

#idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def id
  @id
end

#is_activeInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def is_active
  @is_active
end

#is_globalInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def is_global
  @is_global
end

#nameString

TODO: Write general description for this method

Returns:

  • (String)


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

def name
  @name
end

#trigger_type_idObject

TODO: Write general description for this method

Returns:

  • (Object)


66
67
68
# File 'lib/sticky_io_restful_api_v2025731/models/postback_profile.rb', line 66

def trigger_type_id
  @trigger_type_id
end

#triggersObject

TODO: Write general description for this method

Returns:

  • (Object)


62
63
64
# File 'lib/sticky_io_restful_api_v2025731/models/postback_profile.rb', line 62

def triggers
  @triggers
end

#typeString

TODO: Write general description for this method

Returns:

  • (String)


50
51
52
# File 'lib/sticky_io_restful_api_v2025731/models/postback_profile.rb', line 50

def type
  @type
end

#type_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def type_id
  @type_id
end

#updated_atString

TODO: Write general description for this method

Returns:

  • (String)


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

def updated_at
  @updated_at
end

#updatorString

TODO: Write general description for this method

Returns:

  • (String)


74
75
76
# File 'lib/sticky_io_restful_api_v2025731/models/postback_profile.rb', line 74

def updator
  @updator
end

#urlString

TODO: Write general description for this method

Returns:

  • (String)


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

def url
  @url
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
# File 'lib/sticky_io_restful_api_v2025731/models/postback_profile.rb', line 138

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : nil
  name = hash.key?('name') ? hash['name'] : nil
  type_id = hash.key?('type_id') ? hash['type_id'] : nil
  url = hash.key?('url') ? hash['url'] : nil
  is_active = hash.key?('is_active') ? hash['is_active'] : nil
  is_global = hash.key?('is_global') ? hash['is_global'] : nil
  created_at = hash.key?('created_at') ? hash['created_at'] : nil
  updated_at = hash.key?('updated_at') ? hash['updated_at'] : nil
  http_method = hash.key?('http_method') ? hash['http_method'] : nil
  type = hash.key?('type') ? hash['type'] : nil
  # Parameter is an array, so we need to iterate through it
  headers = nil
  unless hash['headers'].nil?
    headers = []
    hash['headers'].each do |structure|
      headers << (Header.from_hash(structure) if structure)
    end
  end

  headers = nil unless hash.key?('headers')
  campaigns = hash.key?('campaigns') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:PostbackProfileCampaigns), hash['campaigns']
  ) : nil
  triggers = hash.key?('triggers') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:PostbackProfileTriggers), hash['triggers']
  ) : nil
  trigger_type_id = hash.key?('trigger_type_id') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:PostbackProfileTriggerTypeId), hash['trigger_type_id']
  ) : nil
  creator = Creator.from_hash(hash['creator']) if hash['creator']
  updator = hash.key?('updator') ? hash['updator'] : 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.
  PostbackProfile.new(id: id,
                      name: name,
                      type_id: type_id,
                      url: url,
                      is_active: is_active,
                      is_global: is_global,
                      created_at: created_at,
                      updated_at: updated_at,
                      http_method: http_method,
                      type: type,
                      headers: headers,
                      campaigns: campaigns,
                      triggers: triggers,
                      trigger_type_id: trigger_type_id,
                      creator: creator,
                      updator: updator,
                      additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/sticky_io_restful_api_v2025731/models/postback_profile.rb', line 77

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['name'] = 'name'
  @_hash['type_id'] = 'type_id'
  @_hash['url'] = 'url'
  @_hash['is_active'] = 'is_active'
  @_hash['is_global'] = 'is_global'
  @_hash['created_at'] = 'created_at'
  @_hash['updated_at'] = 'updated_at'
  @_hash['http_method'] = 'http_method'
  @_hash['type'] = 'type'
  @_hash['headers'] = 'headers'
  @_hash['campaigns'] = 'campaigns'
  @_hash['triggers'] = 'triggers'
  @_hash['trigger_type_id'] = 'trigger_type_id'
  @_hash['creator'] = 'creator'
  @_hash['updator'] = 'updator'
  @_hash
end

.nullablesObject

An array for nullable fields



104
105
106
107
108
109
# File 'lib/sticky_io_restful_api_v2025731/models/postback_profile.rb', line 104

def self.nullables
  %w[
    trigger_type_id
    updator
  ]
end

.optionalsObject

An array for optional fields



99
100
101
# File 'lib/sticky_io_restful_api_v2025731/models/postback_profile.rb', line 99

def self.optionals
  []
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:

  • The (PostbackProfile | Hash)

    value against the validation is performed.



203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
# File 'lib/sticky_io_restful_api_v2025731/models/postback_profile.rb', line 203

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.name,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.type_id,
                              ->(val) { val.instance_of? Integer }) and
        APIHelper.valid_type?(value.url,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.is_active,
                              ->(val) { val.instance_of? Integer }) and
        APIHelper.valid_type?(value.is_global,
                              ->(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.http_method,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.type,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.headers,
                              ->(val) { Header.validate(val) },
                              is_model_hash: true,
                              is_inner_model_hash: true) and
        UnionTypeLookUp.get(:PostbackProfileCampaigns)
                       .validate(value.campaigns) and
        UnionTypeLookUp.get(:PostbackProfileTriggers)
                       .validate(value.triggers) and
        UnionTypeLookUp.get(:PostbackProfileTriggerTypeId)
                       .validate(value.trigger_type_id) and
        APIHelper.valid_type?(value.creator,
                              ->(val) { Creator.validate(val) },
                              is_model_hash: true) and
        APIHelper.valid_type?(value.updator,
                              ->(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['name'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['type_id'],
                            ->(val) { val.instance_of? Integer }) and
      APIHelper.valid_type?(value['url'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['is_active'],
                            ->(val) { val.instance_of? Integer }) and
      APIHelper.valid_type?(value['is_global'],
                            ->(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['http_method'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['type'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['headers'],
                            ->(val) { Header.validate(val) },
                            is_model_hash: true,
                            is_inner_model_hash: true) and
      UnionTypeLookUp.get(:PostbackProfileCampaigns)
                     .validate(value['campaigns']) and
      UnionTypeLookUp.get(:PostbackProfileTriggers)
                     .validate(value['triggers']) and
      UnionTypeLookUp.get(:PostbackProfileTriggerTypeId)
                     .validate(value['trigger_type_id']) and
      APIHelper.valid_type?(value['creator'],
                            ->(val) { Creator.validate(val) },
                            is_model_hash: true) and
      APIHelper.valid_type?(value['updator'],
                            ->(val) { val.instance_of? String })
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



297
298
299
300
301
302
303
304
305
306
# File 'lib/sticky_io_restful_api_v2025731/models/postback_profile.rb', line 297

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id.inspect}, name: #{@name.inspect}, type_id: #{@type_id.inspect},"\
  " url: #{@url.inspect}, is_active: #{@is_active.inspect}, is_global: #{@is_global.inspect},"\
  " created_at: #{@created_at.inspect}, updated_at: #{@updated_at.inspect}, http_method:"\
  " #{@http_method.inspect}, type: #{@type.inspect}, headers: #{@headers.inspect}, campaigns:"\
  " #{@campaigns.inspect}, triggers: #{@triggers.inspect}, trigger_type_id:"\
  " #{@trigger_type_id.inspect}, creator: #{@creator.inspect}, updator: #{@updator.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



286
287
288
289
290
291
292
293
294
# File 'lib/sticky_io_restful_api_v2025731/models/postback_profile.rb', line 286

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id}, name: #{@name}, type_id: #{@type_id}, url: #{@url}, is_active:"\
  " #{@is_active}, is_global: #{@is_global}, created_at: #{@created_at}, updated_at:"\
  " #{@updated_at}, http_method: #{@http_method}, type: #{@type}, headers: #{@headers},"\
  " campaigns: #{@campaigns}, triggers: #{@triggers}, trigger_type_id: #{@trigger_type_id},"\
  " creator: #{@creator}, updator: #{@updator}, additional_properties:"\
  " #{@additional_properties}>"
end