Class: PushBuilder::Payload

Inherits:
Object
  • Object
show all
Defined in:
lib/push_builder/payload.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Payload

Returns a new instance of Payload.



5
6
7
8
9
# File 'lib/push_builder/payload.rb', line 5

def initialize(args={})
  @aps = APS.new
  @custom_data = {}
  @third_party_data = {}
end

Instance Attribute Details

#apsObject

Returns the value of attribute aps.



3
4
5
# File 'lib/push_builder/payload.rb', line 3

def aps
  @aps
end

#custom_dataObject

Returns the value of attribute custom_data.



3
4
5
# File 'lib/push_builder/payload.rb', line 3

def custom_data
  @custom_data
end

#third_party_dataObject

Returns the value of attribute third_party_data.



3
4
5
# File 'lib/push_builder/payload.rb', line 3

def third_party_data
  @third_party_data
end

Instance Method Details

#to_jsonObject



35
36
37
38
# File 'lib/push_builder/payload.rb', line 35

def to_json
  payload = custom_data.merge(aps: aps.to_hash)
  Compiler.new(payload, third_party_data).compile
end