[Teapot and Voyage] sending over the voyageId

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[Teapot and Voyage] sending over the voyageId

sergio_101

I am working on the U of the CRUD part of my Teapot/Voyage REST interface, and found that I cannot get the voyageId to be delivered as part of the REST response..

in order to do RUD, I will need that in the feed.

the problem is that NeoJSON uses the instance variables to JSON encode the object.

to circumvent this, i made an instance variable called ‘id’.. and made an accessor like so:

id
^ self voyageId value

so i can do something like

station id -> ‘23434234234243423432’

but when i inspect the object, or send it back from voyage, id is nil..

rather than mirror voyage’s _id, i would like access to it in JSON encoding, but i can see that might be a problem..

any ideas?

thanks!

----
peace,
sergio
photographer, journalist, visionary

Public Key: http://bit.ly/29z9fG0
#BitMessage BM-NBaswViL21xqgg9STRJjaJaUoyiNe2dV
http://www.Village-Buzz.com
http://www.ThoseOptimizeGuys.com
http://www.coffee-black.com
http://www.painlessfrugality.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101

signature.asc (852 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Teapot and Voyage] sending over the voyageId

NorbertHartl
NeoJSON is not bound to use instVars. Look at the method mapAccessor: and friends.

Norbert

Am 09.02.2017 um 22:50 schrieb sergio ruiz <[hidden email]>:


I am working on the U of the CRUD part of my Teapot/Voyage REST interface, and found that I cannot get the voyageId to be delivered as part of the REST response..

in order to do RUD, I will need that in the feed.

the problem is that NeoJSON uses the instance variables to JSON encode the object.

to circumvent this, i made an instance variable called ‘id’.. and made an accessor like so:

id
^ self voyageId value

so i can do something like

station id -> ‘23434234234243423432’

but when i inspect the object, or send it back from voyage, id is nil..

rather than mirror voyage’s _id, i would like access to it in JSON encoding, but i can see that might be a problem..

any ideas?

thanks!

Reply | Threaded
Open this post in threaded view
|

Re: [Teapot and Voyage] sending over the voyageId

sergio_101
Forgot to mention, i have this on my class..

neoJsonMapping: mapper
mapper for: self do: [ :mapping | mapping mapInstVars ]

will dig into this a bit more today..

thanks!



On February 10, 2017 at 2:04:14 AM, Norbert Hartl ([hidden email]) wrote:

NeoJSON is not bound to use instVars. Look at the method mapAccessor: and friends.

Norbert
----
peace,
sergio
photographer, journalist, visionary

Public Key: http://bit.ly/29z9fG0
#BitMessage BM-NBaswViL21xqgg9STRJjaJaUoyiNe2dV
http://www.Village-Buzz.com
http://www.ThoseOptimizeGuys.com
http://www.coffee-black.com
http://www.painlessfrugality.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101

signature.asc (852 bytes) Download Attachment