undefined method 'dump' for MultiJson #6

Closed
sanjaymandadi opened this Issue Feb 23, 2013 · 4 comments

Projects

None yet

2 participants

@sanjaymandadi

Hi,
i am running into the following issue when trying to push messages...am i missing anything?

Rails 3.2.11
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin12.2.0]

[2013-02-23 01:30:25] [ERROR] NoMethodError, undefined method dump' for MultiJson:Module: .rvm/gems/ruby-1.9.2-p290@rr/gems/push-gcm-1.0.2/lib/push/message_gcm.rb:18:into_message'
/Users/sanjay/.rvm/gems/ruby-1.9.2-p290@rr/gems/push-core-1.0.2/lib/push/message.rb:16:in deliver' /Users/sanjay/.rvm/gems/ruby-1.9.2-p290@rr/gems/push-core-1.0.2/lib/push/daemon/delivery_handler.rb:37:inhandle_next_notification'
/Users/sanjay/.rvm/gems/ruby-1.9.2-p290@rr/gems/push-core-1.0.2/lib/push/daemon/delivery_handler.rb:16:in block (2 levels) in start' /Users/sanjay/.rvm/gems/ruby-1.9.2-p290@rr/gems/push-core-1.0.2/lib/push/daemon/delivery_handler.rb:14:inloop'
/Users/sanjay/.rvm/gems/ruby-1.9.2-p290@rr/gems/push-core-1.0.2/lib/push/daemon/delivery_handler.rb:14:in `block in start'

@tompesman
Owner

Can you try to update the multi_json gem?

@sanjaymandadi

found my issue, i have another gem (assistly) which is locking multi_json at 1.0.4

Sanjay

On Feb 23, 2013, at 4:25 AM, Tom Pesman notifications@github.com wrote:

Can you try to update the multi_json gem?


Reply to this email directly or view it on GitHub.

@sanjaymandadi

Tom,
for Ios how do i send a JSON payload? use Payload property similar to android?

Examples of JSON Payloads
The following examples of the payload portion of notifications illustrate the practical use of the properties listed in Table 3-1. Properties with “acme” in the key name are examples of custom payload data. The examples include whitespace and newline characters for readability; for better performance, providers should omit whitespace and newline characters.
Example 1: The following payload has an aps dictionary with a simple, recommended form for alert messages with the default alert buttons (Close and View). It uses a string as the value of alert rather than a dictionary. This payload also has a custom array property.
{
"aps" : { "alert" : "Message received from Bob" },
"acme2" : [ "bang", "whiz" ]
}
Example 2. The payload in the example uses an aps dictionary to request that the device display an alert message with an Close button on the left and a localized title for the "action" button on the right side of the alert. In this case, “PLAY” is used as a key into the Localizable.strings file for the currently selected language to get the localized equivalent of “Play”. The aps dictionary also requests that the application icon be badged with 5.
{ "aps" : { "alert" : { "body" : "Bob wants to play poker", "action-loc-key" : "PLAY" }, "badge" : 5, }, "acme1" : "bar", "acme2" : [ "bang", "whiz" ] }
Example 3. The payload in this example specifies that device should display an alert message with both Close and View buttons. It also request that the application icon be badged with 9 and that a bundled alert sound be played when the notification is delivered.
{
"aps" : {
"alert" : "You got your emails.",
"badge" : 9,
"sound" : "bingbong.aiff"
},
"acme1" : "bar",
"acme2" : 42
}
Example 4. The interesting thing about the payload in this example is that it uses the loc-key and loc-args child properties of the alert dictionary to fetch a formatted localized string from the application’s bundle and substitute the variable string values (loc-args) in the appropriate places. It also specifies a custom sound and include a custom property.
{
"aps" : {
"alert" : { "loc-key" : "GAME_PLAY_REQUEST_FORMAT", "loc-args" : [ "Jenna", "Frank"] },
"sound" : "chime"
},
"acme" : "foo"
}
Example 5. The following example shows an empty aps dictionary; because the badge property is missing, any current badge number shown on the application icon is removed. The acme2 custom property is an array of two integers.
{
"aps" : {
},
"acme2" : [ 5, 8 ]
}

On Feb 23, 2013, at 4:25 AM, Tom Pesman notifications@github.com wrote:

Can you try to update the multi_json gem?


Reply to this email directly or view it on GitHub.

@tompesman
Owner

As you can see here: https://github.com/tompesman/push-apns/blob/master/lib/push/message_apns.rb#L34 It is possible to specify a hash for the alert attribute. It's also possible to specify additional parameters with the attributes_for_device parameter: https://github.com/tompesman/push-apns/blob/master/lib/push/message_apns.rb#L25

You can see the resulting structure in the as_json method which corresponds with the json in your examples. https://github.com/tompesman/push-apns/blob/master/lib/push/message_apns.rb#L68

@tompesman tompesman closed this in caaab0a Feb 26, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment