Class: OneSignal::Sounds

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ios: nil, android: nil, amazon: nil, windows: nil) ⇒ Sounds

Returns a new instance of Sounds.



7
8
9
10
11
12
13
14
# File 'lib/onesignal/sounds.rb', line 7

def initialize ios: nil, android: nil, amazon: nil, windows: nil
  validate ios: ios, windows: windows

  @ios = ios
  @android = android
  @amazon = amazon
  @windows = windows
end

Instance Attribute Details

#amazonObject (readonly)

Returns the value of attribute amazon.



5
6
7
# File 'lib/onesignal/sounds.rb', line 5

def amazon
  @amazon
end

#androidObject (readonly)

Returns the value of attribute android.



5
6
7
# File 'lib/onesignal/sounds.rb', line 5

def android
  @android
end

#iosObject (readonly)

Returns the value of attribute ios.



5
6
7
# File 'lib/onesignal/sounds.rb', line 5

def ios
  @ios
end

#windowsObject (readonly)

Returns the value of attribute windows.



5
6
7
# File 'lib/onesignal/sounds.rb', line 5

def windows
  @windows
end

Instance Method Details

#as_json(options = nil) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/onesignal/sounds.rb', line 16

def as_json options = nil
  {
    'ios_sound'     => @ios.as_json(options),
    'android_sound' => @android.as_json(options),
    'adm_sound'     => @amazon.as_json(options),
    'wp_wns_sound'  => @windows.as_json(options)
  }
end