Topic: Console. How to simulate an Object / Data returned from external API

hey.
im doing some stuff in the console to simulate some code in production that takes a callback from a call to an API and then does some stuff with the data..

its all pretty standard stuff but i'm trying to simulate the data object that the server returns in my code and i'm not having luck.

basically, all i want to do is end up with some kind of object that i can assign custom parameter / value pairs to that i can access via dot syntax such as this:

myObject.thing = value

as this is the format of the data that the API returns..

Is there a way i can instantiate some kind of anonymous object in the console, assign the values myself, then use that to run through my code?

Thanks!

Re: Console. How to simulate an Object / Data returned from external API

Just type in the code, i.e.

>> class myObject
?>    attr :thing
?>  end
=> nil
>> t = myObject.new
=> #myObject......
>> t.thing = "test"
=> #myObject.....
>> yourcode(t)
=> god knows...
Joe got a job, on the day shift, at the Utility Muffin Research Kitchen, arrogantly twisting the sterile canvas snout of a fully charged icing anointment utensil.

Re: Console. How to simulate an Object / Data returned from external API

:-)
Thank you.

Re: Console. How to simulate an Object / Data returned from external API

OK so trying this i'm getting an error.. no idea why. perhaps you can help again!

>>class Sc
>>  attr :plan
>>end
=> nil

>> s = Sc.new
=> #<Sc:0x10a0c1f38>


>> s.plan = "s"
NoMethodError: undefined method `plan=' for #<Sc:0x10a0c1f38>
    from (irb):29

Thanks again