Class: OneSignal::StringMap

Inherits:
Object
  • Object
show all
Defined in:
lib/onesignal/models/string_map.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ StringMap

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
288
289
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
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
# File 'lib/onesignal/models/string_map.rb', line 258

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::StringMap` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::StringMap`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'en')
    self.en = attributes[:'en']
  end

  if attributes.key?(:'ar')
    self.ar = attributes[:'ar']
  end

  if attributes.key?(:'bs')
    self.bs = attributes[:'bs']
  end

  if attributes.key?(:'bg')
    self.bg = attributes[:'bg']
  end

  if attributes.key?(:'ca')
    self.ca = attributes[:'ca']
  end

  if attributes.key?(:'zh_hans')
    self.zh_hans = attributes[:'zh_hans']
  end

  if attributes.key?(:'zh_hant')
    self.zh_hant = attributes[:'zh_hant']
  end

  if attributes.key?(:'zh')
    self.zh = attributes[:'zh']
  end

  if attributes.key?(:'hr')
    self.hr = attributes[:'hr']
  end

  if attributes.key?(:'cs')
    self.cs = attributes[:'cs']
  end

  if attributes.key?(:'da')
    self.da = attributes[:'da']
  end

  if attributes.key?(:'nl')
    self.nl = attributes[:'nl']
  end

  if attributes.key?(:'et')
    self.et = attributes[:'et']
  end

  if attributes.key?(:'fi')
    self.fi = attributes[:'fi']
  end

  if attributes.key?(:'fr')
    self.fr = attributes[:'fr']
  end

  if attributes.key?(:'ka')
    self.ka = attributes[:'ka']
  end

  if attributes.key?(:'de')
    self.de = attributes[:'de']
  end

  if attributes.key?(:'el')
    self.el = attributes[:'el']
  end

  if attributes.key?(:'hi')
    self.hi = attributes[:'hi']
  end

  if attributes.key?(:'he')
    self.he = attributes[:'he']
  end

  if attributes.key?(:'hu')
    self.hu = attributes[:'hu']
  end

  if attributes.key?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.key?(:'it')
    self.it = attributes[:'it']
  end

  if attributes.key?(:'ja')
    self.ja = attributes[:'ja']
  end

  if attributes.key?(:'ko')
    self.ko = attributes[:'ko']
  end

  if attributes.key?(:'lv')
    self.lv = attributes[:'lv']
  end

  if attributes.key?(:'lt')
    self.lt = attributes[:'lt']
  end

  if attributes.key?(:'ms')
    self.ms = attributes[:'ms']
  end

  if attributes.key?(:'nb')
    self.nb = attributes[:'nb']
  end

  if attributes.key?(:'pl')
    self.pl = attributes[:'pl']
  end

  if attributes.key?(:'fa')
    self.fa = attributes[:'fa']
  end

  if attributes.key?(:'pt')
    self.pt = attributes[:'pt']
  end

  if attributes.key?(:'pa')
    self.pa = attributes[:'pa']
  end

  if attributes.key?(:'ro')
    self.ro = attributes[:'ro']
  end

  if attributes.key?(:'ru')
    self.ru = attributes[:'ru']
  end

  if attributes.key?(:'sr')
    self.sr = attributes[:'sr']
  end

  if attributes.key?(:'sk')
    self.sk = attributes[:'sk']
  end

  if attributes.key?(:'es')
    self.es = attributes[:'es']
  end

  if attributes.key?(:'sv')
    self.sv = attributes[:'sv']
  end

  if attributes.key?(:'th')
    self.th = attributes[:'th']
  end

  if attributes.key?(:'tr')
    self.tr = attributes[:'tr']
  end

  if attributes.key?(:'uk')
    self.uk = attributes[:'uk']
  end

  if attributes.key?(:'vi')
    self.vi = attributes[:'vi']
  end
end

Instance Attribute Details

#arObject

Text in Arabic.



22
23
24
# File 'lib/onesignal/models/string_map.rb', line 22

def ar
  @ar
end

#bgObject

Text in Bulgarian.



28
29
30
# File 'lib/onesignal/models/string_map.rb', line 28

def bg
  @bg
end

#bsObject

Text in Bosnian.



25
26
27
# File 'lib/onesignal/models/string_map.rb', line 25

def bs
  @bs
end

#caObject

Text in Catalan.



31
32
33
# File 'lib/onesignal/models/string_map.rb', line 31

def ca
  @ca
end

#csObject

Text in Czech.



46
47
48
# File 'lib/onesignal/models/string_map.rb', line 46

def cs
  @cs
end

#daObject

Text in Danish.



49
50
51
# File 'lib/onesignal/models/string_map.rb', line 49

def da
  @da
end

#deObject

Text in German.



67
68
69
# File 'lib/onesignal/models/string_map.rb', line 67

def de
  @de
end

#elObject

Text in Greek.



70
71
72
# File 'lib/onesignal/models/string_map.rb', line 70

def el
  @el
end

#enObject

Text in English. Will be used as a fallback



19
20
21
# File 'lib/onesignal/models/string_map.rb', line 19

def en
  @en
end

#esObject

Text in Spanish.



130
131
132
# File 'lib/onesignal/models/string_map.rb', line 130

def es
  @es
end

#etObject

Text in Estonian.



55
56
57
# File 'lib/onesignal/models/string_map.rb', line 55

def et
  @et
end

#faObject

Text in Persian.



109
110
111
# File 'lib/onesignal/models/string_map.rb', line 109

def fa
  @fa
end

#fiObject

Text in Finnish.



58
59
60
# File 'lib/onesignal/models/string_map.rb', line 58

def fi
  @fi
end

#frObject

Text in French.



61
62
63
# File 'lib/onesignal/models/string_map.rb', line 61

def fr
  @fr
end

#heObject

Text in Hebrew.



76
77
78
# File 'lib/onesignal/models/string_map.rb', line 76

def he
  @he
end

#hiObject

Text in Hindi.



73
74
75
# File 'lib/onesignal/models/string_map.rb', line 73

def hi
  @hi
end

#hrObject

Text in Croatian.



43
44
45
# File 'lib/onesignal/models/string_map.rb', line 43

def hr
  @hr
end

#huObject

Text in Hungarian.



79
80
81
# File 'lib/onesignal/models/string_map.rb', line 79

def hu
  @hu
end

#idObject

Text in Indonesian.



82
83
84
# File 'lib/onesignal/models/string_map.rb', line 82

def id
  @id
end

#itObject

Text in Italian.



85
86
87
# File 'lib/onesignal/models/string_map.rb', line 85

def it
  @it
end

#jaObject

Text in Japanese.



88
89
90
# File 'lib/onesignal/models/string_map.rb', line 88

def ja
  @ja
end

#kaObject

Text in Georgian.



64
65
66
# File 'lib/onesignal/models/string_map.rb', line 64

def ka
  @ka
end

#koObject

Text in Korean.



91
92
93
# File 'lib/onesignal/models/string_map.rb', line 91

def ko
  @ko
end

#ltObject

Text in Lithuanian.



97
98
99
# File 'lib/onesignal/models/string_map.rb', line 97

def lt
  @lt
end

#lvObject

Text in Latvian.



94
95
96
# File 'lib/onesignal/models/string_map.rb', line 94

def lv
  @lv
end

#msObject

Text in Malay.



100
101
102
# File 'lib/onesignal/models/string_map.rb', line 100

def ms
  @ms
end

#nbObject

Text in Norwegian.



103
104
105
# File 'lib/onesignal/models/string_map.rb', line 103

def nb
  @nb
end

#nlObject

Text in Dutch.



52
53
54
# File 'lib/onesignal/models/string_map.rb', line 52

def nl
  @nl
end

#paObject

Text in Punjabi.



115
116
117
# File 'lib/onesignal/models/string_map.rb', line 115

def pa
  @pa
end

#plObject

Text in Polish.



106
107
108
# File 'lib/onesignal/models/string_map.rb', line 106

def pl
  @pl
end

#ptObject

Text in Portugese.



112
113
114
# File 'lib/onesignal/models/string_map.rb', line 112

def pt
  @pt
end

#roObject

Text in Romanian.



118
119
120
# File 'lib/onesignal/models/string_map.rb', line 118

def ro
  @ro
end

#ruObject

Text in Russian.



121
122
123
# File 'lib/onesignal/models/string_map.rb', line 121

def ru
  @ru
end

#skObject

Text in Slovak.



127
128
129
# File 'lib/onesignal/models/string_map.rb', line 127

def sk
  @sk
end

#srObject

Text in Serbian.



124
125
126
# File 'lib/onesignal/models/string_map.rb', line 124

def sr
  @sr
end

#svObject

Text in Swedish.



133
134
135
# File 'lib/onesignal/models/string_map.rb', line 133

def sv
  @sv
end

#thObject

Text in Thai.



136
137
138
# File 'lib/onesignal/models/string_map.rb', line 136

def th
  @th
end

#trObject

Text in Turkish.



139
140
141
# File 'lib/onesignal/models/string_map.rb', line 139

def tr
  @tr
end

#ukObject

Text in Ukrainian.



142
143
144
# File 'lib/onesignal/models/string_map.rb', line 142

def uk
  @uk
end

#viObject

Text in Vietnamese.



145
146
147
# File 'lib/onesignal/models/string_map.rb', line 145

def vi
  @vi
end

#zhObject

Alias for zh-Hans.



40
41
42
# File 'lib/onesignal/models/string_map.rb', line 40

def zh
  @zh
end

#zh_hansObject

Text in Chinese (Simplified).



34
35
36
# File 'lib/onesignal/models/string_map.rb', line 34

def zh_hans
  @zh_hans
end

#zh_hantObject

Text in Chinese (Traditional).



37
38
39
# File 'lib/onesignal/models/string_map.rb', line 37

def zh_hant
  @zh_hant
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



197
198
199
# File 'lib/onesignal/models/string_map.rb', line 197

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



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
# File 'lib/onesignal/models/string_map.rb', line 148

def self.attribute_map
  {
    :'en' => :'en',
    :'ar' => :'ar',
    :'bs' => :'bs',
    :'bg' => :'bg',
    :'ca' => :'ca',
    :'zh_hans' => :'zh-Hans',
    :'zh_hant' => :'zh-Hant',
    :'zh' => :'zh',
    :'hr' => :'hr',
    :'cs' => :'cs',
    :'da' => :'da',
    :'nl' => :'nl',
    :'et' => :'et',
    :'fi' => :'fi',
    :'fr' => :'fr',
    :'ka' => :'ka',
    :'de' => :'de',
    :'el' => :'el',
    :'hi' => :'hi',
    :'he' => :'he',
    :'hu' => :'hu',
    :'id' => :'id',
    :'it' => :'it',
    :'ja' => :'ja',
    :'ko' => :'ko',
    :'lv' => :'lv',
    :'lt' => :'lt',
    :'ms' => :'ms',
    :'nb' => :'nb',
    :'pl' => :'pl',
    :'fa' => :'fa',
    :'pt' => :'pt',
    :'pa' => :'pa',
    :'ro' => :'ro',
    :'ru' => :'ru',
    :'sr' => :'sr',
    :'sk' => :'sk',
    :'es' => :'es',
    :'sv' => :'sv',
    :'th' => :'th',
    :'tr' => :'tr',
    :'uk' => :'uk',
    :'vi' => :'vi'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



522
523
524
# File 'lib/onesignal/models/string_map.rb', line 522

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



251
252
253
254
# File 'lib/onesignal/models/string_map.rb', line 251

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



202
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
# File 'lib/onesignal/models/string_map.rb', line 202

def self.openapi_types
  {
    :'en' => :'String',
    :'ar' => :'String',
    :'bs' => :'String',
    :'bg' => :'String',
    :'ca' => :'String',
    :'zh_hans' => :'String',
    :'zh_hant' => :'String',
    :'zh' => :'String',
    :'hr' => :'String',
    :'cs' => :'String',
    :'da' => :'String',
    :'nl' => :'String',
    :'et' => :'String',
    :'fi' => :'String',
    :'fr' => :'String',
    :'ka' => :'String',
    :'de' => :'String',
    :'el' => :'String',
    :'hi' => :'String',
    :'he' => :'String',
    :'hu' => :'String',
    :'id' => :'String',
    :'it' => :'String',
    :'ja' => :'String',
    :'ko' => :'String',
    :'lv' => :'String',
    :'lt' => :'String',
    :'ms' => :'String',
    :'nb' => :'String',
    :'pl' => :'String',
    :'fa' => :'String',
    :'pt' => :'String',
    :'pa' => :'String',
    :'ro' => :'String',
    :'ru' => :'String',
    :'sr' => :'String',
    :'sk' => :'String',
    :'es' => :'String',
    :'sv' => :'String',
    :'th' => :'String',
    :'tr' => :'String',
    :'uk' => :'String',
    :'vi' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
# File 'lib/onesignal/models/string_map.rb', line 459

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      en == o.en &&
      ar == o.ar &&
      bs == o.bs &&
      bg == o.bg &&
      ca == o.ca &&
      zh_hans == o.zh_hans &&
      zh_hant == o.zh_hant &&
      zh == o.zh &&
      hr == o.hr &&
      cs == o.cs &&
      da == o.da &&
      nl == o.nl &&
      et == o.et &&
      fi == o.fi &&
      fr == o.fr &&
      ka == o.ka &&
      de == o.de &&
      el == o.el &&
      hi == o.hi &&
      he == o.he &&
      hu == o.hu &&
      id == o.id &&
      it == o.it &&
      ja == o.ja &&
      ko == o.ko &&
      lv == o.lv &&
      lt == o.lt &&
      ms == o.ms &&
      nb == o.nb &&
      pl == o.pl &&
      fa == o.fa &&
      pt == o.pt &&
      pa == o.pa &&
      ro == o.ro &&
      ru == o.ru &&
      sr == o.sr &&
      sk == o.sk &&
      es == o.es &&
      sv == o.sv &&
      th == o.th &&
      tr == o.tr &&
      uk == o.uk &&
      vi == o.vi
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
# File 'lib/onesignal/models/string_map.rb', line 553

def _deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = OneSignal.const_get(type)
    klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



624
625
626
627
628
629
630
631
632
633
634
635
636
# File 'lib/onesignal/models/string_map.rb', line 624

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
# File 'lib/onesignal/models/string_map.rb', line 529

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  self.class.openapi_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      self.send("#{key}=", nil)
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


509
510
511
# File 'lib/onesignal/models/string_map.rb', line 509

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



515
516
517
# File 'lib/onesignal/models/string_map.rb', line 515

def hash
  [en, ar, bs, bg, ca, zh_hans, zh_hant, zh, hr, cs, da, nl, et, fi, fr, ka, de, el, hi, he, hu, id, it, ja, ko, lv, lt, ms, nb, pl, fa, pt, pa, ro, ru, sr, sk, es, sv, th, tr, uk, vi].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



446
447
448
449
# File 'lib/onesignal/models/string_map.rb', line 446

def list_invalid_properties
  invalid_properties = Array.new
  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



600
601
602
# File 'lib/onesignal/models/string_map.rb', line 600

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



606
607
608
609
610
611
612
613
614
615
616
617
618
# File 'lib/onesignal/models/string_map.rb', line 606

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



594
595
596
# File 'lib/onesignal/models/string_map.rb', line 594

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



453
454
455
# File 'lib/onesignal/models/string_map.rb', line 453

def valid?
  true
end