Class: JPush::WinphoneNotification

Inherits:
Object
  • Object
show all
Defined in:
lib/jpush/model/notification/winphone_notification.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ WinphoneNotification

Returns a new instance of WinphoneNotification.


4
5
6
7
8
9
# File 'lib/jpush/model/notification/winphone_notification.rb', line 4

def initialize(opts = {})
  @alert = opts[:alert]
  @title = opts[:title]
  @_open_page = opts[:_open_page]
  @extras = opts[:extras]
end

Instance Attribute Details

#_open_pageObject

Returns the value of attribute _open_page


3
4
5
# File 'lib/jpush/model/notification/winphone_notification.rb', line 3

def _open_page
  @_open_page
end

#alertObject

Returns the value of attribute alert


3
4
5
# File 'lib/jpush/model/notification/winphone_notification.rb', line 3

def alert
  @alert
end

#extrasObject

Returns the value of attribute extras


3
4
5
# File 'lib/jpush/model/notification/winphone_notification.rb', line 3

def extras
  @extras
end

#titleObject

Returns the value of attribute title


3
4
5
# File 'lib/jpush/model/notification/winphone_notification.rb', line 3

def title
  @title
end

Class Method Details

.build(opts = {}) ⇒ Object


28
29
30
31
32
33
34
# File 'lib/jpush/model/notification/winphone_notification.rb', line 28

def self.build(opts = {})
  winphone = JPush::WinphoneNotification.new(opts)
  if winphone.alert == nil
    raise ArgumentError.new('winphone the alert should be setted')
  end
  return winphone
end

Instance Method Details

#toJSONObject


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/jpush/model/notification/winphone_notification.rb', line 11

def toJSON
  array = {}
  if @alert != nil then
    array['alert'] = @alert
  end
  if @title != nil then
    array['title'] = @title
  end
  if @_open_page != nil then
    array['_open_page'] = @_open_page
  end
  if @extras != nil then
    array['extras'] = @extras
  end
  return array
end