Class: FacebookAds::ServerSide::ExtendedDeviceInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/facebook_ads/ad_objects/server_side/extended_device_info.rb

Overview

ExtendedDeviceInfo, such as screen width and height. This parameter is an array and values are separated by commas.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ext_info_version: nil, app_package_name: nil, short_version: nil, long_version: nil, os_version: nil, device_model_name: nil, locale: nil, timezone_abbreviation: nil, carrier: nil, screen_width: nil, screen_height: nil, screen_density: nil, cpu_core_count: nil, total_disk_space_gb: nil, free_disk_space_gb: nil, device_time_zone: nil) ⇒ ExtendedDeviceInfo

Initializes the object

Parameters:

  • ext_info_version (String) (defaults to: nil)
  • app_package_name (String) (defaults to: nil)
  • short_version (String) (defaults to: nil)
  • long_version (String) (defaults to: nil)
  • os_version (String) (defaults to: nil)
  • device_model_name (String) (defaults to: nil)
  • locale (String) (defaults to: nil)
  • timezone_abbreviation (String) (defaults to: nil)
  • carrier (String) (defaults to: nil)
  • screen_width (String) (defaults to: nil)
  • screen_height (String) (defaults to: nil)
  • screen_density (String) (defaults to: nil)
  • cpu_core_count (String) (defaults to: nil)
  • total_disk_space_gb (String) (defaults to: nil)
  • free_disk_space_gb (String) (defaults to: nil)
  • device_time_zone (String) (defaults to: nil)


59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/facebook_ads/ad_objects/server_side/extended_device_info.rb', line 59

def initialize(ext_info_version: nil, app_package_name: nil, short_version: nil, long_version: nil, os_version: nil, device_model_name: nil, locale: nil, timezone_abbreviation: nil,
    carrier: nil, screen_width: nil, screen_height: nil, screen_density: nil, cpu_core_count: nil, total_disk_space_gb: nil, free_disk_space_gb: nil, device_time_zone: nil)
    unless ext_info_version.nil?
      self.ext_info_version = String(ext_info_version)
    end
    unless app_package_name.nil?
      self.app_package_name = String(app_package_name)
    end
    unless short_version.nil?
      self.short_version = String(short_version)
    end
    unless long_version.nil?
      self.long_version = String(long_version)
    end
    unless os_version.nil?
      self.os_version = String(os_version)
    end
    unless device_model_name.nil?
      self.device_model_name = String(device_model_name)
    end
    unless locale.nil?
      self.locale = String(locale)
    end
    unless timezone_abbreviation.nil?
      self.timezone_abbreviation = String(timezone_abbreviation)
    end
    unless carrier.nil?
        self.carrier = String(carrier)
    end
    unless screen_width.nil?
        self.screen_width = String(screen_width)
    end
    unless screen_height.nil?
        self.screen_height = String(screen_height)
    end
    unless screen_density.nil?
        self.screen_density = String(screen_density)
    end
    unless cpu_core_count.nil?
        self.cpu_core_count = String(cpu_core_count)
    end
    unless total_disk_space_gb.nil?
        self.total_disk_space_gb = String(total_disk_space_gb)
    end
    unless free_disk_space_gb.nil?
        self.free_disk_space_gb = String(free_disk_space_gb)
    end
    unless device_time_zone.nil?
        self.device_time_zone = String(device_time_zone)
    end
end

Instance Attribute Details

#app_package_nameObject

Returns the value of attribute app_package_name.



25
26
27
# File 'lib/facebook_ads/ad_objects/server_side/extended_device_info.rb', line 25

def app_package_name
  @app_package_name
end

#carrierObject

Returns the value of attribute carrier.



25
26
27
# File 'lib/facebook_ads/ad_objects/server_side/extended_device_info.rb', line 25

def carrier
  @carrier
end

#cpu_core_countObject

Returns the value of attribute cpu_core_count.



25
26
27
# File 'lib/facebook_ads/ad_objects/server_side/extended_device_info.rb', line 25

def cpu_core_count
  @cpu_core_count
end

#device_model_nameObject

Returns the value of attribute device_model_name.



25
26
27
# File 'lib/facebook_ads/ad_objects/server_side/extended_device_info.rb', line 25

def device_model_name
  @device_model_name
end

#device_time_zoneObject

Returns the value of attribute device_time_zone.



25
26
27
# File 'lib/facebook_ads/ad_objects/server_side/extended_device_info.rb', line 25

def device_time_zone
  @device_time_zone
end

#ext_info_versionObject

Returns the value of attribute ext_info_version.



25
26
27
# File 'lib/facebook_ads/ad_objects/server_side/extended_device_info.rb', line 25

def ext_info_version
  @ext_info_version
end

#free_disk_space_gbObject

Returns the value of attribute free_disk_space_gb.



25
26
27
# File 'lib/facebook_ads/ad_objects/server_side/extended_device_info.rb', line 25

def free_disk_space_gb
  @free_disk_space_gb
end

#localeObject

Returns the value of attribute locale.



25
26
27
# File 'lib/facebook_ads/ad_objects/server_side/extended_device_info.rb', line 25

def locale
  @locale
end

#long_versionObject

Returns the value of attribute long_version.



25
26
27
# File 'lib/facebook_ads/ad_objects/server_side/extended_device_info.rb', line 25

def long_version
  @long_version
end

#os_versionObject

Returns the value of attribute os_version.



25
26
27
# File 'lib/facebook_ads/ad_objects/server_side/extended_device_info.rb', line 25

def os_version
  @os_version
end

#screen_densityObject

Returns the value of attribute screen_density.



25
26
27
# File 'lib/facebook_ads/ad_objects/server_side/extended_device_info.rb', line 25

def screen_density
  @screen_density
end

#screen_heightObject

Returns the value of attribute screen_height.



25
26
27
# File 'lib/facebook_ads/ad_objects/server_side/extended_device_info.rb', line 25

def screen_height
  @screen_height
end

#screen_widthObject

Returns the value of attribute screen_width.



25
26
27
# File 'lib/facebook_ads/ad_objects/server_side/extended_device_info.rb', line 25

def screen_width
  @screen_width
end

#short_versionObject

Returns the value of attribute short_version.



25
26
27
# File 'lib/facebook_ads/ad_objects/server_side/extended_device_info.rb', line 25

def short_version
  @short_version
end

#timezone_abbreviationObject

Returns the value of attribute timezone_abbreviation.



25
26
27
# File 'lib/facebook_ads/ad_objects/server_side/extended_device_info.rb', line 25

def timezone_abbreviation
  @timezone_abbreviation
end

#total_disk_space_gbObject

Returns the value of attribute total_disk_space_gb.



25
26
27
# File 'lib/facebook_ads/ad_objects/server_side/extended_device_info.rb', line 25

def total_disk_space_gb
  @total_disk_space_gb
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.



186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# File 'lib/facebook_ads/ad_objects/server_side/extended_device_info.rb', line 186

def ==(o)
    return self.class == o.class &&
        ext_info_version == o.ext_info_version &&
        app_package_name == o.app_package_name &&
        short_version == o.short_version &&
        long_version == o.long_version &&
        os_version == o.os_version &&
        device_model_name == o.device_model_name &&
        locale == o.locale &&
        timezone_abbreviation == o.timezone_abbreviation &&
        carrier == o.carrier &&
        screen_width == o.screen_width &&
        screen_height == o.screen_height &&
        screen_density == o.screen_density &&
        cpu_core_count == o.cpu_core_count &&
        total_disk_space_gb == o.total_disk_space_gb &&
        free_disk_space_gb == o.free_disk_space_gb &&
        device_time_zone == o.device_time_zone
end

#build(attributes = {}) ⇒ Object

build the object using the input hash

Parameters:

  • attributes (Hash) (defaults to: {})

    attributes in the form of hash



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
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
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
# File 'lib/facebook_ads/ad_objects/server_side/extended_device_info.rb', line 113

def build(attributes = {})
    return unless attributes.is_a?(Hash)

    # convert string to symbol for hash key
    attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

    if attributes.has_key?(:'ext_info_version')
        self.ext_info_version = attributes[:'ext_info_version']
    end

      if attributes.has_key?(:'app_package_name')
        self.app_package_name = attributes[:'app_package_name']
      end

      if attributes.has_key?(:'short_version')
        self.short_version = attributes[:'short_version']
      end

      if attributes.has_key?(:'long_version')
        self.long_version = attributes[:'long_version']
      end

      if attributes.has_key?(:'os_version')
        self.os_version = attributes[:'os_version']
      end

      if attributes.has_key?(:'device_model_name')
        self.device_model_name = attributes[:'device_model_name']
      end

      if attributes.has_key?(:'locale')
        self.locale = attributes[:'locale']
      end

      if attributes.has_key?(:'timezone_abbreviation')
        self.timezone_abbreviation = attributes[:'timezone_abbreviation']
      end

      if attributes.has_key?(:'carrier')
        self.carrier = attributes[:'carrier']
      end

      if attributes.has_key?(:'screen_width')
        self.screen_width = attributes[:'screen_width']
      end

      if attributes.has_key?(:'screen_height')
        self.screen_height = attributes[:'screen_height']
      end

      if attributes.has_key?(:'screen_density')
        self.screen_density = attributes[:'screen_density']
      end

      if attributes.has_key?(:'cpu_core_count')
        self.cpu_core_count = attributes[:'cpu_core_count']
      end

      if attributes.has_key?(:'total_disk_space_gb')
        self.total_disk_space_gb = attributes[:'total_disk_space_gb']
      end

      if attributes.has_key?(:'free_disk_space_gb')
        self.free_disk_space_gb = attributes[:'free_disk_space_gb']
      end

      if attributes.has_key?(:'device_time_zone')
        self.device_time_zone = attributes[:'device_time_zone']
      end
end

#eql?(o) ⇒ Boolean

Returns:

  • (Boolean)

See Also:

  • `==` method


207
208
209
# File 'lib/facebook_ads/ad_objects/server_side/extended_device_info.rb', line 207

def eql?(o)
    self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# File 'lib/facebook_ads/ad_objects/server_side/extended_device_info.rb', line 213

def hash
    [
        ext_info_version,
        app_package_name,
        short_version,
        long_version,
        os_version,
        device_model_name,
        locale,
        timezone_abbreviation,
        carrier,
        screen_width,
        screen_height,
        screen_density,
        cpu_core_count,
        total_disk_space_gb,
        free_disk_space_gb,
        device_time_zone
    ].hash
end

#normalizeObject

Normalize input fields to server request format.



290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
# File 'lib/facebook_ads/ad_objects/server_side/extended_device_info.rb', line 290

def normalize
  ext_info_array = []
  unless ext_info_version.nil?
    ext_info_array.push(ext_info_version)
  end
  unless app_package_name.nil?
    ext_info_array.push(app_package_name)
  end
  unless short_version.nil?
    ext_info_array.push(short_version)
  end
  unless long_version.nil?
    ext_info_array.push(long_version)
  end
  unless os_version.nil?
    ext_info_array.push(os_version)
  end
  unless device_model_name.nil?
    ext_info_array.push(device_model_name)
  end
  unless locale.nil?
    ext_info_array.push(locale)
  end
  unless timezone_abbreviation.nil?
    ext_info_array.push(timezone_abbreviation)
  end
  unless carrier.nil?
    ext_info_array.push(carrier)
  end
  unless screen_width.nil?
    ext_info_array.push(screen_width)
  end
  unless screen_height.nil?
    ext_info_array.push(screen_height)
  end
  unless screen_density.nil?
    ext_info_array.push(screen_density)
  end
  unless cpu_core_count.nil?
    ext_info_array.push(cpu_core_count)
  end
  unless total_disk_space_gb.nil?
    ext_info_array.push(total_disk_space_gb)
  end
  unless free_disk_space_gb.nil?
    ext_info_array.push(free_disk_space_gb)
  end
  unless device_time_zone.nil?
    ext_info_array.push(device_time_zone)
  end
  ext_info_array
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



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
284
285
286
287
# File 'lib/facebook_ads/ad_objects/server_side/extended_device_info.rb', line 236

def to_s
  hash = {}
  unless ext_info_version.nil?
    hash['ext_info_version'] = ext_info_version
  end
  unless app_package_name.nil?
    hash['app_package_name'] = app_package_name
  end
  unless short_version.nil?
    hash['short_version'] = short_version
  end
  unless long_version.nil?
    hash['long_version'] = long_version
  end
  unless os_version.nil?
    hash['os_version'] = os_version
  end
  unless device_model_name.nil?
    hash['device_model_name'] = device_model_name
  end
  unless locale.nil?
    hash['locale'] = locale
  end
  unless timezone_abbreviation.nil?
    hash['timezone_abbreviation'] = timezone_abbreviation
  end
  unless carrier.nil?
    hash['carrier'] = carrier
  end
  unless screen_width.nil?
    hash['screen_width'] = screen_width
  end
  unless screen_height.nil?
    hash['screen_height'] = screen_height
  end
  unless screen_density.nil?
    hash['screen_density'] = screen_density
  end
  unless cpu_core_count.nil?
    hash['cpu_core_count'] = cpu_core_count
  end
  unless total_disk_space_gb.nil?
    hash['total_disk_space_gb'] = total_disk_space_gb
  end
  unless free_disk_space_gb.nil?
    hash['free_disk_space_gb'] = free_disk_space_gb
  end
  unless device_time_zone.nil?
    hash['device_time_zone'] = device_time_zone
  end
  hash.to_s
end