Class: StickyIoRestfulApiV2025731::PostbackProfileOneOf0

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

Overview

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

Returns a new instance of PostbackProfileOneOf0.



128
129
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
# File 'lib/sticky_io_restful_api_v2025731/models/postback_profile_one_of0.rb', line 128

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

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

Instance Attribute Details

#campaignsArray[Integer]

TODO: Write general description for this method

Returns:

  • (Array[Integer])


58
59
60
# File 'lib/sticky_io_restful_api_v2025731/models/postback_profile_one_of0.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_one_of0.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_one_of0.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_one_of0.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_one_of0.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_one_of0.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_one_of0.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_one_of0.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_one_of0.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_one_of0.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_one_of0.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_one_of0.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_one_of0.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_one_of0.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_one_of0.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_one_of0.rb', line 26

def url
  @url
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
# File 'lib/sticky_io_restful_api_v2025731/models/postback_profile_one_of0.rb', line 157

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : SKIP
  name = hash.key?('name') ? hash['name'] : SKIP
  type_id = hash.key?('type_id') ? hash['type_id'] : SKIP
  url = hash.key?('url') ? hash['url'] : SKIP
  is_active = hash.key?('is_active') ? hash['is_active'] : SKIP
  is_global = hash.key?('is_global') ? hash['is_global'] : SKIP
  created_at = hash.key?('created_at') ? hash['created_at'] : SKIP
  updated_at = hash.key?('updated_at') ? hash['updated_at'] : SKIP
  http_method = hash.key?('http_method') ? hash['http_method'] : SKIP
  type = hash.key?('type') ? hash['type'] : SKIP
  # 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 = SKIP unless hash.key?('headers')
  campaigns = hash.key?('campaigns') ? hash['campaigns'] : SKIP
  triggers = hash.key?('triggers') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:PostbackProfileOneOf0Triggers), hash['triggers']
  ) : SKIP
  trigger_type_id = hash.key?('trigger_type_id') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:PostbackProfileOneOf0TriggerTypeId), hash['trigger_type_id']
  ) : SKIP
  creator = Creator.from_hash(hash['creator']) if hash['creator']
  updator = hash.key?('updator') ? hash['updator'] : SKIP

  # 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.
  PostbackProfileOneOf0.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_one_of0.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



121
122
123
124
125
126
# File 'lib/sticky_io_restful_api_v2025731/models/postback_profile_one_of0.rb', line 121

def self.nullables
  %w[
    trigger_type_id
    updator
  ]
end

.optionalsObject

An array for optional fields



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/sticky_io_restful_api_v2025731/models/postback_profile_one_of0.rb', line 99

def self.optionals
  %w[
    id
    name
    type_id
    url
    is_active
    is_global
    created_at
    updated_at
    http_method
    type
    headers
    campaigns
    triggers
    trigger_type_id
    creator
    updator
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



220
221
222
223
224
225
226
# File 'lib/sticky_io_restful_api_v2025731/models/postback_profile_one_of0.rb', line 220

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



240
241
242
243
244
245
246
247
248
249
# File 'lib/sticky_io_restful_api_v2025731/models/postback_profile_one_of0.rb', line 240

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.



229
230
231
232
233
234
235
236
237
# File 'lib/sticky_io_restful_api_v2025731/models/postback_profile_one_of0.rb', line 229

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