Class: PushBuilder::Compiler

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

Constant Summary collapse

MAX_PAYLOAD_SIZE =
256

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(payload, third_party_data = {}) ⇒ Compiler

Returns a new instance of Compiler.



9
10
11
12
# File 'lib/push_builder/compiler.rb', line 9

def initialize(payload, third_party_data={})
  @payload = payload
  @third_party_data = third_party_data
end

Instance Attribute Details

#payloadObject (readonly)

Returns the value of attribute payload.



7
8
9
# File 'lib/push_builder/compiler.rb', line 7

def payload
  @payload
end

#third_party_dataObject (readonly)

Returns the value of attribute third_party_data.



7
8
9
# File 'lib/push_builder/compiler.rb', line 7

def third_party_data
  @third_party_data
end

Instance Method Details

#compileObject



14
15
16
17
18
# File 'lib/push_builder/compiler.rb', line 14

def compile
  crop_alert_if_necessary!

  to_json(third_party_data.merge(payload))
end