Class: Crusade::APNS::Notification

Inherits:
Object
  • Object
show all
Defined in:
lib/crusade/apns/notification.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ Notification

Returns a new instance of Notification.



6
7
8
9
10
11
12
# File 'lib/crusade/apns/notification.rb', line 6

def initialize(attrs = {} )
  self.title        =  attrs.fetch(:title)       { nil }
  self.body         = attrs.fetch(:body)         { nil }
  self.action       = attrs.fetch(:action)       { nil }
  self.url_args     = attrs.fetch(:url_args)     { []  }
  self.device_token = attrs.fetch(:device_token) { nil }
end

Instance Attribute Details

#actionObject

Returns the value of attribute action.



4
5
6
# File 'lib/crusade/apns/notification.rb', line 4

def action
  @action
end

#bodyObject

Returns the value of attribute body.



4
5
6
# File 'lib/crusade/apns/notification.rb', line 4

def body
  @body
end

#device_tokenObject

Returns the value of attribute device_token.



4
5
6
# File 'lib/crusade/apns/notification.rb', line 4

def device_token
  @device_token
end

#titleObject

Returns the value of attribute title.



4
5
6
# File 'lib/crusade/apns/notification.rb', line 4

def title
  @title
end

#url_argsObject

Returns the value of attribute url_args.



4
5
6
# File 'lib/crusade/apns/notification.rb', line 4

def url_args
  @url_args
end

Instance Method Details

#json_sizeObject



18
19
20
# File 'lib/crusade/apns/notification.rb', line 18

def json_size
  to_json.size
end

#to_jsonObject



14
15
16
# File 'lib/crusade/apns/notification.rb', line 14

def to_json
  payload.to_json
end