Class: Pushr::MessageApns2

Inherits:
Message
  • Object
show all
Defined in:
lib/pushr/message_apns2.rb

Constant Summary collapse

POSTFIX =
'apns2'

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#alertObject

Returns the value of attribute alert.



5
6
7
# File 'lib/pushr/message_apns2.rb', line 5

def alert
  @alert
end

#apns_collapse_idObject

Returns the value of attribute apns_collapse_id.



5
6
7
# File 'lib/pushr/message_apns2.rb', line 5

def apns_collapse_id
  @apns_collapse_id
end

#apns_expirationObject

Returns the value of attribute apns_expiration.



5
6
7
# File 'lib/pushr/message_apns2.rb', line 5

def apns_expiration
  @apns_expiration
end

#apns_idObject

Returns the value of attribute apns_id.



5
6
7
# File 'lib/pushr/message_apns2.rb', line 5

def apns_id
  @apns_id
end

#apns_priorityObject

Returns the value of attribute apns_priority.



5
6
7
# File 'lib/pushr/message_apns2.rb', line 5

def apns_priority
  @apns_priority
end

#apns_topicObject

Returns the value of attribute apns_topic.



5
6
7
# File 'lib/pushr/message_apns2.rb', line 5

def apns_topic
  @apns_topic
end

#badgeObject

Returns the value of attribute badge.



5
6
7
# File 'lib/pushr/message_apns2.rb', line 5

def badge
  @badge
end

#categoryObject

Returns the value of attribute category.



5
6
7
# File 'lib/pushr/message_apns2.rb', line 5

def category
  @category
end

#content_availableObject

Returns the value of attribute content_available.



5
6
7
# File 'lib/pushr/message_apns2.rb', line 5

def content_available
  @content_available
end

#custom_payloadObject

Returns the value of attribute custom_payload.



5
6
7
# File 'lib/pushr/message_apns2.rb', line 5

def custom_payload
  @custom_payload
end

#mutable_contentObject

Returns the value of attribute mutable_content.



5
6
7
# File 'lib/pushr/message_apns2.rb', line 5

def mutable_content
  @mutable_content
end

#soundObject

Returns the value of attribute sound.



5
6
7
# File 'lib/pushr/message_apns2.rb', line 5

def sound
  @sound
end

#tokenObject

Returns the value of attribute token.



5
6
7
# File 'lib/pushr/message_apns2.rb', line 5

def token
  @token
end

#url_argsObject

Returns the value of attribute url_args.



5
6
7
# File 'lib/pushr/message_apns2.rb', line 5

def url_args
  @url_args
end

Instance Method Details

#bodyObject



14
15
16
# File 'lib/pushr/message_apns2.rb', line 14

def body
  JSON.dump(to_message).force_encoding(Encoding::BINARY)
end

#to_hashObject



18
19
20
21
22
23
24
25
# File 'lib/pushr/message_apns2.rb', line 18

def to_hash
  hsh = { type: self.class.to_s, app: app, token: token, alert: alert, badge: badge, sound: sound,
          category: category, content_available: content_available, mutable_content: mutable_content,
          url_args: url_args, apns_id: apns_id, apns_expiration: apns_expiration, apns_priority: apns_priority,
          apns_topic: apns_topic, apns_collapse_id: apns_collapse_id, custom_payload: custom_payload }
  hsh[Pushr::Core.external_id_tag] = external_id if external_id
  hsh
end